Skip to content

Commit f01040a

Browse files
levbishopmergify[bot]
authored andcommitted
Add script to report numpy env (#11798)
* Add script to report numpy env * Rename to more descriptive name * Report Numpy runtime status in CI * Add threadpoolctl for BLAS information --------- Co-authored-by: Jake Lishman <jake.lishman@ibm.com> (cherry picked from commit 381a881)
1 parent e72493d commit f01040a

File tree

6 files changed

+31
-0
lines changed

6 files changed

+31
-0
lines changed

.azure/test-linux.yml

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ jobs:
112112
- bash: |
113113
set -e
114114
source test-job/bin/activate
115+
python tools/report_numpy_state.py
115116
mkdir -p /tmp/terra-tests
116117
cp -r test /tmp/terra-tests/.
117118
cp .stestr.conf /tmp/terra-tests/.

.azure/test-macos.yml

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
- bash: |
6262
set -e
6363
source test-job/bin/activate
64+
python tools/report_numpy_state.py
6465
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 4294967295))")
6566
echo "PYTHONHASHSEED=$PYTHONHASHSEED"
6667
stestr run

.azure/test-windows.yml

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
set -e
6363
chcp.com 65001
6464
source test-job/Scripts/activate
65+
python tools/report_numpy_state.py
6566
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 1024))")
6667
echo "PYTHONHASHSEED=$PYTHONHASHSEED"
6768
stestr run

.github/workflows/coverage.yml

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
run: |
5454
set -e
5555
python -m pip install -c constraints.txt -r requirements-dev.txt -r requirements-optional.txt
56+
python tools/report_numpy_state.py
5657
stestr run
5758
# We set the --source-dir to '.' because we want all paths to appear relative to the repo
5859
# root (we need to combine them with the Python ones), but we only care about `grcov`

requirements-dev.txt

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ coverage>=4.4.0
2323
hypothesis>=4.24.3
2424
stestr>=2.0.0,!=4.0.0
2525
ddt>=1.2.0,!=1.4.0,!=1.4.3
26+
# used to get more complete information on Numpy/Scipy and their BLAS usage during
27+
# CI reporting
28+
threadpoolctl
2629

2730

2831
# Documentation tooling.

tools/report_numpy_state.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python3
2+
3+
# This code is part of Qiskit.
4+
#
5+
# (C) Copyright IBM 2017, 2018.
6+
#
7+
# This code is licensed under the Apache License, Version 2.0. You may
8+
# obtain a copy of this license in the LICENSE.txt file in the root directory
9+
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
10+
#
11+
# Any modifications or derivative works of this code must retain this
12+
# copyright notice, and modified files need to carry a notice indicating
13+
# that they have been altered from the originals.
14+
15+
"""Report some details of the python environment, for debugging"""
16+
17+
import numpy as np
18+
19+
np.show_config()
20+
21+
try: # only available starting numpy 1.24.0
22+
np.show_runtime()
23+
except AttributeError:
24+
pass

0 commit comments

Comments
 (0)