Skip to content

Commit

Permalink
Merge pull request easybuilders#3037 from bartoldeman/intel-compilers…
Browse files Browse the repository at this point in the history
…-2024

update custom intel-compilers easyblock for versions >= 2024
  • Loading branch information
boegel authored Nov 23, 2023
2 parents ad1e7bc + 222053f commit f191d62
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
16 changes: 16 additions & 0 deletions easybuild/easyblocks/generic/intelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ def __init__(self, *args, **kwargs):
self.home_subdir_local = os.path.join(common_tmp_dir, os.environ.get('USER', 'nouser'), 'easybuild_intel')

self.install_components = None
# dictionary to keep track of "latest" directory symlinks
# the target may only have major.minor, and tbb may have a lower version number than the compiler
# for example compiler 2021.1.2 has tbb 2021.1.1, 2024.0.0 has directory name 2024.0
self._latest_subdir = {}

def get_versioned_subdir(self, subdir):
"""Return versioned directory that the 'latest' symlink points to in subdir"""
if subdir not in self._latest_subdir:
if os.path.islink(os.path.join(self.installdir, subdir, 'latest')):
version = os.readlink(os.path.join(self.installdir, subdir, 'latest'))
else:
version = 'latest'
latest_subdir = os.path.join(subdir, version)
self._latest_subdir[subdir] = latest_subdir
self.log.debug('Determined versioned directory for %s: %s', subdir, version)
return self._latest_subdir[subdir]

def get_guesses_tools(self):
"""Find reasonable paths for a subset of Intel tools, ignoring CPATH, LD_LIBRARY_PATH and LIBRARY_PATH"""
Expand Down
36 changes: 22 additions & 14 deletions easybuild/easyblocks/i/intel_compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ def __init__(self, *args, **kwargs):
if LooseVersion(self.version) < LooseVersion('2021'):
raise EasyBuildError("Invalid version %s, should be >= 2021.x" % self.version)

self.compilers_subdir = os.path.join('compiler', self.version, 'linux')
# note that tbb may have a lower version number than the compiler, so use 'latest' symlink
# for example compiler 2021.1.2 has tbb 2021.1.1.
self.tbb_subdir = os.path.join('tbb', 'latest')
@property
def compilers_subdir(self):
compilers_subdir = self.get_versioned_subdir('compiler')
if LooseVersion(self.version) < LooseVersion('2024'):
compilers_subdir = os.path.join(compilers_subdir, 'linux')
return compilers_subdir

@property
def tbb_subdir(self):
return self.get_versioned_subdir('tbb')

def prepare_step(self, *args, **kwargs):
"""
Expand Down Expand Up @@ -92,16 +98,21 @@ def sanity_check_step(self):
Custom sanity check for Intel compilers.
"""

classic_compiler_cmds = ['icc', 'icpc', 'ifort']
oneapi_compiler_cmds = [
'dpcpp', # Intel oneAPI Data Parallel C++ compiler
'icx', # oneAPI Intel C compiler
'icpx', # oneAPI Intel C++ compiler
'ifx', # oneAPI Intel Fortran compiler
]
bindir = os.path.join(self.compilers_subdir, 'bin')
classic_compiler_paths = [os.path.join(bindir, x) for x in oneapi_compiler_cmds]
oneapi_compiler_paths = [os.path.join(bindir, 'intel64', x) for x in classic_compiler_cmds]
oneapi_compiler_paths = [os.path.join(bindir, x) for x in oneapi_compiler_cmds]
if LooseVersion(self.version) >= LooseVersion('2024'):
classic_compiler_cmds = ['ifort']
classic_bindir = bindir
else:
classic_compiler_cmds = ['icc', 'icpc', 'ifort']
classic_bindir = os.path.join(bindir, 'intel64')
classic_compiler_paths = [os.path.join(classic_bindir, x) for x in classic_compiler_cmds]

custom_paths = {
'files': classic_compiler_paths + oneapi_compiler_paths,
Expand Down Expand Up @@ -131,12 +142,7 @@ def make_module_req_guess(self):
os.path.join('compiler', 'lib', 'intel64_lin'),
]
libdirs = [os.path.join(self.compilers_subdir, x) for x in libdirs]
# resolve 'latest' symlink for tbb (if module guess is run with install in place)
if os.path.islink(os.path.join(self.installdir, self.tbb_subdir)):
tbb_version = os.readlink(os.path.join(self.installdir, self.tbb_subdir))
else:
tbb_version = 'latest'
tbb_subdir = os.path.join('tbb', tbb_version)
tbb_subdir = self.tbb_subdir
tbb_libsubdir = os.path.join(tbb_subdir, 'lib', 'intel64')
libdirs.append(os.path.join(tbb_libsubdir,
get_tbb_gccprefix(os.path.join(self.installdir, tbb_libsubdir))))
Expand All @@ -148,10 +154,12 @@ def make_module_req_guess(self):
'LD_LIBRARY_PATH': libdirs,
'LIBRARY_PATH': libdirs,
'MANPATH': [
os.path.join('compiler', self.version, 'documentation', 'en', 'man', 'common'),
os.path.join(os.path.dirname(self.compilers_subdir), 'documentation', 'en', 'man', 'common'),
os.path.join(self.compilers_subdir, 'share', 'man'),
],
'OCL_ICD_FILENAMES': [
os.path.join(self.compilers_subdir, 'lib', 'x64', 'libintelocl.so'),
os.path.join(self.compilers_subdir, 'lib', 'libintelocl.so'),
],
'CPATH': [
os.path.join(tbb_subdir, 'include'),
Expand Down

0 comments on commit f191d62

Please sign in to comment.