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
This commit is contained in:
parent
973a131dac
commit
726c7e0f06
2 changed files with 36 additions and 25 deletions
|
@ -64,11 +64,10 @@ def autoreconf(self, spec, prefix):
|
||||||
@property
|
@property
|
||||||
def optflags(self):
|
def optflags(self):
|
||||||
flags = '-O2'
|
flags = '-O2'
|
||||||
|
|
||||||
# Optimizations for the Intel compiler, suggested by CP2K
|
# Optimizations for the Intel compiler, suggested by CP2K
|
||||||
|
# See ../libxc/package.py for rationale and doc.
|
||||||
if '%intel' in self.spec:
|
if '%intel' in self.spec:
|
||||||
# -xSSE2 will make it usable on old architecture
|
flags += ' -xSSE4.2 -axAVX,CORE-AVX2 -ipo'
|
||||||
flags += ' -xSSE2 -xAVX -axCORE-AVX2 -ipo'
|
|
||||||
|
|
||||||
return flags
|
return flags
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
from spack import *
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
class Libxc(Package):
|
class Libxc(AutotoolsPackage):
|
||||||
"""Libxc is a library of exchange-correlation functionals for
|
"""Libxc is a library of exchange-correlation functionals for
|
||||||
density-functional theory."""
|
density-functional theory."""
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ def libs(self):
|
||||||
# Libxc installs both shared and static libraries.
|
# Libxc installs both shared and static libraries.
|
||||||
# If a client ask for static explicitly then return
|
# If a client ask for static explicitly then return
|
||||||
# the static libraries
|
# 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
|
# Libxc has a fortran90 interface: give clients the
|
||||||
# possibility to query for it
|
# possibility to query for it
|
||||||
|
@ -63,31 +63,43 @@ def libs(self):
|
||||||
libraries, root=self.prefix, shared=shared, recursive=True
|
libraries, root=self.prefix, shared=shared, recursive=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def setup_environment(self, spack_env, run_env):
|
||||||
# Optimizations for the Intel compiler, suggested by CP2K
|
|
||||||
optflags = '-O2'
|
optflags = '-O2'
|
||||||
if self.compiler.name == 'intel':
|
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'):
|
if which('xiar'):
|
||||||
env['AR'] = 'xiar'
|
spack_env.set('AR', 'xiar')
|
||||||
|
|
||||||
if 'CFLAGS' in env and env['CFLAGS']:
|
spack_env.append_flags('CFLAGS', optflags)
|
||||||
env['CFLAGS'] += ' ' + optflags
|
spack_env.append_flags('FCFLAGS', optflags)
|
||||||
else:
|
|
||||||
env['CFLAGS'] = optflags
|
|
||||||
|
|
||||||
if 'FCFLAGS' in env and env['FCFLAGS']:
|
def configure_args(self):
|
||||||
env['FCFLAGS'] += ' ' + optflags
|
args = ['--enable-shared']
|
||||||
else:
|
return args
|
||||||
env['FCFLAGS'] = optflags
|
|
||||||
|
|
||||||
configure('--prefix={0}'.format(prefix),
|
|
||||||
'--enable-shared')
|
|
||||||
|
|
||||||
make()
|
|
||||||
|
|
||||||
|
def check(self):
|
||||||
# libxc provides a testsuite, but many tests fail
|
# libxc provides a testsuite, but many tests fail
|
||||||
# http://www.tddft.org/pipermail/libxc/2013-February/000032.html
|
# http://www.tddft.org/pipermail/libxc/2013-February/000032.html
|
||||||
# make('check')
|
pass
|
||||||
|
|
||||||
make('install')
|
|
||||||
|
|
Loading…
Reference in a new issue