diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/intel.py | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/spack/spack/build_systems/intel.py b/lib/spack/spack/build_systems/intel.py index 73cdcd8eaf..0936eef07c 100644 --- a/lib/spack/spack/build_systems/intel.py +++ b/lib/spack/spack/build_systems/intel.py @@ -25,11 +25,11 @@ from spack.util.executable import Executable from spack.util.prefix import Prefix from spack.build_environment import dso_suffix - # A couple of utility functions that might be useful in general. If so, they # should really be defined elsewhere, unless deemed heretical. # (Or na"ive on my part). + def debug_print(msg, *args): '''Prints a message (usu. a variable) and the callers' names for a couple of stack frames. @@ -115,6 +115,14 @@ class IntelPackage(PackageBase): 'intel-mpi@5.1:5.99': 2016, } + # Below is the list of possible values for setting auto dispatch functions + # for the Intel compilers. Using these allows for the building of fat + # binaries that will detect the CPU SIMD capabilities at run time and + # activate the appropriate extensions. + auto_dispatch_options = ('COMMON-AVX512', 'MIC-AVX512', 'CORE-AVX512', + 'CORE-AVX2', 'CORE-AVX-I', 'AVX', 'SSE4.2', + 'SSE4.1', 'SSSE3', 'SSE3', 'SSE2') + @property def license_required(self): # The Intel libraries are provided without requiring a license as of @@ -1242,6 +1250,30 @@ class IntelPackage(PackageBase): fh.write('-Xlinker -rpath={0}\n'.format(compilers_lib_dir)) @run_after('install') + def configure_auto_dispatch(self): + if self._has_compilers: + if ('auto_dispatch=none' in self.spec): + return + + compilers_bin_dir = self.component_bin_dir('compiler') + + for compiler_name in 'icc icpc ifort'.split(): + f = os.path.join(compilers_bin_dir, compiler_name) + if not os.path.isfile(f): + raise InstallError( + 'Cannot find compiler command to configure ' + 'auto_dispatch:\n\t' + f) + + ad = [] + for x in IntelPackage.auto_dispatch_options: + if 'auto_dispatch={0}'.format(x) in self.spec: + ad.append(x) + + compiler_cfg = os.path.abspath(f + '.cfg') + with open(compiler_cfg, 'a') as fh: + fh.write('-ax{0}\n'.format(','.join(ad))) + + @run_after('install') def filter_compiler_wrappers(self): if (('+mpi' in self.spec or self.provides('mpi')) and '~newdtags' in self.spec): |