MKL: set appropriate CMake env vars (#14274)

This commit is contained in:
Adam J. Stewart 2020-01-02 12:41:42 -06:00 committed by GitHub
parent 6e828206b6
commit 3f190a432e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -1048,11 +1048,19 @@ def _setup_dependent_env_callback(
env_mods = { env_mods = {
'MKLROOT': self.normalize_path('mkl'), 'MKLROOT': self.normalize_path('mkl'),
'SPACK_COMPILER_EXTRA_RPATHS': self.component_lib_dir('mkl'), 'SPACK_COMPILER_EXTRA_RPATHS': self.component_lib_dir('mkl'),
'CMAKE_PREFIX_PATH': self.normalize_path('mkl'),
'CMAKE_LIBRARY_PATH': self.component_lib_dir('mkl'),
'CMAKE_INCLUDE_PATH': self.component_include_dir('mkl'),
} }
env.set('MKLROOT', env_mods['MKLROOT']) env.set('MKLROOT', env_mods['MKLROOT'])
env.append_path('SPACK_COMPILER_EXTRA_RPATHS', env.append_path('SPACK_COMPILER_EXTRA_RPATHS',
env_mods['SPACK_COMPILER_EXTRA_RPATHS']) env_mods['SPACK_COMPILER_EXTRA_RPATHS'])
env.append_path('CMAKE_PREFIX_PATH', env_mods['CMAKE_PREFIX_PATH'])
env.append_path('CMAKE_LIBRARY_PATH',
env_mods['CMAKE_LIBRARY_PATH'])
env.append_path('CMAKE_INCLUDE_PATH',
env_mods['CMAKE_INCLUDE_PATH'])
debug_print("adding/modifying build env:", env_mods) debug_print("adding/modifying build env:", env_mods)

View file

@ -180,11 +180,6 @@ def enable_or_disable(variant, keyword='USE', var=None, newer=False):
else: else:
env.set('NO_' + var, 'ON') env.set('NO_' + var, 'ON')
# Build system has problems locating MKL libraries
# See https://github.com/pytorch/pytorch/issues/24334
if 'mkl' in self.spec:
env.prepend_path('CMAKE_PREFIX_PATH', self.spec['mkl'].prefix.mkl)
# Build in parallel to speed up build times # Build in parallel to speed up build times
env.set('MAX_JOBS', make_jobs) env.set('MAX_JOBS', make_jobs)