summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>2022-06-28 01:34:15 +0200
committerGitHub <noreply@github.com>2022-06-27 16:34:15 -0700
commit7fc68240fe098ed3be682916cf44ab3b3dfdad12 (patch)
treeab71157daa587d86aacfcda70036b60f4f1526ee /lib
parent614a014948b5ff5b96ded1a5bd41bd66f6015d4f (diff)
downloadspack-7fc68240fe098ed3be682916cf44ab3b3dfdad12.tar.gz
spack-7fc68240fe098ed3be682916cf44ab3b3dfdad12.tar.bz2
spack-7fc68240fe098ed3be682916cf44ab3b3dfdad12.tar.xz
spack-7fc68240fe098ed3be682916cf44ab3b3dfdad12.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/oneapi.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/spack/spack/build_systems/oneapi.py b/lib/spack/spack/build_systems/oneapi.py
index 76c69acd5e..c0da2fdb53 100644
--- a/lib/spack/spack/build_systems/oneapi.py
+++ b/lib/spack/spack/build_systems/oneapi.py
@@ -45,17 +45,15 @@ class IntelOneApiPackage(Package):
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):
- """Shared install method for all oneapi packages."""
+ def install(self, spec, prefix):
+ self.install_component(basename(self.url_for_version(spec.version)))
- # 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))
+ def install_component(self, installer_path):
+ """Shared install method for all oneapi packages."""
if platform.system() == 'Linux':
# Intel installer assumes and enforces that all components
@@ -77,7 +75,7 @@ class IntelOneApiPackage(Package):
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 @@ class IntelOneApiPackage(Package):
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 @@ class IntelOneApiPackage(Package):
$ 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)