nessai.utils.multiprocessing
Utilities related to multiprocessing.
Module Contents
Functions
|
Prepare the model for use with a multiprocessing pool. |
Wrapper for the log-likelihood for use with multiprocessing. |
|
|
Determine the number of processes in a multiprocessing pool. |
Attributes
- nessai.utils.multiprocessing.logger
- nessai.utils.multiprocessing.initialise_pool_variables(model)
Prepare the model for use with a multiprocessing pool.
Makes a global copy of the model. Should be called before initialising a pool or passed to the
initializer
argument with the model as one of theinitargs
.- Parameters
- model
nessai.model.Model
Model to be copied to a global variable.
- model
- nessai.utils.multiprocessing.log_likelihood_wrapper(x)
Wrapper for the log-likelihood for use with multiprocessing.
Should be used alongside
nessai.utils.multiprocessing.initialise_pool_variables()
- Parameters
- x
numpy.ndarray
Array of samples.
- x
- Returns
numpy.ndarray
Array of log-likelihoods.
- nessai.utils.multiprocessing.get_n_pool(pool)
Determine the number of processes in a multiprocessing pool.
- Parameters
- poolobject
Multiprocessing pool or similar.