Skip to content

Commit

Permalink
Add script to report numpy env (#11798)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
levbishop and jakelishman authored Feb 14, 2024
1 parent d603f83 commit 381a881
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions .azure/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ jobs:
- bash: |
set -e
source test-job/bin/activate
python tools/report_numpy_state.py
mkdir -p /tmp/terra-tests
cp -r test /tmp/terra-tests/.
cp .stestr.conf /tmp/terra-tests/.
Expand Down
1 change: 1 addition & 0 deletions .azure/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
- bash: |
set -e
source test-job/bin/activate
python tools/report_numpy_state.py
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 4294967295))")
echo "PYTHONHASHSEED=$PYTHONHASHSEED"
stestr run
Expand Down
1 change: 1 addition & 0 deletions .azure/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
set -e
chcp.com 65001
source test-job/Scripts/activate
python tools/report_numpy_state.py
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 1024))")
echo "PYTHONHASHSEED=$PYTHONHASHSEED"
stestr run
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
run: |
set -e
python -m pip install -c constraints.txt -r requirements-dev.txt -r requirements-optional.txt
python tools/report_numpy_state.py
stestr run
# We set the --source-dir to '.' because we want all paths to appear relative to the repo
# root (we need to combine them with the Python ones), but we only care about `grcov`
Expand Down
3 changes: 3 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ coverage>=4.4.0
hypothesis>=4.24.3
stestr>=2.0.0,!=4.0.0
ddt>=1.2.0,!=1.4.0,!=1.4.3
# used to get more complete information on Numpy/Scipy and their BLAS usage during
# CI reporting
threadpoolctl


# Documentation tooling.
Expand Down
24 changes: 24 additions & 0 deletions tools/report_numpy_state.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python3

# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Report some details of the python environment, for debugging"""

import numpy as np

np.show_config()

try: # only available starting numpy 1.24.0
np.show_runtime()
except AttributeError:
pass

0 comments on commit 381a881

Please sign in to comment.