hnn_core.parallel_backends.MPIBackend

class hnn_core.parallel_backends.MPIBackend(n_procs=None, mpi_cmd='mpiexec')[source]

The MPIBackend class.

Parameters
n_procsint | None

The number of MPI processes requested by the user. If None, then will attempt to detect number of cores (including hyperthreads) and start parallel simulation over all of them.

mpi_cmdstr

The name of the mpi launcher executable. Will use ‘mpiexec’ (openmpi) by default.

Attributes
n_procsint

The number of processes MPI will actually use (spread over cores). If 1 is specified or mpi4py could not be loaded, the simulation will be run with the JoblibBackend

mpi_cmdlist of str

The mpi command with number of procs and options to be passed to Popen

expected_data_lengthint

Used to check consistency between data that was sent and what MPIBackend received.

proc_queuethreading.Queue

A Queue object to hold process handles from Popen in a thread-safe way. There will be a valid process handle present the queue when a MPI åsimulation is running.

Methods

simulate(net, tstop, dt, n_trials[, postproc])

Simulate the HNN model in parallel on all cores

terminate()

Terminate running simulation on this MPIBackend

simulate(net, tstop, dt, n_trials, postproc=False)[source]

Simulate the HNN model in parallel on all cores

Parameters
netNetwork object

The Network object specifying how cells are connected.

tstopfloat

The simulation stop time (ms).

dtfloat

The integration time step of h.CVode (ms)

n_trialsint

Number of trials to simulate.

postprocbool

If False, no postprocessing applied to the dipole

Returns
dpllist of Dipole

The Dipole results from each simulation trial

terminate()[source]

Terminate running simulation on this MPIBackend

Safe to call from another thread from the one simulate_dipole was called from.