4.6.10 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)[source]

Combines data from all MPI nodes.

Note that complex datatypes and user-defined reduction operators are not properly supported in numba-compiled cases.

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

  • operator – 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)[source]

Overload the mpi_allreduce function.

ol_mpi_recv(data, source, tag)[source]

Overload the mpi_recv function.

Parameters:
ol_mpi_send(data, dest, tag)[source]

Overload the mpi_send function.

Parameters:
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