Skip to content

Commit

Permalink
Merge pull request #2810 from boegel/20221020103517_new_pr_numexpr
Browse files Browse the repository at this point in the history
make numexpr easyblock aware of toolchain with GCC + imkl
  • Loading branch information
ocaisa authored Oct 20, 2022
2 parents 5f4bcd3 + 9f24820 commit b9804c4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions easybuild/easyblocks/n/numexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
import os
from distutils.version import LooseVersion

import easybuild.tools.toolchain as toolchain
from easybuild.easyblocks.generic.pythonpackage import PythonPackage
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import write_file
from easybuild.tools.modules import get_software_root, get_software_version
from easybuild.tools.systemtools import get_cpu_features
Expand Down Expand Up @@ -78,12 +80,20 @@ def configure_step(self):

mkl_ver = get_software_version('imkl')

comp_fam = self.toolchain.comp_family()
self.log.info("Using toolchain with compiler family %s", comp_fam)

if LooseVersion(mkl_ver) >= LooseVersion('2021'):
mkl_lib_dirs = [
os.path.join(self.imkl_root, 'mkl', 'latest', 'lib', 'intel64'),
]
mkl_include_dirs = os.path.join(self.imkl_root, 'mkl', 'latest', 'include')
mkl_libs = ['mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'iomp5']
if comp_fam == toolchain.INTELCOMP:
mkl_libs = ['mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'iomp5']
elif comp_fam == toolchain.GCC:
mkl_libs = ['mkl_intel_lp64', 'mkl_gnu_thread', 'mkl_core', 'gomp']
else:
raise EasyBuildError("Unknown compiler family, don't know how to link MKL libraries: %s", comp_fam)
else:
mkl_lib_dirs = [
os.path.join(self.imkl_root, 'mkl', 'lib', 'intel64'),
Expand All @@ -103,7 +113,9 @@ def configure_step(self):
else:
site_cfg_lines.append("mkl_libs = %s" % ', '.join(mkl_libs))

write_file('site.cfg', '\n'.join(site_cfg_lines))
site_cfg_txt = '\n'.join(site_cfg_lines)
write_file('site.cfg', site_cfg_txt)
self.log.info("site.cfg used for numexpr:\n" + site_cfg_txt)

def sanity_check_step(self):
"""Custom sanity check for numexpr."""
Expand Down

0 comments on commit b9804c4

Please sign in to comment.