Skip to content

Commit

Permalink
Blackened code
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnnsnk committed Dec 4, 2023
1 parent 1528461 commit eea5d70
Show file tree
Hide file tree
Showing 317 changed files with 8,345 additions and 6,499 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ jobs:
- name: "Run flake8..."
run: |
flake8 .
flake8 .
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ libtool
/.settings/
doxygen
python/test/log.txt
.vscode/
.vscode/
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ libnestgpu.la: $(OBJS)

lib_LTLIBRARIES = libnestgpu.la

%.cu:
%.cu:

clean-local:
rm -f *.so obj/*.o
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
NEST GPU is a GPU-MPI library for simulation of large-scale networks of spiking neurons.
Can be used in Python, in C++ and in C.

With this library it is possible to run relatively fast simulations of large-scale networks of spiking neurons. For instance, on a single Nvidia GeForce RTX 2080 Ti GPU board it is possible to simulate the activity of 1 million multisynapse AdEx neurons with 1000 synapse per neurons, for a total of 1 billion synapse, using the fifth-order Runge-Kutta method with adaptive stepsize as differential equations solver, in little more than 70 seconds per second of neural activity. The MPI communication is also very efficient.
With this library it is possible to run relatively fast simulations of large-scale networks of spiking neurons. For instance, on a single Nvidia GeForce RTX 2080 Ti GPU board it is possible to simulate the activity of 1 million multisynapse AdEx neurons with 1000 synapse per neurons, for a total of 1 billion synapse, using the fifth-order Runge-Kutta method with adaptive stepsize as differential equations solver, in little more than 70 seconds per second of neural activity. The MPI communication is also very efficient.
The Python interface is very similar to that of the NEST simulator: the most used commands are practically identical, dictionaries are used to define neurons, connections and synapses properties in the same way.

## Documentation
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.08
1.08
4 changes: 2 additions & 2 deletions c++/examples/brunel_mpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main(int argc, char *argv[])
cout << "Building on host " << mpi_id << " ..." <<endl;

ngpu.SetRandomSeed(1234ULL + mpi_id); // seed for GPU random numbers

//////////////////////////////////////////////////////////////////////
// WRITE HERE COMMANDS THAT ARE EXECUTED ON ALL HOSTS
//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -82,7 +82,7 @@ int main(int argc, char *argv[])
n_receptors);
NodeSeq exc_neuron = neuron.Subseq(0,NE-1); // excitatory neuron group
NodeSeq inh_neuron = neuron.Subseq(NE, n_neurons-1); //inhibitory neuron group

// the following parameters are set to the same values on all hosts
float E_rev[] = {0.0, -85.0};
float tau_decay[] = {1.0, 1.0};
Expand Down
20 changes: 10 additions & 10 deletions c++/examples/brunel_mpi_nx.cpp.old
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ int main(int argc, char *argv[])
cerr << "Usage: mpirun -np <number-of-mpi-hosts> brunel_mpi_nx\n";
return -1;
}

int mpi_id = neural_gpu.MpiId();
cout << "Building on host " << mpi_id << " ..." <<endl;

neural_gpu.max_spike_buffer_num_=10; //reduce it to save GPU memory

//////////////////////////////////////////////////////////////////////
// WRITE HERE COMMANDS THAT ARE EXECUTED ON ALL HOSTS
//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -62,7 +62,7 @@ int main(int argc, char *argv[])
int neuron = neural_gpu.CreateNeuron(n_neurons, n_receptors);
int exc_neuron = neuron; // excitatory neuron id
int inh_neuron = neuron + NE; // inhibitory neuron id

// the following parameters are set to the same values on all hosts
float E_rev[] = {0.0, -85.0};
float tau_decay[] = {1.0, 1.0};
Expand Down Expand Up @@ -95,13 +95,13 @@ int main(int argc, char *argv[])
// connect poisson generator to port 0 of all neurons
neural_gpu.ConnectAllToAll(pg, n_pg, neuron, n_neurons, 0, poiss_weight,
poiss_delay);

char filename[100];
sprintf(filename, "test_brunel_mpi_nx_%d.dat", mpi_id);
int i_neurons[] = {2000, 8000, 9999}; // any set of neuron indexes
// create multimeter record of V_m
neural_gpu.CreateRecord(string(filename), "V_m", i_neurons, 3);

//////////////////////////////////////////////////////////////////////
// WRITE HERE REMOTE CONNECTIONS
//////////////////////////////////////////////////////////////////////
Expand All @@ -120,8 +120,8 @@ int main(int argc, char *argv[])
neural_gpu.RemoteConnectFixedIndegree(ish2, exc_neuron+NE-NEext/2,
NEext/2, ith, neuron, n_neurons,
0, Wex, delay, CE/4);


// Inhibitory remote connections
// connect inhibitory neurons to port 1 of all neurons
// weight Win and fixed indegree CI-CI*3/4
Expand All @@ -133,9 +133,9 @@ int main(int argc, char *argv[])
neural_gpu.RemoteConnectFixedIndegree(ish2, inh_neuron+NI-NIext/2,
NIext/2, ith, neuron, n_neurons,
1, Win, delay, CI/4);

}

neural_gpu.SetRandomSeed(1234ULL); // just to have same results in different simulations
neural_gpu.Simulate();

Expand Down
6 changes: 3 additions & 3 deletions c++/examples/brunel_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(int argc, char *argv[])
cout << "Building ...\n";

ngpu.SetRandomSeed(1234ULL); // seed for GPU random numbers

int n_receptors = 2;

int order = arg1/5;
Expand Down Expand Up @@ -80,7 +80,7 @@ int main(int argc, char *argv[])
ngpu.SetNeuronParam(neuron, "E_rev", E_rev, 2);
ngpu.SetNeuronParam(neuron, "tau_decay", tau_decay, 2);
ngpu.SetNeuronParam(neuron, "tau_rise", tau_rise, 2);

float mean_delay = 0.5;
float std_delay = 0.25;
float min_delay = 0.1;
Expand All @@ -90,7 +90,7 @@ int main(int argc, char *argv[])
float *exc_delays = ngpu.RandomNormalClipped(CE*n_neurons, mean_delay,
std_delay, min_delay,
mean_delay+3*std_delay);

ConnSpec conn_spec1(FIXED_INDEGREE, CE);
SynSpec syn_spec1;
syn_spec1.SetParam("receptor", 0);
Expand Down
8 changes: 4 additions & 4 deletions c++/examples/brunel_outdegree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(int argc, char *argv[])
cout << "Building ...\n";

ngpu.SetRandomSeed(12345ULL); // seed for GPU random numbers

int n_receptors = 2;

int order = arg1/5;
Expand All @@ -53,7 +53,7 @@ int main(int argc, char *argv[])
int n_neurons = NE + NI; // number of neurons in total

int CPN = 1000; // number of output connections per neuron

float Wex = 0.05;
float Win = 0.35;

Expand All @@ -79,7 +79,7 @@ int main(int argc, char *argv[])
ngpu.SetNeuronParam(neuron, "E_rev", E_rev, 2);
ngpu.SetNeuronParam(neuron, "tau_decay", tau_decay, 2);
ngpu.SetNeuronParam(neuron, "tau_rise", tau_rise, 2);

float mean_delay = 0.5;
float std_delay = 0.25;
float min_delay = 0.1;
Expand All @@ -89,7 +89,7 @@ int main(int argc, char *argv[])
float *exc_delays = ngpu.RandomNormalClipped(CPN*NE, mean_delay,
std_delay, min_delay,
mean_delay+3*std_delay);

ConnSpec conn_spec1(FIXED_OUTDEGREE, CPN);
SynSpec syn_spec1;
syn_spec1.SetParam("receptor", 0);
Expand Down
10 changes: 5 additions & 5 deletions c++/examples/brunel_outdegree_mpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ int main(int argc, char *argv[])
}
int arg1;
sscanf(argv[1], "%d", &arg1);

int mpi_id = ngpu.MpiId();
cout << "Building on host " << mpi_id << " ..." <<endl;

ngpu.SetRandomSeed(12345ULL + mpi_id); // seed for GPU random numbers

//////////////////////////////////////////////////////////////////////
// WRITE HERE COMMANDS THAT ARE EXECUTED ON ALL HOSTS
//////////////////////////////////////////////////////////////////////
Expand All @@ -68,7 +68,7 @@ int main(int argc, char *argv[])
// send their output to neurons of another mpi host
int NEext = (int)(fext*NE);
int NEint = NE - NEext;

float Wex = 0.05;
float Win = 0.35;

Expand All @@ -88,9 +88,9 @@ int main(int argc, char *argv[])
// of neurons that project internally
NodeSeq excext_neuron = neuron.Subseq(NEint,NE-1); // excitatory group
// of neurons that project externally

NodeSeq inh_neuron = neuron.Subseq(NE, n_neurons-1); //inhibitory neuron group

// the following parameters are set to the same values on all hosts
float E_rev[] = {0.0, -85.0};
float tau_decay[] = {1.0, 1.0};
Expand Down
8 changes: 4 additions & 4 deletions c++/examples/brunel_vect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(int argc, char *argv[])
cout << "Building ...\n";

ngpu.SetRandomSeed(1234ULL); // seed for GPU random numbers

int n_receptors = 2;

int order = arg1/5;
Expand Down Expand Up @@ -84,7 +84,7 @@ int main(int argc, char *argv[])
ngpu.SetNeuronParam(neuron_vect, "E_rev", E_rev, 2);
ngpu.SetNeuronParam(neuron_vect, "tau_decay", tau_decay, 2);
ngpu.SetNeuronParam(neuron_vect, "tau_rise", tau_rise, 2);

float mean_delay = 0.5;
float std_delay = 0.25;
float min_delay = 0.1;
Expand All @@ -94,7 +94,7 @@ int main(int argc, char *argv[])
float *exc_delays = ngpu.RandomNormalClipped(CE*n_neurons, mean_delay,
std_delay, min_delay,
mean_delay+3*std_delay);

ConnSpec conn_spec1(FIXED_INDEGREE, CE);
SynSpec syn_spec1;
syn_spec1.SetParam("receptor", 0);
Expand Down Expand Up @@ -124,7 +124,7 @@ int main(int argc, char *argv[])
// connect poisson generator to port 0 of all neurons
ngpu.Connect(pg_vect, neuron_vect, conn_spec3, syn_spec3);
char filename[] = "test_brunel_vect.dat";

int i_neuron_arr[] = {neuron[0], neuron[rand()%n_neurons],
neuron[n_neurons-1]}; // any set of neuron indexes
// create multimeter record of V_m
Expand Down
1 change: 0 additions & 1 deletion c++/examples/make_brunel_net.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
g++ -Wall -I ../../src -o bin/brunel_net brunel_net.cpp -lm -lnestgpu

1 change: 0 additions & 1 deletion c++/examples/make_brunel_outdegree.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
g++ -Wall -I ../../src -o bin/brunel_outdegree brunel_outdegree.cpp -lm -lnestgpu

1 change: 0 additions & 1 deletion c++/examples/make_brunel_vect.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
g++ -Wall -I ../../src -o bin/brunel_vect brunel_vect.cpp -lm -lnestgpu

1 change: 0 additions & 1 deletion c++/examples/make_constcurr.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
g++ -Wall -I ../../src -o bin/test_constcurr test_constcurr.cpp -lm -lnestgpu

1 change: 0 additions & 1 deletion c++/examples/make_setvar.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
g++ -Wall -I ../../src -o bin/test_setvar test_setvar.cpp -lm -lnestgpu

1 change: 0 additions & 1 deletion c++/examples/make_test_connect.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
g++ -Wall -I ../../src -o bin/test_connect test_connect.cpp -lm -lnestgpu

6 changes: 3 additions & 3 deletions c++/examples/test_aeif_cond_beta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ int main(int argc, char *argv[])
{
NESTGPU ngpu;
cout << "Building ...\n";

srand(12345);
int n_neurons = 10000;

// create n_neurons neurons with 3 receptor ports
NodeSeq neuron = ngpu.Create("aeif_cond_beta", n_neurons, 3);

Expand All @@ -63,7 +63,7 @@ int main(int argc, char *argv[])
// set spike times and height
ngpu.SetNeuronParam(sg, "spike_times", spike_times, n_spikes);
ngpu.SetNeuronParam(sg, "spike_heights", spike_heights, n_spikes);

float delay[] = {1.0, 100.0, 130.0};
float weight[] = {0.1, 0.2, 0.5};

Expand Down
12 changes: 6 additions & 6 deletions c++/examples/test_connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
int main(int argc, char *argv[])
{
const int N = 5;

NESTGPU ngpu;

NodeSeq neuron = ngpu.Create("aeif_cond_beta", 2*N);
Expand Down Expand Up @@ -67,7 +67,7 @@ int main(int argc, char *argv[])
SynSpec odd_to_even_syn_spec;
odd_to_even_syn_spec.SetParam("weight_array", odd_to_even_weight);
odd_to_even_syn_spec.SetParam("delay_array", odd_to_even_delay);

ngpu.Connect(neuron_even, neuron_odd, conn_spec, even_to_odd_syn_spec);
ngpu.Connect(neuron_odd, neuron_even, conn_spec, odd_to_even_syn_spec);

Expand Down Expand Up @@ -95,7 +95,7 @@ int main(int argc, char *argv[])
}
std::cout << "########################################\n";


// All to odd
conn_id = ngpu.GetConnections(neuron, neuron_odd);
conn_stat_vect = ngpu.GetConnectionStatus(conn_id);
Expand All @@ -118,7 +118,7 @@ int main(int argc, char *argv[])
}
std::cout << "########################################\n";


// Even to 3,4,5,6
NodeSeq neuron_3_6 = neuron.Subseq(3,6);
conn_id = ngpu.GetConnections(neuron_even, neuron_3_6);
Expand All @@ -142,7 +142,7 @@ int main(int argc, char *argv[])
}
std::cout << "########################################\n";


// 3,4,5,6 to odd
conn_id = ngpu.GetConnections(neuron_3_6, neuron_odd);
conn_stat_vect = ngpu.GetConnectionStatus(conn_id);
Expand All @@ -165,6 +165,6 @@ int main(int argc, char *argv[])
}
std::cout << "########################################\n";


return 0;
}
4 changes: 2 additions & 2 deletions c++/examples/test_constcurr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ int main(int argc, char *argv[])
{
NESTGPU ngpu;
cout << "Building ...\n";

srand(12345);
int n_neurons = 10000;

// create n_neurons neurons with 1 receptor ports
NodeSeq neuron = ngpu.Create("aeif_cond_beta", n_neurons, 1);

Expand Down
6 changes: 3 additions & 3 deletions c++/examples/test_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int main(int argc, char *argv[])
cout << "Building ...\n";

ngpu.SetRandomSeed(1234ULL); // seed for GPU random numbers

int n_receptors = 2;

int order = arg1/5;
Expand Down Expand Up @@ -83,7 +83,7 @@ int main(int argc, char *argv[])
ngpu.SetNeuronParam(neuron, "Non-existent", E_rev, 2);
ngpu.SetNeuronParam(neuron, "tau_decay", tau_decay, 2);
ngpu.SetNeuronParam(neuron, "tau_rise", tau_rise, 2);

float mean_delay = 0.5;
float std_delay = 0.25;
float min_delay = 0.1;
Expand All @@ -93,7 +93,7 @@ int main(int argc, char *argv[])
float *exc_delays = ngpu.RandomNormalClipped(CE*n_neurons, mean_delay,
std_delay, min_delay,
mean_delay+3*std_delay);

ConnSpec conn_spec1(FIXED_INDEGREE, CE);
SynSpec syn_spec1;
syn_spec1.SetParam("receptor", 0);
Expand Down
Loading

0 comments on commit eea5d70

Please sign in to comment.