qrunch.tools.mpi.helpers

Helpers for MPI entry points.

Functions

mpi_main(func)

Decorate an MPI entry point with coordinated error handling and finalization.

mpi_main(func: Callable[[P], R]) → Callable[[P], R]

Decorate an MPI entry point with coordinated error handling and finalization.

MPI is imported only when the decorated function is called. Exceptions are logged before aborting all ranks. MPI is finalized when execution returns or unwinds, but a terminating MPI abort does not run Python cleanup.

Parameters:

func (Callable[[~P], R]) – Entry point to run with MPI error handling.

Return type:

Callable[[~P], R]