From 24d9f3703e7980b6911c3af316a478365bab3358 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Mon, 3 Jan 2022 08:25:39 -0700 Subject: [PATCH 1/2] CI: Disable numpy CPU features at runtime --- .github/workflows/tests.yml | 1 + azure-pipelines.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b24eb59d3d2c..fa0719041c38 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,6 +9,7 @@ on: env: NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test. + NPY_DISABLE_CPU_FEATURES: "AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX" OPENBLAS_NUM_THREADS: 1 PYTHONFAULTHANDLER: 1 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 13e6d709c42f..9df1b4575ae8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -129,6 +129,7 @@ stages: displayName: 'print env' - bash: | + export NPY_DISABLE_CPU_FEATURES="AVX512F,AVX512CD,AVX512VL,AVX512BW,AVX512DQ,AVX512_SKX" PYTHONFAULTHANDLER=1 python -m pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 || [[ "$PYTHON_VERSION" = 'Pre' ]] displayName: 'pytest' From d6f68757c234d33f341adc9e3bd65053094cf748 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Mon, 3 Jan 2022 10:04:40 -0700 Subject: [PATCH 2/2] TST: Remove numpy cpu disabling from some subprocess tests This removes the NPY_DISABLE_CPU_FEATURES flag from the sphinx and tk tests as they emit warnings on CI which leads to failure from the subprocess. These don't need to be disabled on these tests, so remove them from the environment variables that are passed in. --- lib/matplotlib/tests/test_backend_tk.py | 3 ++- lib/matplotlib/tests/test_sphinxext.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_backend_tk.py b/lib/matplotlib/tests/test_backend_tk.py index 3e3251d64a17..bad6d18355f6 100644 --- a/lib/matplotlib/tests/test_backend_tk.py +++ b/lib/matplotlib/tests/test_backend_tk.py @@ -36,7 +36,8 @@ def test_func(): try: proc = subprocess.run( [sys.executable, "-c", f"{source}\n{func.__name__}()"], - env={**os.environ, "MPLBACKEND": "TkAgg"}, + env={**os.environ, "MPLBACKEND": "TkAgg", + "NPY_DISABLE_CPU_FEATURES": ""}, timeout=_test_timeout, stdout=subprocess.PIPE, stderr=subprocess.PIPE, diff --git a/lib/matplotlib/tests/test_sphinxext.py b/lib/matplotlib/tests/test_sphinxext.py index f71c6e32018a..7b0ef15619b3 100644 --- a/lib/matplotlib/tests/test_sphinxext.py +++ b/lib/matplotlib/tests/test_sphinxext.py @@ -28,7 +28,8 @@ def test_tinypages(tmpdir): # coverage anyways); hide them using GCOV_ERROR_FILE. proc = Popen( cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True, - env={**os.environ, "MPLBACKEND": "", "GCOV_ERROR_FILE": os.devnull}) + env={**os.environ, "MPLBACKEND": "", "GCOV_ERROR_FILE": os.devnull, + "NPY_DISABLE_CPU_FEATURES": ""}) out, err = proc.communicate() # Build the pages with warnings turned into errors @@ -128,7 +129,8 @@ def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None): cmd = [sys.executable, '-msphinx', '-W', '-b', 'html', '-d', str(doctree_dir), str(source_dir), str(html_dir), *extra_args] proc = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True, - env={**os.environ, "MPLBACKEND": ""}) + env={**os.environ, "MPLBACKEND": "", + "NPY_DISABLE_CPU_FEATURES": ""}) out, err = proc.communicate() assert proc.returncode == 0, \