Skip to content

Latest commit

 

History

History
239 lines (147 loc) · 5.75 KB

mpi4py.rst

File metadata and controls

239 lines (147 loc) · 5.75 KB

mpi4py

mpi4py

Runtime configuration options

mpi4py.rc

This object has attributes exposing runtime configuration options that become effective at import time of the ~mpi4py.MPI module.

Attributes Summary

initialize Automatic MPI initialization at import
threads Request initialization with thread support
thread_level Level of thread support to request
finalize Automatic MPI finalization at exit
fast_reduce Use tree-based reductions for objects
recv_mprobe Use matched probes to receive objects
errors Error handling policy

Attributes Documentation

mpi4py.rc.initialize

Automatic MPI initialization at import.

type

bool

default

True

MPI4PY_RC_INITIALIZE

mpi4py.rc.threads

Request initialization with thread support.

type

bool

default

True

MPI4PY_RC_THREADS

mpi4py.rc.thread_level

Level of thread support to request.

type

str

default

"multiple"

choices

"multiple", "serialized", "funneled", "single"

MPI4PY_RC_THREAD_LEVEL

mpi4py.rc.finalize

Automatic MPI finalization at exit.

type

None or bool

default

None

MPI4PY_RC_FINALIZE

mpi4py.rc.fast_reduce

Use tree-based reductions for objects.

type

bool

default

True

MPI4PY_RC_FAST_REDUCE

mpi4py.rc.recv_mprobe

Use matched probes to receive objects.

type

bool

default

True

MPI4PY_RC_RECV_MPROBE

mpi4py.rc.errors

Error handling policy.

type

str

default

"exception"

choices

"exception", "default", "fatal"

MPI4PY_RC_ERRORS

Example

MPI for Python features automatic initialization and finalization of the MPI execution environment. By using the mpi4py.rc object, MPI initialization and finalization can be handled programatically:

import mpi4py
mpi4py.rc.initialize = False  # do not initialize MPI automatically
mpi4py.rc.finalize = False    # do not finalize MPI automatically

from mpi4py import MPI # import the 'MPI' module

MPI.Init()      # manual initialization of the MPI environment
...             # your finest code here ...
MPI.Finalize()  # manual finalization of the MPI environment

Environment variables

The following environment variables override the corresponding attributes of the mpi4py.rc and MPI.pickle objects at import time of the ~mpi4py.MPI module.

Note

For variables of boolean type, accepted values are 0 and 1 (interpreted as False and True, respectively), and strings specifying a YAML boolean value (case-insensitive).

MPI4PY_RC_INITIALIZE

type

bool

default

True

Whether to automatically initialize MPI at import time of the mpi4py.MPI module.

mpi4py.rc.initialize

3.1.0

MPI4PY_RC_FINALIZE

type

None | bool

default

None

choices

None, True, False

Whether to automatically finalize MPI at exit time of the Python process.

mpi4py.rc.finalize

3.1.0

MPI4PY_RC_THREADS

type

bool

default

True

Whether to initialize MPI with thread support.

mpi4py.rc.threads

3.1.0

MPI4PY_RC_THREAD_LEVEL

default

"multiple"

choices

"single", "funneled", "serialized", "multiple"

The level of required thread support.

mpi4py.rc.thread_level

3.1.0

MPI4PY_RC_FAST_REDUCE

type

bool

default

True

Whether to use tree-based reductions for objects.

mpi4py.rc.fast_reduce

3.1.0

MPI4PY_RC_RECV_MPROBE

type

bool

default

True

Whether to use matched probes to receive objects.

mpi4py.rc.recv_mprobe

MPI4PY_RC_ERRORS

default

"exception"

choices

"exception", "default", "fatal"

Controls default MPI error handling policy.

mpi4py.rc.errors

3.1.0

MPI4PY_PICKLE_PROTOCOL

type

int

default

pickle.HIGHEST_PROTOCOL

Controls the default pickle protocol to use when communicating Python objects.

~mpi4py.MPI.Pickle.PROTOCOL attribute of the MPI.pickle object within the ~mpi4py.MPI module.

3.1.0

MPI4PY_PICKLE_THRESHOLD

type

int

default

262144

Controls the default buffer size threshold for switching from in-band to out-of-band buffer handling when using pickle protocol version 5 or higher.

Module mpi4py.util.pkl5.

3.1.2

Miscellaneous functions

mpi4py.profile

mpi4py.get_config

mpi4py.get_include