From 583515c842336ebbdd31d38cc1a1d3a4989e2339 Mon Sep 17 00:00:00 2001 From: Huanchen Zhai Date: Tue, 9 Jan 2024 16:56:14 -0800 Subject: [PATCH] fix mkl for amd cpu --- .github/workflows/build.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e5b987b..06aced4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,6 +53,18 @@ jobs: sudo apt-get install libopenmpi-dev python -m pip install mpi4py + - name: fix mkl for amd cpu + if: matrix.os == 'ubuntu-latest' + run: | + lscpu + export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}') + echo $CPUTYPE + if [ "$CPUTYPE" = "AuthenticAMD" ]; then + echo "int mkl_serv_intel_cpu_true() { return 1; }" > fixcpu.c + $CC -shared -fPIC -o libfixcpu.so fixcpu.c + fi + getconf LONG_BIT + - name: build test env: MKLROOT: ~/.local @@ -64,7 +76,20 @@ jobs: cd .. echo "PYTHONPATH=./build:${PYTHONPATH}" >> $GITHUB_ENV - - name: run test (serial) + - name: run test (serial, linux) + if: matrix.os == 'ubuntu-latest' + env: + MKLROOT: ~/.local + run: | + export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}') + if [ "$CPUTYPE" = "AuthenticAMD" ]; then + export LD_PRELOAD=$PWD/libfixcpu.so + fi + py.test pyblock3/algebra + py.test pyblock3/algorithms --ignore=pyblock3/algorithms/tests/test_soc.py + + - name: run test (serial, macos) + if: matrix.os == 'macos-12' env: MKLROOT: ~/.local run: |