From 679aa3c4bdb526dbd4af3f4259086203c21d5d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Malte=20T=C3=B6pperwien?= Date: Thu, 9 Jul 2026 15:36:30 +0200 Subject: [PATCH] chore(dacbo): point towards setting parallelization of operations to 1 when running dacbo environments in parallel --- dacbench/envs/dacboenv/dacboenv.py | 21 +++++++++++++++++++++ docs/source/benchmark_docs/dacbo.rst | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/dacbench/envs/dacboenv/dacboenv.py b/dacbench/envs/dacboenv/dacboenv.py index b75bb5956..d4b99fe6a 100644 --- a/dacbench/envs/dacboenv/dacboenv.py +++ b/dacbench/envs/dacboenv/dacboenv.py @@ -92,6 +92,27 @@ class DACBOEnv(gym.Env): Computes the current observation and reward from the optimizer. get_reward() Computes the current reward from the optimizer. + + Note: + ---- + The DACBO environment uses numpy, scipy, and SMAC's Gaussian Process (via + sklearn) under the hood, all of which can leverage multi-threaded BLAS + (OpenBLAS / MKL). By default, these libraries use all available CPU cores, + which causes oversubscription when multiple environments run in parallel + within the same process (e.g. via ``AsyncVectorEnv`` or ``multiprocessing``). + + Set these environment variables **before importing numpy** to cap each + process at single-threaded BLAS: + + .. code-block:: python + + import os + os.environ["OMP_NUM_THREADS"] = "1" + os.environ["OPENBLAS_NUM_THREADS"] = "1" + os.environ["MKL_NUM_THREADS"] = "1" + os.environ["NUMEXPR_NUM_THREADS"] = "1" + + import numpy # noqa: E402 """ def __init__( diff --git a/docs/source/benchmark_docs/dacbo.rst b/docs/source/benchmark_docs/dacbo.rst index cd26d3a19..f6026e44d 100644 --- a/docs/source/benchmark_docs/dacbo.rst +++ b/docs/source/benchmark_docs/dacbo.rst @@ -42,6 +42,27 @@ can be used instead for discrete acquisition function selection among EI, PI, an *The DACBO benchmark was originally developed by Carolin Benjamins as the dacboenv package and has been integrated into DACBench. A publication is forthcoming.* +.. note:: + + The DACBO environment uses numpy, scipy, and SMAC's Gaussian Process (via + sklearn) under the hood, all of which can leverage multi-threaded BLAS + (OpenBLAS / MKL). By default, these libraries use all available CPU cores, + which causes oversubscription when multiple environments run in parallel + within the same process (e.g. via ``AsyncVectorEnv`` or ``multiprocessing``). + + Set these environment variables **before importing numpy** to cap each + process at single-threaded BLAS: + + .. code-block:: python + + import os + os.environ["OMP_NUM_THREADS"] = "1" + os.environ["OPENBLAS_NUM_THREADS"] = "1" + os.environ["MKL_NUM_THREADS"] = "1" + os.environ["NUMEXPR_NUM_THREADS"] = "1" + + import numpy # noqa: E402 + .. automodule:: dacbench.benchmarks.dacbo_benchmark :members: :show-inheritance: