fftw: change default value of simd variant for other than x86_64 (#11627)
* Use spec.architecture.target insted of platform. * remove default in simd variant value. simd variant change to archtecture independent values. * Add check simd values. * rewrite check simd values. * * flake8 * change aarch64 to arm (neon support only 32 bit arm.)
This commit is contained in:
parent
1dbf3c208b
commit
34647913be
@ -4,6 +4,7 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
from spack import *
|
||||
from spack.spec import ConflictsInSpecError
|
||||
|
||||
import llnl.util.lang
|
||||
# os is used for rename, etc in patch()
|
||||
@ -54,7 +55,7 @@ class Fftw(AutotoolsPackage):
|
||||
|
||||
variant(
|
||||
'simd',
|
||||
default='sse2,avx,avx2',
|
||||
default='generic-simd128,generic-simd256',
|
||||
values=(
|
||||
'sse', 'sse2', 'avx', 'avx2', 'avx512', # Intel
|
||||
'avx-128-fma', 'kcvi', # Intel
|
||||
@ -77,6 +78,42 @@ class Fftw(AutotoolsPackage):
|
||||
provides('fftw-api@2', when='@2.1.5')
|
||||
provides('fftw-api@3', when='@3:')
|
||||
|
||||
def flag_handler(self, name, flags):
|
||||
arch = ""
|
||||
spec = self.spec
|
||||
target_simds = {
|
||||
('x86_64',): ('sse', 'sse2', 'avx', 'avx2', 'avx512',
|
||||
'avx-128-fma', 'kcvi'),
|
||||
('ppc', 'ppc64le', 'power7'): ('altivec', 'vsx'),
|
||||
('arm',): ('neon',)
|
||||
}
|
||||
|
||||
if spec.satisfies("platform=cray"):
|
||||
# FIXME; It is assumed that cray is x86_64.
|
||||
# If you support arm on cray, you need to fix it.
|
||||
arch = "x86_64"
|
||||
|
||||
for targets, simds in target_simds.items():
|
||||
if (
|
||||
(arch not in targets)
|
||||
and not any(
|
||||
spec.satisfies('target={0}'.format(t)) for t in targets)
|
||||
):
|
||||
if any(spec.satisfies('simd={0}'.format(x)) for x in simds):
|
||||
raise ConflictsInSpecError(
|
||||
spec,
|
||||
[(
|
||||
spec,
|
||||
spec.architecture.target,
|
||||
spec.variants['simd'],
|
||||
'simd={0} are valid only on {1}'.format(
|
||||
','.join(target_simds[targets]),
|
||||
','.join(targets)
|
||||
)
|
||||
)]
|
||||
)
|
||||
return (flags, None, None)
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user