intel-oneapi-mpi/mkl packages: add ilp64 support (#26045)

This commit is contained in:
Robert Cohn 2021-09-24 13:32:06 -04:00 committed by GitHub
parent 73913a5d51
commit 3a48f5f931
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 15 deletions

View file

@ -30,6 +30,9 @@ class IntelOneapiMkl(IntelOneApiLibraryPackage):
sha256='818b6bd9a6c116f4578cda3151da0612ec9c3ce8b2c8a64730d625ce5b13cc0c', sha256='818b6bd9a6c116f4578cda3151da0612ec9c3ce8b2c8a64730d625ce5b13cc0c',
expand=False) expand=False)
variant('ilp64', default=False,
description='Build with ILP64 support')
depends_on('intel-oneapi-tbb') depends_on('intel-oneapi-tbb')
provides('fftw-api@3') provides('fftw-api@3')
@ -42,10 +45,20 @@ class IntelOneapiMkl(IntelOneApiLibraryPackage):
def component_dir(self): def component_dir(self):
return 'mkl' return 'mkl'
def xlp64_lib(self, lib):
return lib + ('_ilp64'
if '+ilp64' in self.spec
else '_lp64')
@property
def headers(self):
include_path = join_path(self.component_path, 'include')
return find_headers('*', include_path)
@property @property
def libs(self): def libs(self):
lib_path = join_path(self.component_path, 'lib', 'intel64') mkl_libs = [self.xlp64_lib('libmkl_intel'), 'libmkl_sequential', 'libmkl_core']
mkl_libs = ['libmkl_intel_lp64', 'libmkl_sequential', 'libmkl_core'] libs = find_libraries(mkl_libs,
libs = find_libraries(mkl_libs, root=lib_path, shared=True, recursive=False) join_path(self.component_path, 'lib', 'intel64'))
libs += find_system_libraries(['libpthread', 'libm', 'libdl'], shared=True) libs += find_system_libraries(['libpthread', 'libm', 'libdl'])
return libs return libs

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import glob
import platform import platform
import subprocess import subprocess
@ -31,7 +32,10 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage):
sha256='8b7693a156c6fc6269637bef586a8fd3ea6610cac2aae4e7f48c1fbb601625fe', sha256='8b7693a156c6fc6269637bef586a8fd3ea6610cac2aae4e7f48c1fbb601625fe',
expand=False) expand=False)
provides('mpi@:3') variant('ilp64', default=False,
description='Build with ILP64 support')
provides('mpi@:3.1')
depends_on('patchelf', type='build') depends_on('patchelf', type='build')
@ -61,26 +65,36 @@ def setup_dependent_build_environment(self, env, dependent_spec):
env.set('MPIF90', join_path(dir, 'mpif90')) env.set('MPIF90', join_path(dir, 'mpif90'))
env.set('MPIFC', join_path(dir, 'mpifc')) env.set('MPIFC', join_path(dir, 'mpifc'))
@property
def headers(self):
include_path = join_path(self.component_path, 'include')
headers = find_headers('*', include_path)
if '+ilp64' in self.spec:
headers += find_headers('*', join_path(include_path, 'ilp64'))
return headers
@property @property
def libs(self): def libs(self):
lib_dir = join_path(self.component_path, 'lib')
release_lib_dir = join_path(lib_dir, 'release')
libs = [] libs = []
for dir in [join_path('lib', 'release_mt'), if '+ilp64' in self.spec:
'lib', libs += find_libraries('libmpi_ilp64', release_lib_dir)
join_path('libfabric', 'lib')]: libs += find_libraries(['libmpicxx', 'libmpifort'], lib_dir)
lib_path = join_path(self.component_path, dir) libs += find_libraries('libmpi', release_lib_dir)
ldir = find_libraries('*', root=lib_path, shared=True, recursive=False) libs += find_system_libraries(['libdl', 'librt', 'libpthread'])
libs += ldir
return libs return libs
def install(self, spec, prefix): def install(self, spec, prefix):
super(IntelOneapiMpi, self).install(spec, prefix) super(IntelOneapiMpi, self).install(spec, prefix)
# need to patch libmpi.so so it can always find libfabric # Patch libmpi.so rpath so it can find libfabric
libfabric_rpath = join_path(self.component_path, 'libfabric', 'lib') libfabric_rpath = join_path(self.component_path, 'libfabric', 'lib')
for lib_version in ['debug', 'release', 'release_mt', 'debug_mt']: for libmpi in glob.glob(join_path(self.component_path,
file = join_path(self.component_path, 'lib', lib_version, 'libmpi.so') 'lib', '**', 'libmpi*.so')):
subprocess.call(['patchelf', '--set-rpath', libfabric_rpath, file]) subprocess.call(['patchelf', '--set-rpath', libfabric_rpath, libmpi])
# When spack builds from source
# fix I_MPI_SUBSTITUTE_INSTALLDIR and # fix I_MPI_SUBSTITUTE_INSTALLDIR and
# __EXEC_PREFIX_TO_BE_FILLED_AT_INSTALL_TIME__ # __EXEC_PREFIX_TO_BE_FILLED_AT_INSTALL_TIME__
scripts = ["mpif77", "mpif90", "mpigcc", "mpigxx", "mpiicc", "mpiicpc", scripts = ["mpif77", "mpif90", "mpigcc", "mpigxx", "mpiicc", "mpiicpc",