From 13e464716fbe4b14ca8d80b95f1a1af2832b350a Mon Sep 17 00:00:00 2001 From: Philipp Emanuel Weidmann Date: Thu, 25 Jun 2026 18:22:18 +0530 Subject: [PATCH] experiment: try to standardize test environment --- src/heretic/main.py | 4 ++++ tests/run_tests.py | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/heretic/main.py b/src/heretic/main.py index 7e981e1..3f6a800 100644 --- a/src/heretic/main.py +++ b/src/heretic/main.py @@ -268,6 +268,10 @@ def run(): print(get_accelerator_info()) + torch.backends.mkldnn.enabled = False # ty:ignore[invalid-assignment] + torch.set_num_threads(1) + torch.set_num_interop_threads(1) + if settings.print_debug_information: print() print(torch.__config__.show().strip()) diff --git a/tests/run_tests.py b/tests/run_tests.py index c4d7dd9..76caabb 100644 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -2,6 +2,7 @@ # Copyright (C) 2025-2026 Philipp Emanuel Weidmann + contributors import hashlib +import os import subprocess import sys from pathlib import Path @@ -23,6 +24,12 @@ script_directory = Path(__file__).resolve().parent project_directory = script_directory.parent +environment = os.environ | { + "OMP_NUM_THREADS": "1", + "MKL_NUM_THREADS": "1", + "OPENBLAS_NUM_THREADS": "1", +} + for test_directory in script_directory.iterdir(): if test_directory.is_dir(): config_file = test_directory / "config.toml" @@ -44,6 +51,7 @@ for test_directory in script_directory.iterdir(): test_directory, "heretic", ], + env=environment, check=True, )