Multiprocessing¶
Multiprocessing pool for parallel likelihood evaluation.
- class socca.pool.mp.PoolFunctionTag[source]¶
Bases:
objectPicklable proxy that invokes the pre-loaded likelihood.
Analogous to
FunctionTagfor MPI. Each worker process pre-loads the likelihood via the pool initializer; this lightweight tag simply forwards calls to that pre-loaded function, avoiding re-serialization of the full fitter state at runtime.
- class socca.pool.mp.MultiPool(processes, likelihood)[source]¶
Bases:
objectProcess pool for parallel likelihood evaluation.
Uses loky for robust process management with cloudpickle serialization. Workers do not re-import
__main__, so noif __name__ == "__main__":guard is needed in user scripts.The likelihood is pre-loaded in each worker via the pool initializer for fast repeated evaluation. Other functions (e.g. nautilus neural network training) are serialized with cloudpickle transparently by loky.
- Parameters:
processes (int) – Number of worker processes.
likelihood (callable) – Likelihood function to evaluate in parallel.
- property size¶
Return the number of worker processes.
- property likelihood¶
Return a picklable proxy for the pre-loaded likelihood.