From c8b44142303471e8aa1bdcf9a6a30b9eff852322 Mon Sep 17 00:00:00 2001 From: Robert Cohn Date: Wed, 7 Apr 2021 12:31:08 -0400 Subject: [oneapi] fix mkl deps, externally installed, and docs (#22607) --- .../packages/intel-oneapi-compilers/package.py | 32 ++++++++++------------ .../builtin/packages/intel-oneapi-mkl/package.py | 8 ++++-- .../builtin/packages/intel-oneapi-mpi/package.py | 18 +++++------- 3 files changed, 27 insertions(+), 31 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py b/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py index b8d3dedc78..7b12fa92f3 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py @@ -4,8 +4,8 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import glob -import subprocess from os import path +import subprocess from sys import platform from spack import * @@ -36,19 +36,16 @@ class IntelOneapiCompilers(IntelOneApiPackage): def component_dir(self): return 'compiler' - def _join_prefix(self, p): - return path.join(self.prefix, 'compiler', 'latest', 'linux', p) - def _ld_library_path(self): dirs = ['lib', - path.join('lib', 'x64'), - path.join('lib', 'emu'), - path.join('lib', 'oclfpga', 'host', 'linux64', 'lib'), - path.join('lib', 'oclfpga', 'linux64', 'lib'), - path.join('compiler', 'lib', 'intel64_lin'), - path.join('compiler', 'lib')] + join_path('lib', 'x64'), + join_path('lib', 'emu'), + join_path('lib', 'oclfpga', 'host', 'linux64', 'lib'), + join_path('lib', 'oclfpga', 'linux64', 'lib'), + join_path('compiler', 'lib', 'intel64_lin'), + join_path('compiler', 'lib')] for dir in dirs: - yield self._join_prefix(dir) + yield join_path(self.component_path, 'linux', dir) def install(self, spec, prefix): # install cpp @@ -60,22 +57,23 @@ class IntelOneapiCompilers(IntelOneApiPackage): super(IntelOneapiCompilers, self).install( spec, prefix, - installer_path=glob.glob(path.join('fortran-installer', '*'))[0]) + installer_path=glob.glob(join_path('fortran-installer', '*'))[0]) # Some installers have a bug and do not return an error code when failing - if not path.isfile(path.join(prefix, 'compiler', 'latest', 'linux', + if not path.isfile(join_path(self.component_path, 'linux', 'bin', 'intel64', 'ifort')): raise RuntimeError('install failed') # set rpath so 'spack compiler add' can check version strings # without setting LD_LIBRARY_PATH rpath = ':'.join(self._ld_library_path()) - patch_dirs = [path.join('compiler', 'lib', 'intel64_lin'), - path.join('compiler', 'lib', 'intel64'), + patch_dirs = [join_path('compiler', 'lib', 'intel64_lin'), + join_path('compiler', 'lib', 'intel64'), 'bin'] for pd in patch_dirs: - patchables = glob.glob(self._join_prefix(path.join(pd, '*'))) - patchables.append(self._join_prefix(path.join('lib', 'icx-lto.so'))) + patchables = glob.glob(join_path(self.component_path, 'linux', pd, '*')) + patchables.append(join_path(self.component_path, + 'linux', 'lib', 'icx-lto.so')) for file in patchables: # Try to patch all files, patchelf will do nothing if # file should not be patched diff --git a/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py b/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py index fff8432ccb..aee6a50677 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py @@ -36,6 +36,8 @@ class IntelOneapiMkl(IntelOneApiLibraryPackage): @property def libs(self): - lib_path = '{0}/{1}/latest/lib/intel64'.format(self.prefix, self.component_dir) - mkl_libs = ['libmkl_intel_ilp64', 'libmkl_sequential', 'libmkl_core'] - return find_libraries(mkl_libs, root=lib_path, shared=True, recursive=False) + lib_path = join_path(self.component_path, 'lib', 'intel64') + mkl_libs = ['libmkl_intel_lp64', 'libmkl_sequential', 'libmkl_core'] + libs = find_libraries(mkl_libs, root=lib_path, shared=True, recursive=False) + libs += find_system_libraries(['libpthread', 'libm', 'libdl'], shared=True) + return libs diff --git a/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py b/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py index ae6d1fccbf..86eef9054e 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py @@ -4,7 +4,6 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from os import path import subprocess from sys import platform @@ -34,7 +33,7 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage): return 'mpi' def setup_dependent_package(self, module, dep_spec): - dir = join_path(self.prefix, 'mpi', 'latest', 'bin') + dir = join_path(self.component_path, 'bin') self.spec.mpicc = join_path(dir, 'mpicc') self.spec.mpicxx = join_path(dir, 'mpicxx') self.spec.mpif77 = join_path(dir, 'mpif77') @@ -48,7 +47,7 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage): env.set('MPICH_FC', spack_fc) # Set compiler wrappers for dependent build stage - dir = self._join_prefix('bin') + dir = join_path(self.component_path, 'bin') env.set('MPICC', join_path(dir, 'mpicc')) env.set('MPICXX', join_path(dir, 'mpicxx')) env.set('MPIF77', join_path(dir, 'mpif77')) @@ -58,22 +57,19 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage): @property def libs(self): libs = [] - for dir in [path.join('lib', 'release_mt'), + for dir in [join_path('lib', 'release_mt'), 'lib', - path.join('libfabric', 'lib')]: - lib_path = path.join(self.prefix, 'mpi', 'latest', dir) + join_path('libfabric', 'lib')]: + lib_path = join_path(self.component_path, dir) ldir = find_libraries('*', root=lib_path, shared=True, recursive=False) libs += ldir return libs - def _join_prefix(self, path): - return join_path(self.prefix, 'mpi', 'latest', path) - def install(self, spec, prefix): super(IntelOneapiMpi, self).install(spec, prefix) # need to patch libmpi.so so it can always find libfabric - libfabric_rpath = self._join_prefix(path.join('libfabric', 'lib')) + libfabric_rpath = join_path(self.component_path, 'libfabric', 'lib') for lib_version in ['debug', 'release', 'release_mt', 'debug_mt']: - file = self._join_prefix(path.join('lib', lib_version, 'libmpi.so')) + file = join_path(self.component_path, 'lib', lib_version, 'libmpi.so') subprocess.call(['patchelf', '--set-rpath', libfabric_rpath, file]) -- cgit v1.2.3-60-g2f50