Parallel computations¶
OGGM is designed to use the available resources as well as possible. For single nodes machines but with more than one processor (frequent case for personal computers) OGGM ships with a multiprocessing approach which is fairly simple to use. For cluster environments, use MPI.
Multiprocessing¶
Most OGGM computations are embarrassingly parallel: they are standalone operations to be realized on one single glacier entity and therefore independent from each other (they are called entity tasks, as opposed to the non-parallelizable global tasks).
When given a list of Glacier directories on which to apply a given task,
the workflow.execute_entity_task()
will distribute the operations on
the available processors using Python’s multiprocessing module.
You can control this behavior with the use_multiprocessing
config
parameter and the number of processors with mp_processes
.
The default in OGGM is:
In [1]: from oggm import cfg
In [2]: cfg.initialize()
In [3]: cfg.PARAMS['use_multiprocessing'] # whether to use multiprocessing
Out[3]: True
In [4]: cfg.PARAMS['mp_processes'] # number of processors to use