summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--azure-pipelines.yml35
-rw-r--r--numpy/__init__.py32
2 files changed, 65 insertions, 2 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 6d4944c92..6b1ff4c28 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -67,13 +67,19 @@ stages:
# they will patch this issue
vmImage: macOS-10.14
strategy:
- maxParallel: 2
+ maxParallel: 3
matrix:
Python36:
PYTHON_VERSION: '3.6'
+ USE_OPENBLAS: '1'
Python36-ILP64:
PYTHON_VERSION: '3.6'
NPY_USE_BLAS_ILP64: '1'
+ USE_OPENBLAS: '1'
+ Accelerate:
+ PYTHON_VERSION: '3.6'
+ USE_OPENBLAS: '0'
+
steps:
# the @0 refers to the (major) version of the *task* on Microsoft's
# end, not the order in the build matrix nor anything to do
@@ -106,13 +112,14 @@ stages:
# matches our MacOS wheel builds -- currently based
# primarily on file size / name details
- script: |
- python -mpip install urllib3
+ python -m pip install urllib3
target=$(python tools/openblas_support.py)
ls -lR $target
# manually link to appropriate system paths
cp $target/lib/* /usr/local/lib/
cp $target/include/* /usr/local/include/
displayName: 'install pre-built openblas'
+ condition: eq(variables['USE_OPENBLAS'], '1')
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install tools'
- script: |
@@ -131,16 +138,40 @@ stages:
ATLAS: None
ACCELERATE: None
CC: /usr/bin/clang
+ condition: eq(variables['USE_OPENBLAS'], '1')
+ - script: python setup.py build -j 4 build_ext --inplace install
+ displayName: 'Build NumPy without OpenBLAS'
+ env:
+ BLAS: None
+ LAPACK: None
+ ATLAS: None
+ CC: /usr/bin/clang
+ condition: eq(variables['USE_OPENBLAS'], '0')
# wait until after dev build of NumPy to pip
# install matplotlib to avoid pip install of older numpy
- script: python -m pip install matplotlib
displayName: 'Install matplotlib before refguide run'
- script: python runtests.py -g --refguide-check
displayName: 'Run Refuide Check'
+ condition: eq(variables['USE_OPENBLAS'], '1')
- script: python runtests.py -n --mode=full -- -rsx --junitxml=junit/test-results.xml
displayName: 'Run Full NumPy Test Suite'
+ condition: eq(variables['USE_OPENBLAS'], '1')
- bash: python tools/openblas_support.py --check_version
displayName: 'Verify OpenBLAS version'
+ condition: eq(variables['USE_OPENBLAS'], '1')
+ # import doesn't work when in numpy src directory , so do a pip dev install of build lib to test
+ - script: |
+ #!/bin/bash -v
+ set +e
+ python -c "import numpy as np" > test_output.log 2>&1
+ check_output_code=$?
+ cat test_output.log
+ grep "buggy Accelerate backend" test_output.log
+ check_message=$?
+ if [ $check_output_code == 1 ] && [ $check_message == 0 ]; then exit 0; else exit 1;fi
+ displayName: "Check if numpy import fails with accelerate"
+ condition: eq(variables['USE_OPENBLAS'], '0')
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
diff --git a/numpy/__init__.py b/numpy/__init__.py
index ba35224e6..1d8570f71 100644
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -254,3 +254,35 @@ else:
_sanity_check()
del _sanity_check
+
+ def _mac_os_check():
+ """
+ Quick Sanity check for Mac OS look for accelerate build bugs.
+ Testing numpy polyfit calls init_dgelsd(LAPACK)
+ """
+ try:
+ c = array([3., 2., 1.])
+ x = linspace(0, 2, 5)
+ y = polyval(c, x)
+ _ = polyfit(x, y, 2, cov=True)
+ except ValueError:
+ pass
+
+ import sys
+ if sys.platform == "darwin":
+ with warnings.catch_warnings(record=True) as w:
+ _mac_os_check()
+ # Throw runtime error, if the test failed Check for warning and error_message
+ error_message = ""
+ if len(w) > 0:
+ error_message = "{}: {}".format(w[-1].category.__name__, str(w[-1].message))
+ msg = (
+ "Polyfit sanity test emitted a warning, most likely due "
+ "to using a buggy Accelerate backend. "
+ "If you compiled yourself, "
+ "see site.cfg.example for information. "
+ "Otherwise report this to the vendor "
+ "that provided NumPy.\n{}\n".format(
+ error_message))
+ raise RuntimeError(msg)
+ del _mac_os_check