Skip to content

Commit

Permalink
Merge pull request #3533 from lexming/cleanup-old-intelbase
Browse files Browse the repository at this point in the history
Remove code supporting obsolete versions from `IntelBase` family of easyblocks + remove unused custom easyblock for IPP
  • Loading branch information
branfosj authored Jan 2, 2025
2 parents 29b260d + 0dffa40 commit 4e7c190
Show file tree
Hide file tree
Showing 13 changed files with 328 additions and 798 deletions.
15 changes: 10 additions & 5 deletions easybuild/easyblocks/a/advisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,32 @@
from easybuild.tools import LooseVersion

from easybuild.easyblocks.generic.intelbase import IntelBase
from easybuild.tools.build_log import EasyBuildError


class EB_Advisor(IntelBase):
"""
Support for installing Intel Advisor XE
- minimum version suported: 2020.x
"""

def __init__(self, *args, **kwargs):
"""Constructor, initialize class variables."""
super(EB_Advisor, self).__init__(*args, **kwargs)
if LooseVersion(self.version) < LooseVersion('2017'):
self.subdir = 'advisor_xe'
elif LooseVersion(self.version) < LooseVersion('2021'):

if LooseVersion(self.version) < LooseVersion('2020'):
raise EasyBuildError(
f"Version {self.version} of {self.name} is unsupported. Mininum supported version is 2020.0."
)

if LooseVersion(self.version) < LooseVersion('2021'):
self.subdir = 'advisor'
else:
self.subdir = os.path.join('advisor', 'latest')

def prepare_step(self, *args, **kwargs):
"""Since 2019u3 there is no license required."""
if LooseVersion(self.version) >= LooseVersion('2019_update3'):
kwargs['requires_runtime_license'] = False
kwargs['requires_runtime_license'] = False
super(EB_Advisor, self).prepare_step(*args, **kwargs)

def make_module_req_guess(self):
Expand Down
46 changes: 7 additions & 39 deletions easybuild/easyblocks/generic/intelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from easybuild.framework.easyconfig.types import ensure_iterable_license_specs
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import adjust_permissions, find_flexlm_license
from easybuild.tools.filetools import mkdir, read_file, remove_file, write_file
from easybuild.tools.filetools import read_file, remove_file, write_file
from easybuild.tools.run import run_shell_cmd


Expand All @@ -68,20 +68,14 @@

# silent.cfg parameter name for type of license activation (cfr. options listed above)
ACTIVATION_NAME = 'ACTIVATION_TYPE' # since icc/ifort v2013_sp1, impi v4.1.1, imkl v11.1
ACTIVATION_NAME_2012 = 'ACTIVATION' # previous activation type parameter used in older versions
# silent.cfg parameter name for install prefix
INSTALL_DIR_NAME = 'PSET_INSTALL_DIR'
# silent.cfg parameter name for install mode
INSTALL_MODE_NAME = 'PSET_MODE'
# Older (2015 and previous) silent.cfg parameter name for install mode
INSTALL_MODE_NAME_2015 = 'INSTALL_MODE'
# Install mode for 2016 version
# Install mode since 2016 version
INSTALL_MODE = 'install'
# Install mode for 2015 and older versions
INSTALL_MODE_2015 = 'NONRPM'
# silent.cfg parameter name for license file/server specification
LICENSE_FILE_NAME = 'ACTIVATION_LICENSE_FILE' # since icc/ifort v2013_sp1, impi v4.1.1, imkl v11.1
LICENSE_FILE_NAME_2012 = 'PSET_LICENSE_FILE' # previous license file parameter used in older versions
LICENSE_SERIAL_NUMBER = 'ACTIVATION_SERIAL_NUMBER'

COMP_ALL = 'ALL'
Expand Down Expand Up @@ -136,12 +130,7 @@ def get_guesses_tools(self):
"""Find reasonable paths for a subset of Intel tools, ignoring CPATH, LD_LIBRARY_PATH and LIBRARY_PATH"""

guesses = super(IntelBase, self).make_module_req_guess()

if self.cfg['m32']:
guesses['PATH'] = [os.path.join(self.subdir, 'bin32')]
else:
guesses['PATH'] = [os.path.join(self.subdir, 'bin64')]

guesses['PATH'] = [os.path.join(self.subdir, 'bin64')]
guesses['MANPATH'] = [os.path.join(self.subdir, 'man')]

# make sure $CPATH, $LD_LIBRARY_PATH and $LIBRARY_PATH are not updated in generated module file,
Expand All @@ -155,13 +144,8 @@ def get_guesses_tools(self):

def get_custom_paths_tools(self, binaries):
"""Custom sanity check paths for certain Intel tools."""
if self.cfg['m32']:
files = [os.path.join('bin32', b) for b in binaries]
dirs = ['lib32', 'include']
else:
files = [os.path.join('bin64', b) for b in binaries]
dirs = ['lib64', 'include']

files = [os.path.join('bin64', b) for b in binaries]
dirs = ['lib64', 'include']
custom_paths = {
'files': [os.path.join(self.subdir, f) for f in files],
'dirs': [os.path.join(self.subdir, d) for d in dirs],
Expand All @@ -176,12 +160,6 @@ def extra_options(extra_vars=None):
'serial_number': [None, "Serial number for the product", CUSTOM],
'requires_runtime_license': [True, "Boolean indicating whether or not a runtime license is required",
CUSTOM],
# 'usetmppath':
# workaround for older SL5 version (5.5 and earlier)
# used to be True, but False since SL5.6/SL6
# disables TMP_PATH env and command line option
'usetmppath': [False, "Use temporary path for installation", CUSTOM],
'm32': [False, "Enable 32-bit toolchain", CUSTOM],
'components': [None, "List of components to install", CUSTOM],
})

Expand Down Expand Up @@ -374,8 +352,8 @@ def install_step_classic(self, silent_cfg_names_map=None, silent_cfg_extras=None
]) % {
'install_dir_name': silent_cfg_names_map.get('install_dir_name', INSTALL_DIR_NAME),
'install_dir': silent_cfg_names_map.get('install_dir', self.installdir),
'install_mode': silent_cfg_names_map.get('install_mode', INSTALL_MODE_2015),
'install_mode_name': silent_cfg_names_map.get('install_mode_name', INSTALL_MODE_NAME_2015),
'install_mode': silent_cfg_names_map.get('install_mode', INSTALL_MODE),
'install_mode_name': silent_cfg_names_map.get('install_mode_name', INSTALL_MODE_NAME),
}

if self.install_components is not None:
Expand Down Expand Up @@ -404,15 +382,6 @@ def install_step_classic(self, silent_cfg_names_map=None, silent_cfg_extras=None
write_file(silentcfg, silent)
self.log.debug("Contents of %s:\n%s", silentcfg, silent)

# workaround for mktmp: create tmp dir and use it
tmpdir = os.path.join(self.cfg['start_dir'], 'mytmpdir')
mkdir(tmpdir, parents=True)

tmppathopt = ''
if self.cfg['usetmppath']:
env.setvar('TMP_PATH', tmpdir)
tmppathopt = "-t %s" % tmpdir

# set some extra env variables
env.setvar('LOCAL_INSTALL_VERBOSE', '1')
env.setvar('VERBOSE_MODE', '1')
Expand All @@ -423,7 +392,6 @@ def install_step_classic(self, silent_cfg_names_map=None, silent_cfg_extras=None
cmd = ' '.join([
self.cfg['preinstallopts'],
'./install.sh',
tmppathopt,
'-s ' + silentcfg,
self.cfg['installopts'],
])
Expand Down
155 changes: 56 additions & 99 deletions easybuild/easyblocks/i/icc.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
import re
from easybuild.tools import LooseVersion

from easybuild.easyblocks.generic.intelbase import IntelBase, ACTIVATION_NAME_2012, COMP_ALL
from easybuild.easyblocks.generic.intelbase import LICENSE_FILE_NAME_2012
from easybuild.easyblocks.generic.intelbase import IntelBase, COMP_ALL
from easybuild.easyblocks.tbb import get_tbb_gccprefix
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.run import run_shell_cmd
from easybuild.tools.systemtools import get_shared_lib_ext

Expand All @@ -57,10 +57,9 @@ def get_icc_version():


class EB_icc(IntelBase):
"""Support for installing icc
- tested with 11.1.046
- will fail for all older versions (due to newer silent installer)
"""
Support for installing icc
- minimum version suported: 2020.0
"""

def __init__(self, *args, **kwargs):
Expand All @@ -75,60 +74,38 @@ def __init__(self, *args, **kwargs):
# required because of support in SystemCompiler generic easyblock to specify 'system' as version,
# which results in deriving the actual compiler version
# comparing a non-version like 'system' with an actual version like '2016' fails with TypeError in Python 3.x
if re.match(r'^[0-9]+.*', self.version) and LooseVersion(self.version) >= LooseVersion('2016'):
if re.match(r'^[0-9]+.*', self.version):

self.comp_libs_subdir = os.path.join('compilers_and_libraries_%s' % self.version, 'linux')
if LooseVersion(self.version) < LooseVersion('2020'):
raise EasyBuildError(
f"Version {self.version} of {self.name} is unsupported. Mininum supported version is 2020.0."
)

self.comp_libs_subdir = os.path.join(f'compilers_and_libraries_{self.version}', 'linux')

if self.cfg['components'] is None:
# we need to use 'ALL' by default,
# using 'DEFAULTS' results in key things not being installed (e.g. bin/icc)
self.cfg['components'] = [COMP_ALL]
self.log.debug("Nothing specified for components, but required for version 2016, using %s instead",
self.cfg['components'])

def install_step(self):
"""
Actual installation
- create silent cfg file
- execute command
"""
silent_cfg_names_map = None

if LooseVersion(self.version) < LooseVersion('2013_sp1'):
# since icc v2013_sp1, silent.cfg has been slightly changed to be 'more standard'

silent_cfg_names_map = {
'activation_name': ACTIVATION_NAME_2012,
'license_file_name': LICENSE_FILE_NAME_2012,
}

super(EB_icc, self).install_step(silent_cfg_names_map=silent_cfg_names_map)
self.log.debug(
f"Missing components specification, required for version {self.version}. "
f"Using {self.cfg['components']} instead."
)

def sanity_check_step(self):
"""Custom sanity check paths for icc."""

binprefix = 'bin/intel64'
libprefix = 'lib/intel64'
if LooseVersion(self.version) >= LooseVersion('2011'):
if LooseVersion(self.version) <= LooseVersion('2011.3.174'):
binprefix = 'bin'
elif LooseVersion(self.version) >= LooseVersion('2013_sp1'):
binprefix = 'bin'
else:
libprefix = 'compiler/lib/intel64'

binprefix = 'bin'
binfiles = ['icc', 'icpc']
if LooseVersion(self.version) < LooseVersion('2014'):
binfiles += ['idb']

binaries = [os.path.join(binprefix, f) for f in binfiles]
libraries = [os.path.join(libprefix, 'lib%s' % lib) for lib in ['iomp5.a', 'iomp5.%s' % get_shared_lib_ext()]]
sanity_check_files = binaries + libraries
if LooseVersion(self.version) > LooseVersion('2015'):
sanity_check_files.append('include/omp.h')

libprefix = 'lib/intel64'
libraries = [os.path.join(libprefix, f'lib{lib}') for lib in ['iomp5.a', f'iomp5.{get_shared_lib_ext()}']]

headers = ['include/omp.h']

custom_paths = {
'files': sanity_check_files,
'files': binaries + libraries + headers,
'dirs': [],
}

Expand Down Expand Up @@ -165,59 +142,39 @@ def make_module_req_guess(self):
'TBBROOT': ['tbb'],
})

if self.cfg['m32']:
# 32-bit toolchain
guesses['PATH'].extend(['bin/ia32', 'tbb/bin/ia32'])
# in the end we set 'LIBRARY_PATH' equal to 'LD_LIBRARY_PATH'
guesses['LD_LIBRARY_PATH'].append('lib/ia32')

else:
# 64-bit toolkit
guesses['PATH'].extend([
'bin/intel64',
'debugger/gdb/intel64/bin',
'ipp/bin/intel64',
'mpi/intel64/bin',
'tbb/bin/emt64',
'tbb/bin/intel64',
])

# in the end we set 'LIBRARY_PATH' equal to 'LD_LIBRARY_PATH'
guesses['LD_LIBRARY_PATH'].extend([
'compiler/lib/intel64',
'debugger/ipt/intel64/lib',
'ipp/lib/intel64',
'mkl/lib/intel64',
'mpi/intel64',
'tbb/lib/intel64/%s' % get_tbb_gccprefix(os.path.join(self.installdir, 'tbb/lib/intel64')),
])

if LooseVersion(self.version) < LooseVersion('2016'):
prefix = 'composer_xe_%s' % self.version
# for some older versions, name of subdirectory is slightly different
if not os.path.isdir(os.path.join(self.installdir, prefix)):
cand_prefix = 'composerxe-%s' % self.version
if os.path.isdir(os.path.join(self.installdir, cand_prefix)):
prefix = cand_prefix

# debugger is dependent on $INTEL_PYTHONHOME since version 2015 and newer
if LooseVersion(self.version) >= LooseVersion('2015'):
self.debuggerpath = os.path.join(prefix, 'debugger')

else:
# new directory layout for Intel Parallel Studio XE 2016
# https://software.intel.com/en-us/articles/new-directory-layout-for-intel-parallel-studio-xe-2016
prefix = self.comp_libs_subdir
# Debugger requires INTEL_PYTHONHOME, which only allows for a single value
self.debuggerpath = 'debugger_%s' % self.version.split('.')[0]

guesses['LD_LIBRARY_PATH'].extend([
os.path.join(self.debuggerpath, 'libipt/intel64/lib'),
'daal/lib/intel64_lin',
])

# 'lib/intel64' is deliberately listed last, so it gets precedence over subdirs
guesses['LD_LIBRARY_PATH'].append('lib/intel64')
# 64-bit toolkit
guesses['PATH'].extend([
'bin/intel64',
'debugger/gdb/intel64/bin',
'ipp/bin/intel64',
'mpi/intel64/bin',
'tbb/bin/emt64',
'tbb/bin/intel64',
])

# in the end we set 'LIBRARY_PATH' equal to 'LD_LIBRARY_PATH'
guesses['LD_LIBRARY_PATH'].extend([
'compiler/lib/intel64',
'debugger/ipt/intel64/lib',
'ipp/lib/intel64',
'mkl/lib/intel64',
'mpi/intel64',
'tbb/lib/intel64/%s' % get_tbb_gccprefix(os.path.join(self.installdir, 'tbb/lib/intel64')),
])

# new directory layout since Intel Parallel Studio XE 2016
# https://software.intel.com/en-us/articles/new-directory-layout-for-intel-parallel-studio-xe-2016
prefix = self.comp_libs_subdir
# Debugger requires INTEL_PYTHONHOME, which only allows for a single value
self.debuggerpath = 'debugger_%s' % self.version.split('.')[0]

guesses['LD_LIBRARY_PATH'].extend([
os.path.join(self.debuggerpath, 'libipt/intel64/lib'),
'daal/lib/intel64_lin',
])

# 'lib/intel64' is deliberately listed last, so it gets precedence over subdirs
guesses['LD_LIBRARY_PATH'].append('lib/intel64')

guesses['LIBRARY_PATH'] = guesses['LD_LIBRARY_PATH']

Expand Down
Loading

0 comments on commit 4e7c190

Please sign in to comment.