From 726c7e0f06b11dd3c0ce435b91569e7764f4e7f1 Mon Sep 17 00:00:00 2001 From: Michael Sternberg Date: Wed, 21 Mar 2018 19:53:19 -0500 Subject: Opt avx (#7486) * Promote to Autotools for simplicity; broaden Intel CPU opt targeting from SSE4.2 to AVX2 * make Intel CPU opt targeting same as in ../libxc * flake8 W291 * use canonical means to pass (ahem) the test phase, h/t @adamjstewart * revert f25d598 (unrelated merge) * re-merge --- var/spack/repos/builtin/packages/libint/package.py | 5 +- var/spack/repos/builtin/packages/libxc/package.py | 56 +++++++++++++--------- 2 files changed, 36 insertions(+), 25 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/libint/package.py b/var/spack/repos/builtin/packages/libint/package.py index 8fa0906658..29c79ee4bd 100644 --- a/var/spack/repos/builtin/packages/libint/package.py +++ b/var/spack/repos/builtin/packages/libint/package.py @@ -64,11 +64,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: - # -xSSE2 will make it usable on old architecture - flags += ' -xSSE2 -xAVX -axCORE-AVX2 -ipo' + flags += ' -xSSE4.2 -axAVX,CORE-AVX2 -ipo' return flags diff --git a/var/spack/repos/builtin/packages/libxc/package.py b/var/spack/repos/builtin/packages/libxc/package.py index 0149e42b6c..b6e61a69b2 100644 --- a/var/spack/repos/builtin/packages/libxc/package.py +++ b/var/spack/repos/builtin/packages/libxc/package.py @@ -25,7 +25,7 @@ from spack import * -class Libxc(Package): +class Libxc(AutotoolsPackage): """Libxc is a library of exchange-correlation functionals for density-functional theory.""" @@ -52,7 +52,7 @@ class Libxc(Package): # Libxc installs both shared and static libraries. # If a client ask for static explicitly then return # the static libraries - shared = False if 'static' in query_parameters else True + shared = ('static' not in query_parameters) # Libxc has a fortran90 interface: give clients the # possibility to query for it @@ -63,31 +63,43 @@ class Libxc(Package): libraries, root=self.prefix, shared=shared, recursive=True ) - def install(self, spec, prefix): - # Optimizations for the Intel compiler, suggested by CP2K + def setup_environment(self, spack_env, run_env): optflags = '-O2' if self.compiler.name == 'intel': - optflags += ' -xAVX -axCORE-AVX2 -ipo' + # 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['AR'] = 'xiar' + spack_env.set('AR', 'xiar') - if 'CFLAGS' in env and env['CFLAGS']: - env['CFLAGS'] += ' ' + optflags - else: - env['CFLAGS'] = optflags + spack_env.append_flags('CFLAGS', optflags) + spack_env.append_flags('FCFLAGS', optflags) - if 'FCFLAGS' in env and env['FCFLAGS']: - env['FCFLAGS'] += ' ' + optflags - else: - env['FCFLAGS'] = optflags - - configure('--prefix={0}'.format(prefix), - '--enable-shared') - - make() + def configure_args(self): + args = ['--enable-shared'] + return args + def check(self): # libxc provides a testsuite, but many tests fail # http://www.tddft.org/pipermail/libxc/2013-February/000032.html - # make('check') - - make('install') + pass -- cgit v1.2.3-70-g09d2