Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 NumPy/MKL issues on CPU with tests/test_linalg.py::test_eig_arange #1005

Closed
densmirn opened this issue Oct 14, 2021 · 2 comments
Closed

2 NumPy/MKL issues on CPU with tests/test_linalg.py::test_eig_arange #1005

densmirn opened this issue Oct 14, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@densmirn
Copy link
Contributor

Test tests/test_linalg.py::test_eig_arange raises 2 issues on CPU.

  1. Call of const std::int64_t scratchpad_size = mkl_lapack::syevd_scratchpad_size<double>(DPNP_QUEUE, oneapi::mkl::job::vec, oneapi::mkl::uplo::upper, size, lda); in the function dpnp_eigvals_c returns wrong value that causes out of memory issue.
  2. Call of the function oneapi::mkl::lapack::syevd in dpnp_eigvals_c causes segfault.
event = mkl_lapack::syevd(DPNP_QUEUE,               // queue
                          oneapi::mkl::job::vec,    // jobz
                          oneapi::mkl::uplo::upper, // uplo
                          size,                     // The order of the matrix A (0 <= n)
                          result_vec_kern,
                          lda,
                          result_val_kern,
                          scratchpad,
                          scratchpad_size);
event.wait();

Example of the command to reproduce the issues:
SYCL_DEVICE_FILTER=cpu pytest tests/test_linalg.py::test_eig_arange[2-float64]

High-level reason of the issues is numpy is imported before dpnp in third party tests. E.g. change #1004 gets around the issue.
Low-level reason of the issues could be related to MKL runtime library loaded during numpy import that needs to be investigated.

DPNP was built from source on commit 61ae592 with below environment:

attrs                     21.2.0             pyhd3eb1b0_0    intel
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
bzip2                     1.0.8                hb9a14ef_8    intel
ca-certificates           2020.12.5                     0    intel
certifi                   2020.12.5        py38he139614_0    intel
cmake                     3.19.6               h973ab73_0
cython                    0.29.23          py38hb3b8d61_0    intel
decorator                 5.0.9              pyhd3eb1b0_0    intel
dpcpp-cpp-rt              2021.4.0             intel_3561    intel
dpcpp_cpp_rt              2021.4.0             intel_3561    intel
dpcpp_impl_linux-64       2021.4.0             intel_3561    intel
dpcpp_linux-64            2021.4.0             intel_3561    intel
dpctl                     0.11.0dev0      py38h2bc3f7f_34    dppy/label/dev
dpl-include               2021.4.0                intel_0    intel
expat                     2.4.1                h9c3ff4c_0    conda-forge
icc_rt                    2021.4.0             intel_3561    intel
iniconfig                 1.1.1              pyh9f0ad1d_0    conda-forge
intel-cmplr-lib-rt        2021.4.0             intel_3561    intel
intel-cmplr-lic-rt        2021.4.0             intel_3561    intel
intel-opencl-rt           2021.4.0             intel_3561    intel
intel-openmp              2021.4.0             intel_3561    intel
intelpython               2021.4.0                      0    intel
ipython                   7.27.0           py38hb070fc8_0
jedi                      0.18.0           py38h578d9bd_2    conda-forge
libcurl                   7.78.0               h471713a_2    intel
libffi                    3.3                          13    intel
libgcc-ng                 9.3.0              hdf63c60_101    intel
libssh2                   1.9.0                h4b1ad09_1    intel
libstdcxx-ng              9.3.0              hdf63c60_101    intel
libuv                     1.40.0               h7b6447c_0    intel
lz4-c                     1.9.3                h688b341_1    intel
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
mkl                       2021.4.0              intel_640    intel
mkl-devel                 2021.4.0              intel_640    intel
mkl-devel-dpcpp           2021.4.0              intel_640    intel
mkl-dpcpp                 2021.4.0              intel_640    intel
mkl-include               2021.4.0              intel_640    intel
mkl-service               2.4.0            py38h76adbe5_0    intel
mkl_fft                   1.3.0            py38h6d51d7b_1    intel
mkl_random                1.2.2            py38hd4cd407_1    intel
mkl_umath                 0.1.1            py38hff32f8b_9    intel
more-itertools            8.10.0             pyhd8ed1ab_0    conda-forge
ncurses                   6.2                  hf61fa16_1    intel
numpy                     1.20.3           py38h699e47d_1    intel
numpy-base                1.20.3           py38hf45626f_1    intel
openssl                   1.1.1k               h14c3975_3    intel
packaging                 21.0               pyhd8ed1ab_0    conda-forge
parso                     0.8.2              pyhd8ed1ab_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       21.1.1           py38ha59826b_0    intel
pluggy                    1.0.0            py38h578d9bd_1    conda-forge
prompt-toolkit            3.0.20             pyha770c72_0    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
py                        1.10.0             pyhd3deb0d_0    conda-forge
pygments                  2.10.0             pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7            py38h0618fa2_2    intel
pytest                    6.2.5            py38h578d9bd_0    conda-forge
python                    3.8.11               ha27d850_1    intel
python_abi                3.8                      2_cp38    conda-forge
rhash                     1.4.1                h7f98852_0    conda-forge
setuptools                52.0.0           py38h0d5a7d4_0    intel
six                       1.16.0           py38h7c2029b_0    intel
sqlite                    3.36.0               hb9a14ef_2    intel
tbb                       2021.4.0              intel_643    intel
tbb-devel                 2021.4.0              intel_643    intel
tbb4py                    2021.4.0         py38_intel_643    intel
tcl                       8.6.10                        1    intel
tk                        8.6.10               h8e2d9d6_3    intel
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
traitlets                 5.1.0              pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
wheel                     0.36.2           py38ha11c92b_0    intel
xz                        5.2.5                h74280d8_2    intel
zlib                      1.2.11.1             h1e99aa7_4    intel
zstd                      1.4.5                h3f200d0_0    intel
@densmirn densmirn added the bug Something isn't working label Oct 14, 2021
@densmirn densmirn changed the title [numpy/mkl] tests/test_linalg.py::test_eig_arange raises 2 issues on CPU 2 NumPy/MKL issues on CPU with tests/test_linalg.py::test_eig_arange Oct 14, 2021
@densmirn
Copy link
Contributor Author

#1004

@vlad-perevezentsev
Copy link
Collaborator

vlad-perevezentsev commented Mar 25, 2024

I tested this old bug with the new MKL package available on the public channel and did not find any problems described in this issue.
Probably MKL fixed syevd_scratchpad_size function in past releases.
Also #1383 and #1714 change the logic of the eigh function call and dpnp_eigvals_c is no longer used.
So I will close this issue.

$ ONEAPI_DEVICE_SELECTOR=opencl:cpu pytest -v tests/test_linalg.py::test_eig_arange[2-float64]
tests/test_linalg.py::test_eig_arange[2-float64] PASSED                                                       [100%]
ONEAPI_DEVICE_SELECTOR=opencl:cpu pytest -v tests/test_linalg.py::test_eigh_arange[2-float32]
tests/test_linalg.py::test_eigh_arange[2-float32] PASSED                                                      [100%]

conda list

_libgcc_mutex             0.1                 conda_forge    intel
_openmp_mutex             4.5                       2_gnu    intel
_sysroot_linux-64_curr_repodata_hack 3                   h69a702a_14    conda-forge
asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
bzip2                     1.0.8                hb9a14ef_9    intel
c-ares                    1.21.0               hd590300_0    intel
ca-certificates           2023.7.22            hbcca054_0    intel
cmake                     3.29.0               hcfe8598_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    intel
cython                    3.0.2           py310h3fd9d12_0    intel
decorator                 5.0.9              pyhd3eb1b0_0    intel
distro                    1.9.0              pyhd8ed1ab_0    conda-forge
dpcpp-cpp-rt              2024.0.3            intel_49895    intel
dpcpp_cpp_rt              2024.0.3            intel_49895    intel
dpcpp_impl_linux-64       2024.0.3            intel_49895    intel
dpcpp_linux-64            2024.0.3            intel_49895    intel
dpctl                     0.17.0dev0      py310h15de555_149    dppy/label/dev
dpnp                      0.15.0.dev0+67.g238f0e4fec           dev_0    <develop>
exceptiongroup            1.2.0              pyhd8ed1ab_2    conda-forge
executing                 2.0.1              pyhd8ed1ab_0    conda-forge
icc_rt                    2024.0.3            intel_49895    intel
iniconfig                 2.0.0              pyhd8ed1ab_0    conda-forge
intel-cmplr-lib-rt        2024.0.3            intel_49895    intel
intel-cmplr-lic-rt        2024.0.3            intel_49895    intel
intel-opencl-rt           2024.0.3            intel_49895    intel
intel-openmp              2024.0.3            intel_49895    intel
intelpython               2024.0.0                      0    intel
ipython                   8.22.2             pyh707e725_0    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
kernel-headers_linux-64   4.18.0               he073ed8_2    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.21.2               h659d440_0    conda-forge
level-zero                1.15.1               h00ab1b0_0    intel
libcurl                   8.6.0                hca28451_0    conda-forge
libedit                   3.1.20210910         h7f8727e_0    intel
libev                     4.33                 h7f8727e_1    intel
libexpat                  2.6.2                h59595ed_0    conda-forge
libffi                    3.4.2                h7f98852_5    intel
libgcc-ng                 13.2.0               h807b86a_2    intel
libgomp                   13.2.0               h807b86a_2    intel
libnghttp2                1.58.0               h47da74e_0    conda-forge
libnsl                    2.0.1                hd590300_0    intel
libsqlite                 3.44.0               h2797004_0    intel
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_2    intel
libuuid                   2.38.1               h0b41bf4_0    intel
libuv                     1.48.0               hd590300_0    conda-forge
libzlib                   1.2.13               hd590300_5    intel
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mkl                       2024.0.0            intel_49656    intel
mkl-devel                 2024.0.0            intel_49656    intel
mkl-devel-dpcpp           2024.0.0            intel_49656    intel
mkl-dpcpp                 2024.0.0            intel_49656    intel
mkl-include               2024.0.0            intel_49656    intel
mkl-service               2.4.0           py310h3539a15_41    intel
mkl_fft                   1.3.6           py310h1d81ff8_61    intel
mkl_random                1.2.2           py310h5a378b4_81    intel
mkl_umath                 0.1.1           py310h2b1685c_91    intel
ncurses                   6.4.20240210         h59595ed_0    conda-forge
ninja                     1.11.1               h924138e_0    conda-forge
numpy                     1.24.3          py310ha320b8e_5    intel
numpy-base                1.24.3          py310hbac2b65_5    intel
onedpl-devel              2022.3.0            intel_49369    intel
onemkl-sycl-blas          2024.0.0            intel_49656    intel
onemkl-sycl-datafitting   2024.0.0            intel_49656    intel
onemkl-sycl-dft           2024.0.0            intel_49656    intel
onemkl-sycl-lapack        2024.0.0            intel_49656    intel
onemkl-sycl-rng           2024.0.0            intel_49656    intel
onemkl-sycl-sparse        2024.0.0            intel_49656    intel
onemkl-sycl-stats         2024.0.0            intel_49656    intel
onemkl-sycl-vm            2024.0.0            intel_49656    intel
openssl                   3.2.1                hd590300_1    conda-forge
packaging                 23.2               pyhd8ed1ab_0    intel
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pexpect                   4.9.0              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       23.3.1             pyhd8ed1ab_0    intel
pluggy                    1.4.0              pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.42             pyha770c72_0    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pygments                  2.17.2             pyhd8ed1ab_0    conda-forge
pytest                    8.1.1              pyhd8ed1ab_0    conda-forge
python                    3.10.13              h4499717_0    intel
readline                  8.2                  h8228510_1    intel
rhash                     1.4.4                hd590300_0    conda-forge
scikit-build              0.17.6             pyh4af843d_0    conda-forge
setuptools                68.2.2             pyhd8ed1ab_0    intel
six                       1.16.0             pyhd3eb1b0_1    intel
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
sysroot_linux-64          2.28                 he073ed8_2    conda-forge
tbb                       2021.11.0           intel_49513    intel
tbb-devel                 2021.11.0           intel_49513    intel
tbb4py                    2021.11.0       py310_intel_49513    intel
tk                        8.6.13          noxft_h4845f30_101    intel
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
traitlets                 5.14.2             pyhd8ed1ab_0    conda-forge
typing-extensions         4.8.0                hd8ed1ab_0    intel
typing_extensions         4.8.0              pyha770c72_0    intel
tzdata                    2023c                h71feb2d_0    intel
wcwidth                   0.2.13             pyhd8ed1ab_0    conda-forge
wheel                     0.41.3             pyhd8ed1ab_0    intel
xz                        5.2.8                h5eee18b_0    intel
zstd                      1.5.5                hfc55251_0    intel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants