Multiprocessing#
OSEkit can be set up to distribute computations over multiple threads. Such computations are:
- All Core API
BaseDataset
child computations, e.g.: osekit.core_api.spectro_dataset.SpectroDataset.write()
osekit.core_api.spectro_dataset.SpectroDataset.save_spectrogram()
- All Core API
Long-Term Average Spectrum, computed thanks to the
osekit.core_api.ltas_data.LTASData.get_value()
method.
To enable multiprocessing, simply set the osekit.config
module up:
from osekit import config
config.multiprocessing["is_active"] = True
Multiprocessing relies on Python’s multiprocessing process pools. The default number of worker processes that will be used if multiprocessing is active is defaulted to os.process_cpu_count(). This number can be adjusted thanks to the config module:
from osekit import config
config.multiprocessing["is_active"] = True
config.multiprocessing["nb_processes"] = 5 # Will limit the number of worker processes to 5.