From 2c87992506db934521e85186ab7565eb904848ad Mon Sep 17 00:00:00 2001 From: Satish Balay Date: Tue, 20 Jul 2021 02:48:48 -0500 Subject: petsc: pass in 'cuda_arch' to configure via --with-cuda-gencodearch [or CUDAFLAGS for older releases] (#24962) --- var/spack/repos/builtin/packages/petsc/package.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index 9fbf97ea75..aaf0aabf9b 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -431,6 +431,15 @@ class Petsc(Package, CudaPackage, ROCmPackage): library=petsclibname, path=spec[library].prefix) ) + if '+cuda' in spec: + if not spec.satisfies('cuda_arch=none'): + cuda_arch = spec.variants['cuda_arch'].value + if spec.satisfies('@3.14:'): + options.append('--with-cuda-gencodearch={0}'.format(cuda_arch[0])) + else: + options.append('CUDAFLAGS=-gencode arch=compute_{0},code=sm_{0}' + .format(cuda_arch[0])) + # PETSc does not pick up SuperluDist from the dir as they look for # superlu_dist_4.1.a if 'superlu-dist' in spec: -- cgit v1.2.3-70-g09d2