diff --git a/.github/workflows/cpp_testing.yml b/.github/workflows/cpp_testing.yml index b9624abd6..5e5c28f7b 100644 --- a/.github/workflows/cpp_testing.yml +++ b/.github/workflows/cpp_testing.yml @@ -10,8 +10,6 @@ jobs: gtest: runs-on: ubuntu-latest - env: - MKL_VERSION: 2023.1.0 steps: - name: Checkout repostiory @@ -24,22 +22,16 @@ jobs: - name: Configure run: | - pip install mkl==${MKL_VERSION} mkl-include==${MKL_VERSION} mkl-devel==${MKL_VERSION} + export MKL_VERSION=`python -c 'from tools.mkl_ver import compatible_mkl_ver;print(compatible_mkl_ver())'` + pip install mkl-include==${MKL_VERSION} mkl-static==${MKL_VERSION} export _BLAS_INCLUDE_DIR=`python -c 'import os;import sysconfig;data=sysconfig.get_path("data");print(f"{data}{os.sep}include")'` - export LIBS_DIR=`python -c 'import os;import sysconfig;data=sysconfig.get_path("data");print(f"{data}{os.sep}lib")'` export MKL_DIR=`python -c 'import os;import sysconfig;data=sysconfig.get_path("data");print(f"{data}{os.sep}lib{os.sep}cmake{os.sep}mkl")'` - cd $LIBS_DIR - for library in `ls *.so.2`; do - ln -s ${library} ${library::-2} || true - done - cd - - mkdir build cd build - Torch_DIR=`python -c 'import torch;print(torch.utils.cmake_prefix_path)'` cmake .. -GNinja -DBUILD_TEST=ON -DWITH_COV=ON -DCMAKE_BUILD_TYPE=DEBUG -DUSE_MKL_BLAS=OFF -DBLAS_INCLUDE_DIR=$_BLAS_INCLUDE_DIR -DMKL_DIR=${MKL_DIR} + Torch_DIR=`python -c 'import torch;print(torch.utils.cmake_prefix_path)'` cmake .. -GNinja -DBUILD_TEST=ON -DWITH_COV=ON -DCMAKE_BUILD_TYPE=DEBUG -DUSE_MKL_BLAS=ON -DBLAS_INCLUDE_DIR=$_BLAS_INCLUDE_DIR -DMKL_DIR=${MKL_DIR} unset _BLAS_INCLUDE_DIR cd .. diff --git a/setup.py b/setup.py index 05d885bac..ade23f6a0 100644 --- a/setup.py +++ b/setup.py @@ -100,8 +100,7 @@ def maybe_append_with_mkl(dependencies): product_version = match.group(0).split(' ')[-1] dependencies.append(f'mkl-include=={product_version}') - dependencies.append(f'mkl=={product_version}') - dependencies.append(f'mkl-devel=={product_version}') + dependencies.append(f'mkl-static=={product_version}') install_requires = [] diff --git a/tools/mkl_ver.py b/tools/mkl_ver.py new file mode 100644 index 000000000..207f908b5 --- /dev/null +++ b/tools/mkl_ver.py @@ -0,0 +1,18 @@ +import re + +import torch + + +def compatible_mkl_ver(): + torch_config = torch.__config__.show() + with_mkl_blas = 'BLAS_INFO=mkl' in torch_config + if torch.backends.mkl.is_available() and with_mkl_blas: + product_version = '2023.1.0' + pattern = r'oneAPI Math Kernel Library Version [0-9]{4}\.[0-9]+' + match = re.search(pattern, torch_config) + if match: + product_version = match.group(0).split(' ')[-1] + + return product_version + + return None