mixle.inference.mpi_executor module

MPI distributed EM transport: comm.reduce (a real tree fold) over the verified combine-tree.

The MPI fabric over the same sharded-E-step + tree-reduce algorithm: each rank scores its shard to a fixed-size (count, sufficient-stat) payload, and comm.reduce(payload, op=combine, root=0) folds them – mpi4py’s lowercase object-mode reduce performs a genuine reduction tree (O(log W)), not a gather-to-root. The combine operates on freshly-deserialized payloads (MPI ships them between ranks), so the in-place combine() is safe. combine is associative + commutative, as MPI reduce requires.

Run under mpirun -n W python your_script.py; each rank slices its contiguous portion of the data.

mpi_em_step(comm, estimator, model, data)[source]

One EM step across MPI ranks: each scores its shard, comm.reduce folds, rank 0 estimates.

Returns the new model on rank 0 and None on the others (use mpi_fit() for the broadcast loop).

Parameters:
Return type:

Any

mpi_fit(comm, model, data, max_its=10)[source]

Run max_its EM iterations across MPI ranks; the new model is broadcast each iteration.

All ranks return the same fitted model.

Parameters:
Return type:

Any