Skip to content
Snippets Groups Projects
Commit 30dc184d authored by Simon Oehrl's avatar Simon Oehrl
Browse files

Merge branch 'release/0.2.0'

parents 80c72909 9c5fbdad
No related branches found
No related tags found
No related merge requests found
Pipeline #163444 passed
Showing with 117 additions and 16 deletions
FROM ubuntu:latest FROM ubuntu:18.04
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
cmake g++ make ninja-build python3 python3-dev python3-pip python3-numpy python3-scipy python3-matplotlib \ cmake g++ make ninja-build python3 python3-dev python3-pip python3-numpy python3-scipy python3-matplotlib \
...@@ -40,16 +40,18 @@ RUN cmake \ ...@@ -40,16 +40,18 @@ RUN cmake \
/libpqxx /libpqxx
RUN ninja && ninja install RUN ninja && ninja install
COPY . /insite COPY src /insite-module
WORKDIR /insite-build WORKDIR /insite-module-build
RUN cmake \ RUN cmake \
-G Ninja \ -G Ninja \
-Dwith-nest=/nest-install/bin/nest-config \ -Dwith-nest=/nest-install/bin/nest-config \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
/insite /insite-module
RUN ninja && ninja install RUN ninja && ninja install
ENV PGPASSWORD=postgres ENV PGPASSWORD=postgres
COPY example /example
EXPOSE 8000 EXPOSE 8000
ENTRYPOINT "/insite-build/run_brunel_simulation.sh" ENTRYPOINT ["/insite-module-build/run_simulation.sh"]
CMD 1000 2500 2 CMD ["/example/brunel_simulation.py"]
\ No newline at end of file \ No newline at end of file
...@@ -74,7 +74,7 @@ startbuild = time.time() ...@@ -74,7 +74,7 @@ startbuild = time.time()
dt = 0.1 # the resolution in ms dt = 0.1 # the resolution in ms
simtime = float(sys.argv[1]) if len( simtime = float(sys.argv[1]) if len(
sys.argv) > 1 else 10000.0 # Simulation time in ms sys.argv) > 1 else 100.0 # Simulation time in ms
delay = 1.5 # synaptic delay in ms delay = 1.5 # synaptic delay in ms
...@@ -91,7 +91,7 @@ epsilon = 0.1 # connection probability ...@@ -91,7 +91,7 @@ epsilon = 0.1 # connection probability
# recorded from # recorded from
order = int(sys.argv[2]) if len( order = int(sys.argv[2]) if len(
sys.argv) > 2 else 2500 # Should be square, otherwise the position grid becomes invalid sys.argv) > 2 else 25 # Should be square, otherwise the position grid becomes invalid
NE = 4 * order # number of excitatory neurons NE = 4 * order # number of excitatory neurons
NI = 1 * order # number of inhibitory neurons NI = 1 * order # number of inhibitory neurons
N_neurons = NE + NI # number of neurons in total N_neurons = NE + NI # number of neurons in total
......
#!/bin/bash
source @NEST_INSTALL_PREFIX@/bin/nest_vars.sh
export LD_LIBRARY_PATH=$NEST_MODULE_PATH:/usr/local/lib/:$LD_LIBRARY_PATH
# python3 @CMAKE_SOURCE_DIR@/examples/brunel_simulation.py $1 $2 # Uncomment this to run normally
time mpirun -n $3 --mca btl_vader_single_copy_mechanism none --allow-run-as-root -x PYTHONPATH python3 @CMAKE_SOURCE_DIR@/examples/brunel_simulation.py $1 $2
\ No newline at end of file
...@@ -343,8 +343,8 @@ if ( ( NOT CMAKE_CROSSCOMPILING ) ...@@ -343,8 +343,8 @@ if ( ( NOT CMAKE_CROSSCOMPILING )
endif () endif ()
configure_file( configure_file(
${CMAKE_SOURCE_DIR}/examples/run_brunel_simulation.sh.in ${CMAKE_SOURCE_DIR}/scripts/run_simulation.sh.in
${CMAKE_BINARY_DIR}/run_brunel_simulation.sh ${CMAKE_BINARY_DIR}/run_simulation.sh
@ONLY @ONLY
) )
......
...@@ -59,7 +59,7 @@ std::vector<uint64_t> DataStorage::GetNeuronIds() { ...@@ -59,7 +59,7 @@ std::vector<uint64_t> DataStorage::GetNeuronIds() {
void DataStorage::AddSpike(double simulation_time, std::uint64_t gid) { void DataStorage::AddSpike(double simulation_time, std::uint64_t gid) {
std::unique_lock<std::mutex> lock(spike_mutex_); std::unique_lock<std::mutex> lock(spike_mutex_);
constexpr auto spike_occured_before = [](const Spike& lhs, const Spike& rhs) { const auto spike_occured_before = [](const Spike& lhs, const Spike& rhs) {
return lhs.simulation_time < rhs.simulation_time; return lhs.simulation_time < rhs.simulation_time;
}; };
const Spike spike{simulation_time, gid}; const Spike spike{simulation_time, gid};
......
File moved
File moved
File moved
File moved
File moved
File moved
...@@ -37,6 +37,86 @@ RecordingBackendInsite::RecordingBackendInsite() ...@@ -37,6 +37,86 @@ RecordingBackendInsite::RecordingBackendInsite()
: data_storage_("tgest"), : data_storage_("tgest"),
database_connection_("postgresql://postgres@" + ReadDatabaseHost()), database_connection_("postgresql://postgres@" + ReadDatabaseHost()),
http_server_("http://0.0.0.0:" + get_port_string(), &data_storage_, "postgresql://postgres@" + ReadDatabaseHost()) { http_server_("http://0.0.0.0:" + get_port_string(), &data_storage_, "postgresql://postgres@" + ReadDatabaseHost()) {
if (nest::kernel().mpi_manager.get_rank() == 0) {
pqxx::work txn(database_connection_);
txn.exec(R"db_query(
DROP TABLE IF EXISTS nest_simulation_node CASCADE;
DROP TABLE IF EXISTS nest_multimeter CASCADE;
DROP TABLE IF EXISTS nest_neuron CASCADE;
DROP TABLE IF EXISTS nest_neuron_multimeter CASCADE;
CREATE TABLE nest_simulation_node (
id SERIAL PRIMARY KEY NOT NULL UNIQUE,
address VARCHAR(50),
current_simulation_time FLOAT
);
CREATE TABLE nest_multimeter (
id INT PRIMARY KEY NOT NULL UNIQUE,
attributes VARCHAR(50) ARRAY
);
CREATE TABLE nest_neuron (
id INT PRIMARY KEY NOT NULL UNIQUE,
simulation_node_id INT,
population_id INT,
position FLOAT[],
FOREIGN KEY (simulation_node_id) REFERENCES nest_simulation_node (id)
);
CREATE TABLE nest_neuron_multimeter (
neuron_id INT NOT NULL,
multimeter_id INT NOT NULL,
PRIMARY KEY (neuron_id,multimeter_id),
FOREIGN KEY (neuron_id) REFERENCES nest_neuron (id),
FOREIGN KEY (multimeter_id) REFERENCES nest_multimeter (id)
);
DROP TABLE IF EXISTS arbor_simulation_node CASCADE;
DROP TABLE IF EXISTS arbor_cell CASCADE;
DROP TABLE IF EXISTS arbor_cell_property CASCADE;
DROP TABLE IF EXISTS arbor_attribute CASCADE;
DROP TABLE IF EXISTS arbor_probe CASCADE;
CREATE TABLE arbor_simulation_node (
id INT PRIMARY KEY NOT NULL UNIQUE,
address VARCHAR(50),
current_simulation_time FLOAT
);
CREATE TABLE arbor_cell (
id INT PRIMARY KEY NOT NULL UNIQUE
);
CREATE TABLE arbor_cell_property (
cell_id INT NOT NULL,
property VARCHAR(50) NOT NULL,
PRIMARY KEY (cell_id, property),
FOREIGN KEY (cell_id) REFERENCES arbor_cell (id)
);
CREATE TABLE arbor_attribute (
id INT PRIMARY KEY NOT NULL UNIQUE,
name VARCHAR(50) NOT NULL
);
CREATE TABLE arbor_probe (
id INT PRIMARY KEY NOT NULL UNIQUE,
cell_id INT NOT NULL,
segment_id INT NOT NULL,
position FLOAT,
attribute_id INT NOT NULL,
simulation_node_id INT,
FOREIGN KEY (simulation_node_id) REFERENCES arbor_simulation_node (id),
FOREIGN KEY (cell_id) REFERENCES arbor_cell (id),
FOREIGN KEY (attribute_id) REFERENCES arbor_attribute (id)
);
)db_query");
txn.commit();
}
pqxx::work txn(database_connection_); pqxx::work txn(database_connection_);
simulation_node_id_ = txn.exec1( simulation_node_id_ = txn.exec1(
"INSERT INTO nest_simulation_node (address) " "INSERT INTO nest_simulation_node (address) "
......
File moved
#!/bin/bash
# Usage: run_simulation.sh file_path mpi_nodes
source @NEST_INSTALL_PREFIX@/bin/nest_vars.sh
export LD_LIBRARY_PATH=$NEST_MODULE_PATH:/usr/local/lib/:$LD_LIBRARY_PATH
if [ "$#" -eq 1 ]; then
python3 $1
elif [ "$#" -eq 2 ]; then
mpirun -n $2 --mca btl_vader_single_copy_mechanism none --allow-run-as-root -x PYTHONPATH python3 $1
else
echo "$0 $*"
echo "Usage: $0 file_path [mpi_nodes]"
fi
# ls /nest-simulation
# if [ -f "/nest-simulation/simulation.py" ]; then
# echo "/nest-simulation/simulation.py exists"
# else
# echo "/nest-simulation/simulation.py does not exist"
# fi
# # Uncomment this to run normally
# time @CMAKE_SOURCE_DIR@/examples/brunel_simulation.py $1 $2
\ No newline at end of file
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment