From 8046e22e057b4d0d54d35483e74d9a51aa686774 Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Sun, 6 Dec 2020 14:22:07 +0100 Subject: [PATCH] add MKL lib dir to LD_LIBRARY_PATH in GH actions Since Nutils doesn't search for MKL installation directories any longer, we need to tell GitHub actions where to find MKL manually. This patch adds a search script to the devtools and updates `LD_LIBRARY_PATH` before running the unittests. --- .github/workflows/test.yaml | 6 ++++++ devtools/gha/get_lib_dir.py | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 devtools/gha/get_lib_dir.py diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1ebbf6b04..8a7e97bb5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -97,7 +97,13 @@ jobs: # Install Nutils from `dist` dir created in job # `build-python-package`. python -um pip install --no-index --find-links ./dist nutils + - name: Get library directory + id: get-lib-dir + if: ${{ matrix.matrix-backend == 'mkl' }} + run: python -um devtools.gha.get_lib_dir - name: Test + env: + LD_LIBRARY_PATH: ${{ steps.get-lib-dir.outputs.libdir }} run: | mkdir testenv cp -r examples docs tests .coveragerc testenv diff --git a/devtools/gha/get_lib_dir.py b/devtools/gha/get_lib_dir.py new file mode 100644 index 000000000..9e411ab92 --- /dev/null +++ b/devtools/gha/get_lib_dir.py @@ -0,0 +1,16 @@ +from .. import log +import sys, site, os + +libname = 'libmkl_rt.so' +libsubdir = 'lib' +prefixes = list(site.PREFIXES) +if hasattr(site, 'getuserbase'): + prefixes.append(site.getuserbase()) +for prefix in prefixes: + libdir = os.path.join(prefix, libsubdir) + if not os.path.exists(os.path.join(libdir, libname)): + continue + log.set_output('libdir', libdir) + break +else: + log.error('cannot find {} in any of the following dirs: {}'.format(libname, ' '.join(prefixes)))