Skip to content

Commit

Permalink
Have cli analysis tests explicitly set multithreading env variables t…
Browse files Browse the repository at this point in the history
…o 1.

This commit adds an auto-used fixture for all analysis tests, that sets the environment variables for multithreading `OMP_NUM_THREADS`, `MKL_NUM_THREADS`, and `NUMEXPR_NUM_THREADS` all to 1. This can cause the issue of those tests hanging, as numpy uses all resources available if those env variables are not explicitly set.
  • Loading branch information
jonathan-eq committed Oct 30, 2024
1 parent 97478fa commit 849c48e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/ert/ui_tests/cli/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

import pytest


@pytest.fixture(autouse=True)
def reduce_omp_num_threads_count():
old_omp_num_threads = os.environ.get("OMP_NUM_THREADS")
os.environ["OMP_NUM_THREADS"] = "1"

yield

if old_omp_num_threads is None:
del os.environ["OMP_NUM_THREADS"]
else:
os.environ["OMP_NUM_THREADS"] = old_omp_num_threads

0 comments on commit 849c48e

Please sign in to comment.