From 212f277e6f552dbd6adb6f46c43d7d204f445bc8 Mon Sep 17 00:00:00 2001 From: Yannick Roehlly Date: Tue, 13 Aug 2019 23:32:19 +0200 Subject: [PATCH] Set some environment variables to disable threading. --- pcigale/__init__.py | 9 +++++++++ pcigale_plots/__init__.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/pcigale/__init__.py b/pcigale/__init__.py index 525fc053..161005ea 100644 --- a/pcigale/__init__.py +++ b/pcigale/__init__.py @@ -3,6 +3,15 @@ # Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt # Author: Yannick Roehlly +import os +# Set environment variables to disable multithreading as users will probably +# want to set the number of cores to the max of their computer. +os.environ["OMP_NUM_THREADS"] = "1" +os.environ["OPENBLAS_NUM_THREADS"] = "1" +os.environ["MKL_NUM_THREADS"] = "1" +os.environ["VECLIB_MAXIMUM_THREADS"] = "1" +os.environ["NUMEXPR_NUM_THREADS"] = "1" + import argparse import multiprocessing as mp import sys diff --git a/pcigale_plots/__init__.py b/pcigale_plots/__init__.py index d17eff7d..822d918b 100644 --- a/pcigale_plots/__init__.py +++ b/pcigale_plots/__init__.py @@ -6,6 +6,15 @@ # Licensed under the CeCILL-v2 licence - see Licence_CeCILL_V2-en.txt # Author: Yannick Roehlly, Médéric Boquien & Denis Burgarella +import os +# Set environment variables to disable multithreading as users will probably +# want to set the number of cores to the max of their computer. +os.environ["OMP_NUM_THREADS"] = "1" +os.environ["OPENBLAS_NUM_THREADS"] = "1" +os.environ["MKL_NUM_THREADS"] = "1" +os.environ["VECLIB_MAXIMUM_THREADS"] = "1" +os.environ["NUMEXPR_NUM_THREADS"] = "1" + import argparse import sys from os import path -- GitLab