gromacs: remove simd variants (#13636)

This commit is contained in:
Christoph Junghans 2020-03-10 09:08:10 -06:00 committed by GitHub
parent 48f8f0ec58
commit 7744070787
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,8 +2,7 @@
# 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 llnl.util.cpu
from spack import *
class Gromacs(CMakePackage): class Gromacs(CMakePackage):
@ -62,12 +61,6 @@ class Gromacs(CMakePackage):
description='The build type to build', description='The build type to build',
values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel', values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel',
'Reference', 'RelWithAssert', 'Profile')) 'Reference', 'RelWithAssert', 'Profile'))
variant('simd', default='auto',
description='The SIMD instruction set to use',
values=('auto', 'none', 'SSE2', 'SSE4.1', 'AVX_128_FMA', 'AVX_256',
'AVX2_128', 'AVX2_256', 'AVX_512', 'AVX_512_KNL',
'IBM_QPX', 'Sparc64_HPC_ACE', 'IBM_VMX', 'IBM_VSX',
'ARM_NEON', 'ARM_NEON_ASIMD'))
variant('rdtscp', default=True, description='Enable RDTSCP instruction usage') variant('rdtscp', default=True, description='Enable RDTSCP instruction usage')
variant('mdrun_only', default=False, variant('mdrun_only', default=False,
description='Enables the build of a cut-down version' description='Enables the build of a cut-down version'
@ -119,13 +112,40 @@ def cmake_args(self):
else: else:
options.append('-DGMX_GPU:BOOL=OFF') options.append('-DGMX_GPU:BOOL=OFF')
simd_value = self.spec.variants['simd'].value # Activate SIMD based on properties of the target
if simd_value == 'auto': target = self.spec.target
pass if target >= llnl.util.cpu.targets['bulldozer']:
elif simd_value == 'none': # AMD Family 15h
options.append('-DGMX_SIMD:STRING=None') options.append('-DGMX_SIMD=AVX_128_FMA')
elif target >= llnl.util.cpu.targets['zen']:
# AMD Family 17h
options.append('-DGMX_SIMD=AVX2_128')
elif target >= llnl.util.cpu.targets['power7']:
# IBM Power 7 and beyond
options.append('-DGMX_SIMD=IBM_VSX')
elif target.family == llnl.util.cpu.targets['aarch64']:
# ARMv8
options.append('-DGMX_SIMD=ARM_NEON_ASIMD')
elif target == llnl.util.cpu.targets['mic_knl']:
# Intel KNL
options.append('-DGMX_SIMD=AVX_512_KNL')
elif target.vendor == 'GenuineIntel':
# Other Intel architectures
simd_features = [
('sse2', 'SSE2'),
('sse4_1', 'SSE4.1'),
('avx', 'AVX_256'),
('axv128', 'AVX2_128'),
('avx2', 'AVX2_256'),
('avx512', 'AVX_512'),
]
for feature, flag in reversed(simd_features):
if feature in target:
options.append('-DGMX_SIMD:STRING={0}'.format(flag))
break
else: else:
options.append('-DGMX_SIMD:STRING=' + simd_value) # Fall back to this for unknown microarchitectures
options.append('-DGMX_SIMD:STRING=None')
if '-rdtscp' in self.spec: if '-rdtscp' in self.spec:
options.append('-DGMX_USE_RDTSCP:BOOL=OFF') options.append('-DGMX_USE_RDTSCP:BOOL=OFF')