MPI

MPI pool for parallel likelihood evaluation.

class socca.pool.mpi.FunctionTag[source]

Bases: object

Picklable function wrapper for MPI transport.

Each MPI rank sets the class-level _func to its own local function before entering the worker loop. When pickled, __reduce__ reconstructs a new instance on the receiving rank that calls that rank’s own _func, avoiding serialization of the full fitter state.

class socca.pool.mpi.MPIPool(comm=None)[source]

Bases: object

MPI pool where all ranks evaluate tasks.

is_master()[source]

Return True if this is the master rank.

map(func, iterable)[source]

Scatter tasks, evaluate on all ranks, gather results.

wait()[source]

Block non-root ranks, processing batches until closed.

close()[source]

Signal workers to exit.

socca.pool.mpi.root_only(func)[source]

Only execute on rank 0. Returns None on other ranks.