smrt.runner package
Runners are used to run simulations in parallel or sequentially. They are used by the Model.run method to run the simulations.
smrt.runner.sequential_runner module
This module implements a sequential runner for smrt simulations. It is used by default if parallel_computation=False in py:func:~smrt.core.model.make_model function.
Examples:
# Basic usage:
m = make_model("iba", "dort", parallel_computation=False)
m.run(sensor, snowpack)
# Explicit usage to set runner's parameters:
runner = SequentialRunner(progressbar=True)
res = m.run(sensor, snowpack, runner=runner)
- class SequentialRunner(progressbar, max_numerical_threads=1)
Bases:
objectRun the simulations sequentially on a single (local) core. This is the most simple way to run smrt simulations, but the efficiency is poor.
smrt.runner.joblib_runner module
This module implements a joblib runner tp execute smrt simulations in parallel. It is used by default if parallel_computation=True in py:func:~smrt.core.model.make_model function.
- Example::
# Basic usage: m = make_model(“iba”, “dort”, parallel_computation=True) m.run(sensor, snowpack)
# Advance usage to set runner’s parameters: runner = JoblibParallelRunner(progressbar=True, n_jobs=-1) res = m.run(sensor, snowpack, runner=runner)
- class JoblibParallelRunner(progressbar, backend='loky', n_jobs=None, max_numerical_threads=1)
Bases:
objectRun the simulations on the local machine on all the cores, using the joblib library for parallelism.