laghos: add variant with compiler optimization (#24910)

* add variant with compiler optimization

Update package.py to include variant with compiler optimization, benchmarked at A-HUG hackaton to improve major kernel time by roughly 3%.

* fix style

* Update var/spack/repos/builtin/packages/laghos/package.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
Iman Hosseini 2021-08-01 14:58:24 -04:00 committed by GitHub
parent 8867827a89
commit 861abb512e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,6 +28,7 @@ class Laghos(MakefilePackage):
version('1.0', sha256='af50a126355a41c758fcda335a43fdb0a3cd97e608ba51c485afda3dd84a5b34')
variant('metis', default=True, description='Enable/disable METIS support')
variant('ofast', default=False, description="Enable gcc optimization flags")
depends_on('mfem+mpi+metis', when='+metis')
depends_on('mfem+mpi~metis', when='~metis')
@ -50,7 +51,8 @@ def build_targets(self):
targets.append('TEST_MK=%s' % spec['mfem'].package.test_mk)
if spec.satisfies('@:2.0'):
targets.append('CXX=%s' % spec['mpi'].mpicxx)
if '+ofast %gcc' in self.spec:
targets.append('CXXFLAGS = -Ofast -finline-functions')
return targets
# See lib/spack/spack/build_systems/makefile.py