gromacs: remove simd variants (#13636)
This commit is contained in:
parent
48f8f0ec58
commit
7744070787
1 changed files with 34 additions and 14 deletions
|
@ -2,8 +2,7 @@
|
|||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack import *
|
||||
import llnl.util.cpu
|
||||
|
||||
|
||||
class Gromacs(CMakePackage):
|
||||
|
@ -62,12 +61,6 @@ class Gromacs(CMakePackage):
|
|||
description='The build type to build',
|
||||
values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel',
|
||||
'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('mdrun_only', default=False,
|
||||
description='Enables the build of a cut-down version'
|
||||
|
@ -119,13 +112,40 @@ def cmake_args(self):
|
|||
else:
|
||||
options.append('-DGMX_GPU:BOOL=OFF')
|
||||
|
||||
simd_value = self.spec.variants['simd'].value
|
||||
if simd_value == 'auto':
|
||||
pass
|
||||
elif simd_value == 'none':
|
||||
options.append('-DGMX_SIMD:STRING=None')
|
||||
# Activate SIMD based on properties of the target
|
||||
target = self.spec.target
|
||||
if target >= llnl.util.cpu.targets['bulldozer']:
|
||||
# AMD Family 15h
|
||||
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:
|
||||
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:
|
||||
options.append('-DGMX_USE_RDTSCP:BOOL=OFF')
|
||||
|
|
Loading…
Reference in a new issue