From 81b3b756bc9f350c6d988c633a068789350569ae Mon Sep 17 00:00:00 2001 From: "Lev S. Bishop" <18673315+levbishop@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:00:48 -0500 Subject: [PATCH 1/4] Add script to report numpy env --- tools/report_env.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 tools/report_env.py diff --git a/tools/report_env.py b/tools/report_env.py new file mode 100755 index 000000000000..09f0da180922 --- /dev/null +++ b/tools/report_env.py @@ -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 From 51286651546b635510472c1c9539ac9194646db1 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Wed, 14 Feb 2024 17:11:24 +0000 Subject: [PATCH 2/4] Rename to more descriptive name --- tools/{report_env.py => report_numpy_state.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tools/{report_env.py => report_numpy_state.py} (100%) diff --git a/tools/report_env.py b/tools/report_numpy_state.py similarity index 100% rename from tools/report_env.py rename to tools/report_numpy_state.py From d0f9ab1f4fb9a687c161142588d090e440d96e78 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Wed, 14 Feb 2024 17:16:09 +0000 Subject: [PATCH 3/4] Report Numpy runtime status in CI --- .azure/test-linux.yml | 1 + .azure/test-macos.yml | 1 + .azure/test-windows.yml | 1 + .github/workflows/coverage.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/.azure/test-linux.yml b/.azure/test-linux.yml index 4200b03e887b..a773c15add50 100644 --- a/.azure/test-linux.yml +++ b/.azure/test-linux.yml @@ -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/. diff --git a/.azure/test-macos.yml b/.azure/test-macos.yml index c241f51f57e9..1887a88655d0 100644 --- a/.azure/test-macos.yml +++ b/.azure/test-macos.yml @@ -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 diff --git a/.azure/test-windows.yml b/.azure/test-windows.yml index f546fdb41dc3..eed1ef3eb6f8 100644 --- a/.azure/test-windows.yml +++ b/.azure/test-windows.yml @@ -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 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index de3485c5fdce..ac597b97b8a9 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -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` From 216827d46e8fe648576cfc5f98fdc07899b5dcc2 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Wed, 14 Feb 2024 17:19:56 +0000 Subject: [PATCH 4/4] Add threadpoolctl for BLAS information --- requirements-dev.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index f590c7c60699..f9785c5ee53f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -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.