summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/cp2k/package.py7
-rw-r--r--var/spack/repos/builtin/packages/libint/package.py20
-rw-r--r--var/spack/repos/builtin/packages/libxc/package.py35
3 files changed, 23 insertions, 39 deletions
diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py
index 9b0e3b69d7..1b248506da 100644
--- a/var/spack/repos/builtin/packages/cp2k/package.py
+++ b/var/spack/repos/builtin/packages/cp2k/package.py
@@ -193,7 +193,12 @@ class Cp2k(MakefilePackage, CudaPackage):
fftw_header_dir = fftw.headers.directories[0] + '/fftw'
elif '^intel-parallel-studio+mkl' in spec:
fftw = spec['intel-parallel-studio']
- fftw_header_dir = fftw.headers.directories[0] + '/fftw'
+ fftw_header_dir = '<NOTFOUND>'
+ for incdir in [join_path(f, 'fftw')
+ for f in fftw.headers.directories]:
+ if os.path.exists(incdir):
+ fftw_header_dir = incdir
+ break
optimization_flags = {
'gcc': [
diff --git a/var/spack/repos/builtin/packages/libint/package.py b/var/spack/repos/builtin/packages/libint/package.py
index f7248f61ab..a3b39495f9 100644
--- a/var/spack/repos/builtin/packages/libint/package.py
+++ b/var/spack/repos/builtin/packages/libint/package.py
@@ -78,10 +78,10 @@ class Libint(AutotoolsPackage):
@property
def optflags(self):
flags = '-O2'
- # Optimizations for the Intel compiler, suggested by CP2K
- # See ../libxc/package.py for rationale and doc.
- if '%intel' in self.spec:
- flags += ' -xSSE4.2 -axAVX,CORE-AVX2 -ipo'
+
+ # microarchitecture-specific optimization flags should be controlled
+ # by Spack, otherwise we may end up with contradictory or invalid flags
+ # see https://github.com/spack/spack/issues/17794
return flags
@@ -99,18 +99,16 @@ class Libint(AutotoolsPackage):
config_args = ['--enable-shared']
- optflags = self.optflags
-
# Optimization flag names have changed in libint 2
if self.version < Version('2.0.0'):
config_args.extend([
- '--with-cc-optflags={0}'.format(optflags),
- '--with-cxx-optflags={0}'.format(optflags)
+ '--with-cc-optflags={0}'.format(self.optflags),
+ '--with-cxx-optflags={0}'.format(self.optflags)
])
else:
config_args.extend([
- '--with-cxx-optflags={0}'.format(optflags),
- '--with-cxxgen-optflags={0}'.format(optflags)
+ '--with-cxx-optflags={0}'.format(self.optflags),
+ '--with-cxxgen-optflags={0}'.format(self.optflags)
])
# Options required by CP2K, removed in libint 2
@@ -199,6 +197,6 @@ class Libint(AutotoolsPackage):
def patch(self):
# Use Fortran compiler to link the Fortran example, not the C++
# compiler
- if '+fortran' in self.spec and self.spec.satisfies('%nvhpc'):
+ if '+fortran' in self.spec:
filter_file('$(CXX) $(CXXFLAGS)', '$(FC) $(FCFLAGS)',
'export/fortran/Makefile', string=True)
diff --git a/var/spack/repos/builtin/packages/libxc/package.py b/var/spack/repos/builtin/packages/libxc/package.py
index 178b6cbcde..f054bfa72c 100644
--- a/var/spack/repos/builtin/packages/libxc/package.py
+++ b/var/spack/repos/builtin/packages/libxc/package.py
@@ -64,37 +64,18 @@ class Libxc(AutotoolsPackage, CudaPackage):
)
def setup_build_environment(self, env):
- optflags = '-O2'
- if self.compiler.name == 'intel':
- # Optimizations for the Intel compiler, suggested by CP2K
- #
- # Note that not every lowly login node has advanced CPUs:
- #
- # $ icc -xAVX -axCORE-AVX2 -ipo hello.c
- # $ ./a.out
- # Please verify that both the operating system and the \
- # processor support Intel(R) AVX instructions.
- #
- # NB: The same flags are applied in:
- # - ../libint/package.py
- #
- # Related:
- # - ../fftw/package.py variants: simd, fma
- # - ../c-blosc/package.py variant: avx2
- # - ../r-rcppblaze/package.py AVX* in "info" but not in code?
- # - ../openblas/package.py variants: cpu_target!?!
- # - ../cp2k/package.py
- #
- # Documentation at:
- # https://software.intel.com/en-us/cpp-compiler-18.0-developer-guide-and-reference-ax-qax
- #
- optflags += ' -xSSE4.2 -axAVX,CORE-AVX2 -ipo'
- if which('xiar'):
- env.set('AR', 'xiar')
+ # microarchitecture-specific optimization flags should be controlled
+ # by Spack, otherwise we may end up with contradictory or invalid flags
+ # see https://github.com/spack/spack/issues/17794
+ # libxc on the other hand only sets the generic -O2 when it detects GCC
+ optflags = '-O2'
env.append_flags('CFLAGS', optflags)
env.append_flags('FCFLAGS', optflags)
+ if '%intel' in self.spec and which('xiar'):
+ env.set('AR', 'xiar')
+
if '+cuda' in self.spec:
nvcc = self.spec['cuda'].prefix.bin.nvcc
env.set('CCLD', '{0} -ccbin {1}'.format(nvcc, spack_cc))