23#ifndef STIMULATION_BACKEND_MPI_H
24#define STIMULATION_BACKEND_MPI_H
31#include <netinet/in.h>
33#include <sys/socket.h>
152 using device_map = std::vector< std::map< size_t, std::pair< const MPI_Comm*, StimulationDevice* > > >;
159 typedef std::map< std::string, std::tuple< MPI_Comm*, std::vector< int >*,
int* > >
comm_map;
170 void get_port(
size_t index_node,
const std::string& label, std::string* port_name );
181 static std::pair< int*, double* >
receive_spike_train(
const MPI_Comm& comm, std::vector< int >& device_id );
189 void update_device(
int* array_index, std::vector< int >& devices_id, std::pair< int*, double* > data );
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
A simple input backend MPI implementation.
Definition stimulation_backend_mpi.h:110
void post_run_hook() override
Clean up the backend at the end of a Run.
Definition stimulation_backend_mpi.cpp:249
std::string mpi_address_
Definition stimulation_backend_mpi.h:162
bool prepared_
Definition stimulation_backend_mpi.h:144
void cleanup() override
Clean up the backend at the end of a user level call to the NEST Simulate function.
Definition stimulation_backend_mpi.cpp:264
static std::pair< int *, double * > receive_spike_train(const MPI_Comm &comm, std::vector< int > &device_id)
MPI communication for receiving the data before each run.
Definition stimulation_backend_mpi.cpp:351
void finalize() override
Definition stimulation_backend_mpi.cpp:57
~StimulationBackendMPI() noexcept override
InputBackend destructor.
Definition stimulation_backend_mpi.cpp:43
void disenroll(StimulationDevice &device) override
Disenroll a StimulationDevice from the StimulationBackend.
Definition stimulation_backend_mpi.cpp:92
bool enrolled_
Definition stimulation_backend_mpi.h:143
void get_port(StimulationDevice *device, std::string *port_name)
Getting the port name for the MPI connection.
Definition stimulation_backend_mpi.cpp:292
void clean_memory_input_data(std::vector< std::pair< int *, double * > > &data)
clean all the memory allocated for the updating device.
Definition stimulation_backend_mpi.cpp:421
void update_device(int *array_index, std::vector< int > &devices_id, std::pair< int *, double * > data)
Update all the devices with the data received.
Definition stimulation_backend_mpi.cpp:376
void initialize() override
Definition stimulation_backend_mpi.cpp:49
std::map< std::string, std::tuple< MPI_Comm *, std::vector< int > *, int * > > comm_map
A map of MPI communicators used by the master thread for the MPI communication.
Definition stimulation_backend_mpi.h:159
std::vector< std::map< size_t, std::pair< const MPI_Comm *, StimulationDevice * > > > device_map
A map for the enrolled devices.
Definition stimulation_backend_mpi.h:152
void pre_run_hook() override
Initialize global backend-specific data structures.
Definition stimulation_backend_mpi.cpp:211
void enroll(StimulationDevice &device, const Dictionary ¶ms) override
Enroll a StimulationDevice with the StimulationBackend.
Definition stimulation_backend_mpi.cpp:69
comm_map commMap_
Definition stimulation_backend_mpi.h:160
void prepare() override
Prepare the backend at the beginning of the NEST Simulate function.
Definition stimulation_backend_mpi.cpp:106
StimulationBackendMPI()
InputBackend constructor.
Definition stimulation_backend_mpi.cpp:37
device_map devices_
Definition stimulation_backend_mpi.h:153
Abstract base class for all NESTio stimulation backends.
Definition stimulation_backend.h:68
Base class for common properties of StimulationDevices.
Definition stimulation_device.h:154
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33