diff options
-rw-r--r-- | var/spack/repos/builtin/packages/fftw/package.py | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py index 709ad64af4..1f96bd88c3 100644 --- a/var/spack/repos/builtin/packages/fftw/package.py +++ b/var/spack/repos/builtin/packages/fftw/package.py @@ -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): |