unitaryfund / mitiq

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.
https://mitiq.readthedocs.io
GNU General Public License v3.0
363 stars 161 forks source link

`macos-latest` passes with warnings #2357

Open purva-thakre opened 6 months ago

purva-thakre commented 6 months ago

Noticed the following 66 warnings in a macos-latest for python3.10 workflow run.

https://github.com/unitaryfund/mitiq/actions/runs/9006365923/job/24743744344#step:6:4149

image

I don't think this is fixable on our end. Created this issue to look up the source of the error later.

purva-thakre commented 6 months ago

From what I could find, this appears to be an issue with ARM macos devices. numpy relies on BLAS and LAPACK libraries. There's a bug in OpenBLAS LAPACK. https://github.com/numpy/numpy/issues/22025#issuecomment-1445485035

https://github.com/Qiskit/qiskit/issues/10248#issuecomment-1751156662

I don't have access to a mac and I don't really know a lot about the differences between macos devices on ARM and Intel architectures. For this reason, I can't tell if this is something we should keep track of or will get fixed when the linked numpy issue is closed.

Feel free to close this issue.

cosenal commented 6 months ago

I can reproduce it on my M2 Pro.

(mitiqenv) ➜  mitiq git:(main) ✗ py.test -r w mitiq/benchmarks/tests/test_mirror_qv_circuits.py
================================================================================================ test session starts =================================================================================================
platform darwin -- Python 3.11.8, pytest-8.0.0, pluggy-1.4.0
rootdir: /Users/cosenal/Coding/unitaryfund/mitiq
configfile: pyproject.toml
plugins: cov-5.0.0, anyio-4.3.0, xdist-3.0.2, dash-2.16.1
collected 17 items

mitiq/benchmarks/tests/test_mirror_qv_circuits.py .................                                                                                                                                            [100%]

================================================================================================== warnings summary ==================================================================================================
mitiq/benchmarks/tests/test_mirror_qv_circuits.py: 18 warnings
  /opt/miniconda3/envs/mitiqenv/lib/python3.11/site-packages/numpy/linalg/linalg.py:2180: RuntimeWarning: divide by zero encountered in det
    r = _umath_linalg.det(a, signature=signature)

mitiq/benchmarks/tests/test_mirror_qv_circuits.py: 18 warnings
  /opt/miniconda3/envs/mitiqenv/lib/python3.11/site-packages/numpy/linalg/linalg.py:2180: RuntimeWarning: invalid value encountered in det
    r = _umath_linalg.det(a, signature=signature)

Environment info

(mitiqenv) ➜  mitiq git:(main) ✗ pip list | grep numpy
numpy                           1.26.4
(mitiqenv) ➜  mitiq git:(main) ✗ python -c "import numpy, threadpoolctl, pprint; \
pprint.pprint(threadpoolctl.threadpool_info())"

[{'architecture': 'armv8',
  'filepath': '/opt/miniconda3/envs/mitiqenv/lib/python3.11/site-packages/numpy/.dylibs/libopenblas64_.0.dylib',
  'internal_api': 'openblas',
  'num_threads': 12,
  'prefix': 'libopenblas',
  'threading_layer': 'pthreads',
  'user_api': 'blas',
  'version': '0.3.23.dev'}]

I propose we keep this open as a reminder to update the dependency whenever the upstream numpy/openblas issue is resolved.

purva-thakre commented 3 months ago

Noticed the number of warnings is inconsistent across different macos jobs.

For python 3.10, the number has now reduced to 64 warnings. The issue description contains 66 warnings for python 3.10.

https://github.com/unitaryfund/mitiq/actions/runs/10029442356/job/27717625580?pr=2447#step:6:4263

For python 3.11, the number of warnings is 58.

https://github.com/unitaryfund/mitiq/actions/runs/10029442356/job/27717625655?pr=2447#step:6:4263

For python3.12, the number of warnings is 60. https://github.com/unitaryfund/mitiq/actions/runs/10029442356/job/27717625727?pr=2447#step:6:4263