mpirical.mpirun

class mpirical.mpirun(return_rank='all', **kwargs)[source]

A decorator to execute functions in their own MPI environment

__init__(return_rank='all', **kwargs)[source]

Run a function in an MPI environment

The mpirun decorator will run the function with the installed mpirun executable that is part of the MPI installation used by mpi4py.

Parameters
return_rankint or [int] or 'all'

Indicates the ranks from which the return values will be gathered across the MPI environment. If 'all' is specified, then all of the return values from all MPI ranks will be returned in a list. If a list of integers is given, then only those MPI ranks will return values (in the order specified). If only 1 integer is given, then the return value from that rank will be returned (not in a list).

kwargsdict

Dictionary that stores the arguments (without their initiall -) to be given to the mpirun command. Any value other than None will be converted to a string and passed as part of the mpirun argument. For example, the keyword np with the value 4 (i.e., kwargs = {'np': 4}) would result in mpirun being called with the arguments -np 4.

Methods

__init__([return_rank])

Run a function in an MPI environment