[oneapi] fix mkl deps, externally installed, and docs (#22607)
This commit is contained in:
@@ -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 @@ def install(self, spec, prefix):
|
||||
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
|
||||
|
@@ -36,6 +36,8 @@ def component_dir(self):
|
||||
|
||||
@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
|
||||
|
@@ -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 @@ def component_dir(self):
|
||||
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 @@ def setup_dependent_build_environment(self, env, dependent_spec):
|
||||
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 @@ def setup_dependent_build_environment(self, env, dependent_spec):
|
||||
@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])
|
||||
|
Reference in New Issue
Block a user