summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com>2021-04-15 19:30:40 +0530
committerGitHub <noreply@github.com>2021-04-15 07:00:40 -0700
commit92291120cb9855014cdce2a439732bf487a21731 (patch)
tree64fe7c1b7aa3c3714c938df9309cdfdf28cf6a4b
parent4ea1774be37dcb0a344d1eacd5c21cd8608b495f (diff)
downloadspack-92291120cb9855014cdce2a439732bf487a21731.tar.gz
spack-92291120cb9855014cdce2a439732bf487a21731.tar.bz2
spack-92291120cb9855014cdce2a439732bf487a21731.tar.xz
spack-92291120cb9855014cdce2a439732bf487a21731.zip
Amdfftw and fftw: add variants and conflicts (#22940)
FFTW: (1) Condition to ensure Quad precision is not supported in MPI under FFTW base class AMDFFTW: (1) Support for debug and quad precision for aocc compiler (2) Dedicated variant for threads for enabling SMP threads (3) Restricted simd features to 'sse2', 'avx' and 'avx2' (4) Removed float simd features (5) If debug option is enabled, configure option will be appended with --enable-debug option (6) Condition to ensure amd-fast-planner is supported from 3.0 onwards under amdfftw derived class (7) New variant amd-fast-planner - This option will reduce the planning time without much tradeoff in the performance. It is supported for single and double precisions. (8) Removed following flags for amdfftw - '--enable-threads', '--enable-fma' and '--enable-sse'
-rw-r--r--var/spack/repos/builtin/packages/amdfftw/package.py73
-rw-r--r--var/spack/repos/builtin/packages/fftw/package.py2
2 files changed, 50 insertions, 25 deletions
diff --git a/var/spack/repos/builtin/packages/amdfftw/package.py b/var/spack/repos/builtin/packages/amdfftw/package.py
index 5f946d4ae6..5ac24cd2b7 100644
--- a/var/spack/repos/builtin/packages/amdfftw/package.py
+++ b/var/spack/repos/builtin/packages/amdfftw/package.py
@@ -33,43 +33,66 @@ class Amdfftw(FftwBase):
version('3.0', sha256='a69deaf45478a59a69f77c4f7e9872967f1cfe996592dd12beb6318f18ea0bcd')
version('2.2', sha256='de9d777236fb290c335860b458131678f75aa0799c641490c644c843f0e246f8')
- variant('shared', default=True, description='Builds a shared version of the library')
+ variant('shared', default=True, description="Builds a shared version of the library")
variant('openmp', default=True, description="Enable OpenMP support")
- variant('debug', default=False, description='Builds a debug version of the library')
+ variant('threads', default=False, description="Enable SMP threads support")
+ variant('debug', default=False, description="Builds a debug version of the library")
+ variant(
+ 'amd-fast-planner',
+ default=False,
+ description="Option to reduce the planning time without much"
+ "tradeoff in the performance. It is supported for"
+ "Float and double precisions only.")
depends_on('texinfo')
provides('fftw-api@3', when='@2:')
- conflicts('precision=quad', when='%aocc', msg="AOCC clang doesn't support quad precision")
- conflicts('+debug', when='%aocc', msg="AOCC clang doesn't support debug")
+ conflicts('precision=quad', when='@2.2 %aocc', msg="AOCC clang doesn't support quad precision")
+ conflicts('+debug', when='@2.2 %aocc', msg="AOCC clang doesn't support debug")
conflicts('%gcc@:7.2', when="@2.2:", msg="Required GCC version above 7.2 for AMDFFTW")
+ conflicts('+amd-fast-planner', when="@2.2", msg="amd-fast-planner is supported from 3.0 onwards")
+ conflicts(
+ '+amd-fast-planner',
+ when='precision=quad',
+ msg="amd-fast-planner doesn't support quad precision")
+ conflicts(
+ '+amd-fast-planner',
+ when='precision=long_double',
+ msg="amd-fast-planner doesn't support long_double precision")
def configure(self, spec, prefix):
"""Configure function"""
# Base options
options = [
'--prefix={0}'.format(prefix),
- '--enable-amd-opt',
- '--enable-threads'
+ '--enable-amd-opt'
]
# Check if compiler is AOCC
- if spec.satisfies('%aocc'):
+ if '%aocc' in spec:
options.append("CC={0}".format(os.path.basename(spack_cc)))
- options.append("CXX={0}".format(os.path.basename(spack_cxx)))
options.append("FC={0}".format(os.path.basename(spack_fc)))
+ options.append("F77={0}".format(os.path.basename(spack_fc)))
if '+shared' in spec:
options.append('--enable-shared')
else:
options.append('--disable-shared')
+ if '+debug' in spec:
+ options.append('--enable-debug')
+
if '+openmp' in spec:
options.append('--enable-openmp')
else:
options.append('--disable-openmp')
+ if '+threads' in spec:
+ options.append('--enable-threads')
+ else:
+ options.append('--disable-threads')
+
if '+mpi' in spec:
options.append('--enable-mpi')
options.append('--enable-amd-mpifft')
@@ -77,24 +100,33 @@ class Amdfftw(FftwBase):
options.append('--disable-mpi')
options.append('--disable-amd-mpifft')
+ if '+amd-fast-planner' in spec:
+ options.append('--enable-amd-fast-planner')
+ else:
+ options.append('--disable-amd-fast-planner')
+
if not self.compiler.f77 or not self.compiler.fc:
options.append("--disable-fortran")
+ # Cross compilation is supported in amd-fftw by making use of target
+ # variable to set AMD_ARCH configure option.
+ # Spack user can not directly use AMD_ARCH for this purpose but should
+ # use target variable to set appropriate -march option in AMD_ARCH.
+ arch = spec.architecture
+ options.append(
+ "AMD_ARCH={0}".format(
+ arch.target.optimization_flags(
+ spec.compiler).split("=")[-1]))
+
# Specific SIMD support.
# float and double precisions are supported
- simd_features = ['sse2', 'avx', 'avx2', 'avx512', 'avx-128-fma',
- 'kcvi', 'vsx', 'neon']
+ simd_features = ['sse2', 'avx', 'avx2']
+
simd_options = []
for feature in simd_features:
msg = '--enable-{0}' if feature in spec.target else '--disable-{0}'
simd_options.append(msg.format(feature))
- simd_options += [
- '--enable-fma' if 'fma' in spec.target else '--disable-fma'
- ]
-
- float_simd_features = ['altivec', 'sse']
-
# When enabling configure option "--enable-amd-opt", do not use the
# configure option "--enable-generic-simd128" or
# "--enable-generic-simd256"
@@ -118,14 +150,5 @@ class Amdfftw(FftwBase):
if precision in ('float', 'double'):
opts += simd_options
- # float-only acceleration
- if precision == 'float':
- for feature in float_simd_features:
- if feature in spec.target:
- msg = '--enable-{0}'
- else:
- msg = '--disable-{0}'
- opts.append(msg.format(feature))
-
with working_dir(precision, create=True):
configure(*opts)
diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py
index c3b1b871ce..583a872096 100644
--- a/var/spack/repos/builtin/packages/fftw/package.py
+++ b/var/spack/repos/builtin/packages/fftw/package.py
@@ -32,6 +32,8 @@ class FftwBase(AutotoolsPackage):
msg='Long double precision is not supported in FFTW 2')
conflicts('precision=quad', when='@2.1.5',
msg='Quad precision is not supported in FFTW 2')
+ conflicts('precision=quad', when='+mpi',
+ msg='Quad precision is not supported in MPI')
@property
def libs(self):