MPI (taurex.mpi
)¶
Module for wrapping MPI functions. Most functions will do nothing if mpi4py is not present.
Converts a numpy array into an MPI shared memory. This allow for things like opacities to be loaded only once per node when using MPI. Only activates if mpi4py installed and when enabled via the
mpi_use_shared
input:[Global] mpi_use_shared = True
or
force_shared=True
otherwise does nothing and returns the same array back- Parameters
arr (numpy array) – Array to convert
logger (
Logger
) – Logger object to print outputsforce_shared (bool) – Force conversion to shared memory
- Returns
If enabled and MPI present, shared memory version of array otherwise the original array
- Return type
array
-
barrier
(comm=None)[source]¶ Waits for all processes to finish. Does nothing if mpi4py not present
- Parameters
comm (int, optional) – MPI communicator, default is MPI_COMM_WORLD
-
get_rank
[source]¶ Gets rank or returns 0 if mpi is not installed
- Parameters
comm (int, optional) – MPI communicator, default is MPI_COMM_WORLD
- Returns
Rank of process in communitor or 0 if MPI is not installed
- Return type
int
-
nprocs
[source]¶ Gets number of processes or returns 1 if mpi is not installed
- Returns
Rank of process or 1 if MPI is not installed
- Return type
int
Returns the process id within a node. Used for shared memory