oneapi-* packages: improve use with modules (#30981)
This commit adds some changes which improve use of Spack-installed oneAPI packages with Spack-generated modules, but not within Spack (e.g. if you install some of these packages with Spack, then load their associated modules to build other packages outside of Spack). The majority of the PR diff is refactoring. The functional changes are: * intel-oneapi-mkl: * setup_run_environment: update Intel compiler flags to RPATH the mkl libs * intel-oneapi-compilers: update the compiler configuration to RPATH libraries installed by this package (note that Spack already handled this when installing dependent packages with Spack, but this is specifically to use the intel-oneapi-compilers package outside of Spack). Specifically: * inject_rpaths: this modifies the binaries installed as part of the intel-oneapi-compilers package to RPATH libraries provided by this package * extend_config_flags: this instructs the compiler executables provided by this package to RPATH those same libraries Refactoring includes: * intel-oneapi-compilers: in addition to the functional changes, a large portion of this diff is reorganizing the creation of resources/archives downloaded for the install * The base oneAPI package renamed component_path, so several packages changed as a result: * intel-oneapi-dpl * intel-oneapi-dnn * extrae * intel-oneapi-mpi: * Perform file filtering in one pass rather than two
This commit is contained in:
@@ -45,18 +45,16 @@ def component_dir(self):
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def component_path(self):
|
||||
def component_prefix(self):
|
||||
"""Path to component <prefix>/<component>/<version>."""
|
||||
return join_path(self.prefix, self.component_dir, str(self.spec.version))
|
||||
return self.prefix.join(join_path(self.component_dir, self.spec.version))
|
||||
|
||||
def install(self, spec, prefix, installer_path=None):
|
||||
def install(self, spec, prefix):
|
||||
self.install_component(basename(self.url_for_version(spec.version)))
|
||||
|
||||
def install_component(self, installer_path):
|
||||
"""Shared install method for all oneapi packages."""
|
||||
|
||||
# intel-oneapi-compilers overrides the installer_path when
|
||||
# installing fortran, which comes from a spack resource
|
||||
if installer_path is None:
|
||||
installer_path = basename(self.url_for_version(spec.version))
|
||||
|
||||
if platform.system() == 'Linux':
|
||||
# Intel installer assumes and enforces that all components
|
||||
# are installed into a single prefix. Spack wants to
|
||||
@@ -77,7 +75,7 @@ def install(self, spec, prefix, installer_path=None):
|
||||
bash = Executable('bash')
|
||||
|
||||
# Installer writes files in ~/intel set HOME so it goes to prefix
|
||||
bash.add_default_env('HOME', prefix)
|
||||
bash.add_default_env('HOME', self.prefix)
|
||||
# Installer checks $XDG_RUNTIME_DIR/.bootstrapper_lock_file as well
|
||||
bash.add_default_env('XDG_RUNTIME_DIR',
|
||||
join_path(self.stage.path, 'runtime'))
|
||||
@@ -85,13 +83,13 @@ def install(self, spec, prefix, installer_path=None):
|
||||
bash(installer_path,
|
||||
'-s', '-a', '-s', '--action', 'install',
|
||||
'--eula', 'accept',
|
||||
'--install-dir', prefix)
|
||||
'--install-dir', self.prefix)
|
||||
|
||||
if getpass.getuser() == 'root':
|
||||
shutil.rmtree('/var/intel/installercache', ignore_errors=True)
|
||||
|
||||
# Some installers have a bug and do not return an error code when failing
|
||||
if not isdir(join_path(prefix, self.component_dir)):
|
||||
if not isdir(join_path(self.prefix, self.component_dir)):
|
||||
raise RuntimeError('install failed')
|
||||
|
||||
def setup_run_environment(self, env):
|
||||
@@ -104,7 +102,7 @@ def setup_run_environment(self, env):
|
||||
$ source {prefix}/{component}/{version}/env/vars.sh
|
||||
"""
|
||||
env.extend(EnvironmentModifications.from_sourcing_file(
|
||||
join_path(self.component_path, 'env', 'vars.sh')))
|
||||
join_path(self.component_prefix, 'env', 'vars.sh')))
|
||||
|
||||
|
||||
class IntelOneApiLibraryPackage(IntelOneApiPackage):
|
||||
@@ -118,12 +116,12 @@ class IntelOneApiLibraryPackage(IntelOneApiPackage):
|
||||
|
||||
@property
|
||||
def headers(self):
|
||||
include_path = join_path(self.component_path, 'include')
|
||||
include_path = join_path(self.component_prefix, 'include')
|
||||
return find_headers('*', include_path, recursive=True)
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
lib_path = join_path(self.component_path, 'lib', 'intel64')
|
||||
lib_path = join_path(self.component_prefix, 'lib', 'intel64')
|
||||
lib_path = lib_path if isdir(lib_path) else dirname(lib_path)
|
||||
return find_libraries('*', root=lib_path, shared=True, recursive=True)
|
||||
|
||||
|
Reference in New Issue
Block a user