diff options
Diffstat (limited to 'var/spack/repos/builtin/packages/mkl/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/mkl/package.py | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/var/spack/repos/builtin/packages/mkl/package.py b/var/spack/repos/builtin/packages/mkl/package.py index 71a233ff3e..4a9a8785f7 100644 --- a/var/spack/repos/builtin/packages/mkl/package.py +++ b/var/spack/repos/builtin/packages/mkl/package.py @@ -9,7 +9,7 @@ class Mkl(IntelInstaller): Note: You will have to add the download file to a mirror so that Spack can find it. For instructions on how to set up a - mirror, see http://software.llnl.gov/spack/mirrors.html. + mirror, see http://spack.readthedocs.io/en/latest/mirrors.html. To set the threading layer at run time set MKL_THREADING_LAYER variable to one of the following values: INTEL (default), SEQUENTIAL, PGI. @@ -24,13 +24,41 @@ class Mkl(IntelInstaller): version('11.3.3.210', 'f72546df27f5ebb0941b5d21fd804e34', url="file://%s/l_mkl_11.3.3.210.tgz" % os.getcwd()) + variant('shared', default=True, description='Builds shared library') + variant('ilp64', default=False, description='64 bit integers') + variant('openmp', default=False, description='OpenMP multithreading layer') + # virtual dependency provides('blas') provides('lapack') # TODO: MKL also provides implementation of Scalapack. - def install(self, spec, prefix): + @property + def blas_libs(self): + shared = True if '+shared' in self.spec else False + suffix = dso_suffix if '+shared' in self.spec else 'a' + mkl_integer = ['libmkl_intel_ilp64'] if '+ilp64' in self.spec else ['libmkl_intel_lp64'] # NOQA: ignore=E501 + mkl_threading = ['libmkl_sequential'] + if '+openmp' in self.spec: + mkl_threading = ['libmkl_intel_thread', 'libiomp5'] if '%intel' in self.spec else ['libmkl_gnu_thread'] # NOQA: ignore=E501 + # TODO: TBB threading: ['libmkl_tbb_thread', 'libtbb', 'libstdc++'] + mkl_libs = find_libraries( + mkl_integer + ['libmkl_core'] + mkl_threading, + root=join_path(self.prefix.lib, 'intel64'), + shared=shared + ) + system_libs = [ + 'libpthread.{0}'.format(suffix), + 'libm.{0}'.format(suffix), + 'libdl.{0}'.format(suffix) + ] + return mkl_libs + system_libs + + @property + def lapack_libs(self): + return self.blas_libs + def install(self, spec, prefix): self.intel_prefix = os.path.join(prefix, "pkg") IntelInstaller.install(self, spec, prefix) @@ -38,32 +66,6 @@ class Mkl(IntelInstaller): for f in os.listdir(mkl_dir): os.symlink(os.path.join(mkl_dir, f), os.path.join(self.prefix, f)) - # Unfortunately MKL libs are natively distrubted in prefix/lib/intel64. - # To make MKL play nice with Spack, symlink all files to prefix/lib: - mkl_lib_dir = os.path.join(prefix, "lib", "intel64") - for f in os.listdir(mkl_lib_dir): - os.symlink(os.path.join(mkl_lib_dir, f), - os.path.join(self.prefix, "lib", f)) - - def setup_dependent_package(self, module, dspec): - # For now use Single Dynamic Library: - # To set the threading layer at run time, use the - # mkl_set_threading_layer function or set MKL_THREADING_LAYER - # variable to one of the following values: INTEL, SEQUENTIAL, PGI. - # To set interface layer at run time, use the mkl_set_interface_layer - # function or set the MKL_INTERFACE_LAYER variable to LP64 or ILP64. - - # Otherwise one would need to specify several libraries - # (e.g. mkl_intel_lp64;mkl_sequential;mkl_core), which reflect - # different interface and threading layers. - - name = 'libmkl_rt.%s' % dso_suffix - libdir = find_library_path(name, self.prefix.lib64, self.prefix.lib) - - # Now set blas/lapack libs: - self.spec.blas_shared_lib = join_path(libdir, name) - self.spec.lapack_shared_lib = self.spec.blas_shared_lib - def setup_dependent_environment(self, spack_env, run_env, dependent_spec): # set up MKLROOT for everyone using MKL package spack_env.set('MKLROOT', self.prefix) |