4.6.9 pde.tools.mpi module

Auxillary functions and variables for dealing with MPI multiprocessing

Warning

These functions are mostly no-ops unless MPI is properly installed and python code was started using mpirun or mpiexec. Please refer to the documentation of your MPI distribution for details.

mpi_send

send data to another MPI node

mpi_recv

receive data from another MPI node

mpi_allreduce

combines data from all MPI nodes

initialized: bool = False

Flag determining whether mpi was initialized (and is available)

Type:

bool

is_main: bool = True

Flag indicating whether the current process is the main process (with ID 0)

Type:

bool

mpi_allreduce(data, operator=None)[source]

combines data from all MPI nodes

Note that complex datatypes and user-defined functions are not properly supported.

Parameters:
  • data – Data being send from this node to all others

  • operator (int | str | None) – The operator used to combine all data. Possible options are summarized in the IntEnum numba_mpi.Operator.

Returns:

The accumulated data

mpi_recv(data, source, tag)[source]

receive data from another MPI node

Parameters:
  • data – A buffer into which the received data is written

  • dest (int) – The ID of the sending node

  • tag (int) – A numeric tag identifying the message

Return type:

None

mpi_send(data, dest, tag)[source]

send data to another MPI node

Parameters:
  • data – The data being send

  • dest (int) – The ID of the receiving node

  • tag (int) – A numeric tag identifying the message

Return type:

None

ol_mpi_allreduce(data, operator=None)[source]

overload the mpi_allreduce function

Parameters:

operator (int | str | None) –

ol_mpi_recv(data, source, tag)[source]

overload the mpi_recv function

Parameters:
  • source (int) –

  • tag (int) –

ol_mpi_send(data, dest, tag)[source]

overload the mpi_send function

Parameters:
  • dest (int) –

  • tag (int) –

parallel_run: bool = False

Flag indicating whether the current run is using multiprocessing

Type:

bool

rank: int = 0

ID of the current process

Type:

int

size: int = 1

Total process count

Type:

int