summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2020-08-17 00:23:04 +0200
committerGitHub <noreply@github.com>2020-08-16 17:23:04 -0500
commitfd82cff737baabba9dd8c36e97cb5258114caccf (patch)
tree7a8731120fcac530f8951fc4134f62464d3d9576 /var
parent0ffe64dee0c61e7a56d3c10b29f23d7fb544dfbb (diff)
downloadspack-fd82cff737baabba9dd8c36e97cb5258114caccf.tar.gz
spack-fd82cff737baabba9dd8c36e97cb5258114caccf.tar.bz2
spack-fd82cff737baabba9dd8c36e97cb5258114caccf.tar.xz
spack-fd82cff737baabba9dd8c36e97cb5258114caccf.zip
Make spfft build with rocm (#18068)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/spfft/package.py38
1 files changed, 30 insertions, 8 deletions
diff --git a/var/spack/repos/builtin/packages/spfft/package.py b/var/spack/repos/builtin/packages/spfft/package.py
index 2fbd738383..bda9eba388 100644
--- a/var/spack/repos/builtin/packages/spfft/package.py
+++ b/var/spack/repos/builtin/packages/spfft/package.py
@@ -24,30 +24,52 @@ class Spfft(CMakePackage, CudaPackage):
variant('single_precision', default=False, description="Sinlge precision")
variant('gpu_direct', default=False, description="GPU aware MPI")
variant('static', default=False, description="build static library")
- variant('cuda', default=False, description="CUDA")
variant('fortran', default=False, description="enable fortran")
variant('build_type', default='Release', description='CMake build type',
values=('Debug', 'Release', 'RelWithDebInfo'))
depends_on('fftw-api@3')
depends_on('mpi', when='+mpi')
+ # ROCM variants + dependencies
+ variant('rocm', default=False, description="Use ROCm backend")
+
+ amdgpu_targets = (
+ 'gfx701', 'gfx801', 'gfx802', 'gfx803',
+ 'gfx900', 'gfx906', 'gfx908', 'gfx1010',
+ 'gfx1011', 'gfx1012'
+ )
+
+ depends_on('rocfft', when='+rocm')
+ depends_on('hip', when='+rocm')
+ depends_on('hsakmt-roct', when='+rocm', type='link')
+ depends_on('hsa-rocr-dev', when='+rocm', type='link')
+ variant('amdgpu_target', default=('gfx803', 'gfx900', 'gfx906'), multi=True, values=amdgpu_targets)
+
depends_on('cuda@:10', when='@:0.9.11 +cuda')
def cmake_args(self):
+ spec = self.spec
args = []
- if self.spec.satisfies('+openmp'):
+ if spec.satisfies('+openmp'):
args += ["-DSPFFT_OMP=On"]
- if self.spec.satisfies('+mpi'):
+ if spec.satisfies('+mpi'):
args += ["-DSPFFT_MPI=On"]
- if self.spec.satisfies('+single_precision'):
+ if spec.satisfies('+single_precision'):
args += ["-DSPFFT_SINGLE_PRECISION=On"]
- if self.spec.satisfies('+gpu_direct'):
+ if spec.satisfies('+gpu_direct'):
args += ["-DSPFFT_GPU_DIRECT=On"]
- if self.spec.satisfies('+cuda'):
+ if spec.satisfies('+cuda'):
args += ["-DSPFFT_GPU_BACKEND=CUDA"]
- if self.spec.satisfies('+fortran'):
+ if spec.satisfies('+rocm'):
+ archs = ",".join(self.spec.variants['amdgpu_target'].value)
+ args += [
+ '-DSPFFT_GPU_BACKEND=ROCM',
+ '-DHIP_ROOT_DIR={0}'.format(spec['hip'].prefix),
+ '-DHIP_HCC_FLAGS=--amdgpu-target={0}'.format(archs)
+ ]
+ if spec.satisfies('+fortran'):
args += ["-DSPFFT_FORTAN=On"]
- if self.spec.satisfies('+static'):
+ if spec.satisfies('+static'):
args += ["-DSPFFT_STATIC=On"]
return args