From 4c3768d9f5e77ffdd28477b04d26d3fba8e11fa7 Mon Sep 17 00:00:00 2001 From: jfrery Date: Mon, 25 Mar 2024 11:11:06 +0100 Subject: [PATCH] chore: default to n_jobs = 1 for the CI --- conftest.py | 6 +++++- src/concrete/ml/pytest/utils.py | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/conftest.py b/conftest.py index 195170a2af..c5b92d2958 100644 --- a/conftest.py +++ b/conftest.py @@ -147,11 +147,14 @@ def default_configuration(): enable_unsafe_features=True, use_insecure_key_cache=True, insecure_key_cache_location="ConcreteNumpyKeyCache", + fhe_simulation=False, # Simulation compilation is done lazilly on circuit.simulate + fhe_execution=True, ) + @pytest.fixture def simulation_configuration(): - """Return the default test compilation configuration for simulation.""" + """Return the simulation test compilation configuration for simulation.""" # Parameter `enable_unsafe_features` and `use_insecure_key_cache` are needed in order to be # able to cache generated keys through `insecure_key_cache_location`. As the name suggests, @@ -165,6 +168,7 @@ def simulation_configuration(): fhe_execution=False, ) + REMOVE_COLOR_CODES_RE = re.compile(r"\x1b[^m]*m") diff --git a/src/concrete/ml/pytest/utils.py b/src/concrete/ml/pytest/utils.py index 53153b9a11..3c2837e7b6 100644 --- a/src/concrete/ml/pytest/utils.py +++ b/src/concrete/ml/pytest/utils.py @@ -388,6 +388,11 @@ def instantiate_model_generic(model_class, n_bits, **parameters): model_name (str): The type of the model as a string. model (object): The model instance. """ + # Force multi threaded models to be single threaded as it's not working + # properly with pytest multi-threading + if "n_jobs" in model_class().get_params(): + parameters["n_jobs"] = 1 + # If the model is a QNN, set the model using appropriate bit-widths if is_model_class_in_a_list(model_class, _get_sklearn_neural_net_models()): extra_kwargs = {}