gromacs: simplified use of targets (#19646)

This commit is contained in:
Massimiliano Culpo 2020-11-01 13:16:59 +01:00 committed by GitHub
parent 77fc458d29
commit e4a5a06e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,9 +2,6 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import archspec.cpu
class Gromacs(CMakePackage): class Gromacs(CMakePackage):
"""GROMACS (GROningen MAchine for Chemical Simulations) is a molecular """GROMACS (GROningen MAchine for Chemical Simulations) is a molecular
dynamics package primarily designed for simulations of proteins, lipids dynamics package primarily designed for simulations of proteins, lipids
@ -158,25 +155,25 @@ def cmake_args(self):
# Activate SIMD based on properties of the target # Activate SIMD based on properties of the target
target = self.spec.target target = self.spec.target
if target >= archspec.cpu.TARGETS['zen2']: if target >= 'zen2':
# AMD Family 17h (EPYC Rome) # AMD Family 17h (EPYC Rome)
options.append('-DGMX_SIMD=AVX2_256') options.append('-DGMX_SIMD=AVX2_256')
elif target >= archspec.cpu.TARGETS['zen']: elif target >= 'zen':
# AMD Family 17h (EPYC Naples) # AMD Family 17h (EPYC Naples)
options.append('-DGMX_SIMD=AVX2_128') options.append('-DGMX_SIMD=AVX2_128')
elif target >= archspec.cpu.TARGETS['bulldozer']: elif target >= 'bulldozer':
# AMD Family 15h # AMD Family 15h
options.append('-DGMX_SIMD=AVX_128_FMA') options.append('-DGMX_SIMD=AVX_128_FMA')
elif 'vsx' in target: elif 'vsx' in target:
# IBM Power 7 and beyond # IBM Power 7 and beyond
options.append('-DGMX_SIMD=IBM_VSX') options.append('-DGMX_SIMD=IBM_VSX')
elif target.family == archspec.cpu.TARGETS['aarch64']: elif target.family == 'aarch64':
# ARMv8 # ARMv8
if self.spec.satisfies('%nvhpc'): if self.spec.satisfies('%nvhpc'):
options.append('-DGMX_SIMD=None') options.append('-DGMX_SIMD=None')
else: else:
options.append('-DGMX_SIMD=ARM_NEON_ASIMD') options.append('-DGMX_SIMD=ARM_NEON_ASIMD')
elif target == archspec.cpu.TARGETS['mic_knl']: elif target == 'mic_knl':
# Intel KNL # Intel KNL
options.append('-DGMX_SIMD=AVX_512_KNL') options.append('-DGMX_SIMD=AVX_512_KNL')
elif target.vendor == 'GenuineIntel': elif target.vendor == 'GenuineIntel':