Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions dacbench/envs/dacboenv/dacboenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
21 changes: 21 additions & 0 deletions docs/source/benchmark_docs/dacbo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading