irradiapy.utils.mpi module
Utilities for MPI-related functionalities.
- class irradiapy.utils.mpi.MPIExceptionHandlerMixin[source]
Bases:
objectProvides a common MPI exception handler method when mpi_safe_method cannot be used.
This is useful for __init__ and __post_init__ methods where decorators cannot be applied because self.comm and self.rank are not yet defined before the function is called. You can use this method after the comm and rank attributes are initialized in a try/except block.
- class irradiapy.utils.mpi.MPITagAllocator[source]
Bases:
objectA class to allocate unique tags for processes.
- irradiapy.utils.mpi.ap_rm_file(original, target, comm)[source]
Append content from original to target and delete original.
- Return type:
- irradiapy.utils.mpi.cp_file(original, target, comm)[source]
Copy a file from original to target, overwriting target if it exists.
- Return type:
- irradiapy.utils.mpi.mpi_safe_method(method)[source]
Decorator that wraps an MPI-using method so any exception prints a traceback with the current rank and then calls MPI.Abort.
The method should be a member of a class that has comm and rank attributes.
- irradiapy.utils.mpi.mpi_subdomains_decomposition(n)[source]
Factor n into three integers nx, ny, nz for MPI decomposition into subdomains.
nx, ny and nz are such that: - nx * ny * nz == n - the maximum of (nx, ny, nz) divided by the minimum is as small as possible.