From 85c6eb650f8299cdc84cd1ccde7955c2b9a1b8a9 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Thu, 6 Jan 2022 09:30:34 -0700 Subject: [PATCH 1/3] Revert "CI: Disable numpy CPU features at runtime" This reverts commit 24d9f3703e7980b6911c3af316a478365bab3358. --- .github/workflows/tests.yml | 1 - azure-pipelines.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fa0719041c38..b24eb59d3d2c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,6 @@ 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 9df1b4575ae8..13e6d709c42f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -129,7 +129,6 @@ 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 357901a9e222f0797565ab128ea335f43f6f66a5 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Thu, 6 Jan 2022 09:30:51 -0700 Subject: [PATCH 2/3] Revert "TST: Remove numpy cpu disabling from some subprocess tests" This reverts commit d6f68757c234d33f341adc9e3bd65053094cf748. --- lib/matplotlib/tests/test_backend_tk.py | 3 +-- lib/matplotlib/tests/test_sphinxext.py | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/tests/test_backend_tk.py b/lib/matplotlib/tests/test_backend_tk.py index bad6d18355f6..3e3251d64a17 100644 --- a/lib/matplotlib/tests/test_backend_tk.py +++ b/lib/matplotlib/tests/test_backend_tk.py @@ -36,8 +36,7 @@ def test_func(): try: proc = subprocess.run( [sys.executable, "-c", f"{source}\n{func.__name__}()"], - env={**os.environ, "MPLBACKEND": "TkAgg", - "NPY_DISABLE_CPU_FEATURES": ""}, + env={**os.environ, "MPLBACKEND": "TkAgg"}, 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 7b0ef15619b3..f71c6e32018a 100644 --- a/lib/matplotlib/tests/test_sphinxext.py +++ b/lib/matplotlib/tests/test_sphinxext.py @@ -28,8 +28,7 @@ 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, - "NPY_DISABLE_CPU_FEATURES": ""}) + env={**os.environ, "MPLBACKEND": "", "GCOV_ERROR_FILE": os.devnull}) out, err = proc.communicate() # Build the pages with warnings turned into errors @@ -129,8 +128,7 @@ 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": "", - "NPY_DISABLE_CPU_FEATURES": ""}) + env={**os.environ, "MPLBACKEND": ""}) out, err = proc.communicate() assert proc.returncode == 0, \ From 34386724bd46ff50091f18b147052032c083e9a6 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Wed, 5 Jan 2022 21:04:48 -0700 Subject: [PATCH 3/3] TST: Increase some floating point datatypes and tolerances This is for floating point errors that crept in with AVX512 instruction sets on some CI architectures. --- lib/matplotlib/tests/test_axes.py | 4 +++- lib/matplotlib/tests/test_streamplot.py | 2 +- .../tests/test_axisartist_grid_helper_curvelinear.py | 2 +- lib/mpl_toolkits/tests/test_mplot3d.py | 5 ++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index cec795fa0e29..f05e3d63619c 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -3327,7 +3327,9 @@ def test_tick_space_size_0(): @image_comparison(['errorbar_basic', 'errorbar_mixed', 'errorbar_basic']) def test_errorbar(): - x = np.arange(0.1, 4, 0.5) + # longdouble due to floating point rounding issues with certain + # computer chipsets + x = np.arange(0.1, 4, 0.5, dtype=np.longdouble) y = np.exp(-x) yerr = 0.1 + 0.2*np.sqrt(x) diff --git a/lib/matplotlib/tests/test_streamplot.py b/lib/matplotlib/tests/test_streamplot.py index f177533b357e..d7bc2864e22d 100644 --- a/lib/matplotlib/tests/test_streamplot.py +++ b/lib/matplotlib/tests/test_streamplot.py @@ -78,7 +78,7 @@ def test_maxlength(): @image_comparison(['streamplot_direction.png'], - remove_text=True, style='mpl20', tol=0.056) + remove_text=True, style='mpl20', tol=0.073) def test_direction(): x, y, U, V = swirl_velocity_field() plt.streamplot(x, y, U, V, integration_direction='backward', diff --git a/lib/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py b/lib/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py index 1b3ef4405394..9a501daa2e7b 100644 --- a/lib/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py +++ b/lib/mpl_toolkits/tests/test_axisartist_grid_helper_curvelinear.py @@ -140,7 +140,7 @@ def test_polar_box(): ax1.grid(True) -@image_comparison(['axis_direction.png'], style='default', tol=0.07) +@image_comparison(['axis_direction.png'], style='default', tol=0.071) def test_axis_direction(): # Remove this line when this test image is regenerated. plt.rcParams['text.kerning_factor'] = 6 diff --git a/lib/mpl_toolkits/tests/test_mplot3d.py b/lib/mpl_toolkits/tests/test_mplot3d.py index cc8125b91d68..273c9882921f 100644 --- a/lib/mpl_toolkits/tests/test_mplot3d.py +++ b/lib/mpl_toolkits/tests/test_mplot3d.py @@ -1,6 +1,5 @@ import functools import itertools -import platform import pytest @@ -547,7 +546,7 @@ def test_text3d_modification(fig_ref, fig_test): ax_ref.text(x, y, z, f'({x}, {y}, {z}), dir={zdir}', zdir=zdir) -@mpl3d_image_comparison(['trisurf3d.png'], tol=0.03) +@mpl3d_image_comparison(['trisurf3d.png'], tol=0.061) def test_trisurf3d(): n_angles = 36 n_radii = 8 @@ -1369,7 +1368,7 @@ def test_errorbar3d(): @image_comparison(['stem3d.png'], style='mpl20', - tol=0.0 if platform.machine() == 'x86_64' else 0.003) + tol=0.003) def test_stem3d(): fig, axs = plt.subplots(2, 3, figsize=(8, 6), constrained_layout=True,