multicoreRuns#
- statrl.experiments.parallelruns.multicoreRuns(env, learner, interact, nbReplicates, timeHorizon, oneRunFunction, root_folder)[source]#
Run one agent for many independent replicates, spread across CPU cores.
Each replicate gets its own deep copy of the environment, agent, and interaction.
- Parameters:
env (object) – Environment to replicate.
learner (object) – Agent to replicate.
interact (statrl.experiments.onerun.Interaction) – Interaction loop of the setting.
nbReplicates (int) – Number of independent runs.
timeHorizon (int) – Number of rounds per run.
oneRunFunction (callable) – Function executing one replicate, called as
oneRunFunction(env, learner, interact, timeHorizon, root_folder). In practiceoneRunWithDump().root_folder (str) – Directory the per-replicate dumps are written to.
- Returns:
scores (list of str) – One dump filename per replicate, in the order the jobs were created.
elapsed (float) – Mean wall-clock seconds per replicate. Since the runs are concurrent this is total elapsed time divided by
nbReplicates, so it measures throughput rather than the cost of a single run.
Notes
Uses all available cores (
n_jobs=-1). Everything passed in must be picklable, which is whyBatchMABaccepts a plain list of batch sizes rather than only a callable.