From 590457cf7fa82ac09d13e1fd7ae91d39a80cffc9 Mon Sep 17 00:00:00 2001 From: eugeneswalker <38933153+eugeneswalker@users.noreply.github.com> Date: Fri, 26 Feb 2021 13:53:31 -0800 Subject: amrex: use right cmake_args for @develop; depends_on(hypre) for link (#21892) * amrex package: use right cmake_args for @develop; depends_on(hypre) * add explicit depends_on for petsc, for link, when +petsc --- var/spack/repos/builtin/packages/amrex/package.py | 76 ++++++++++++----------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/var/spack/repos/builtin/packages/amrex/package.py b/var/spack/repos/builtin/packages/amrex/package.py index de22be8687..e4cf189057 100644 --- a/var/spack/repos/builtin/packages/amrex/package.py +++ b/var/spack/repos/builtin/packages/amrex/package.py @@ -83,6 +83,8 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage): depends_on('cmake@3.17:', type='build', when='^cuda @11:') depends_on('hdf5@1.10.4: +mpi', when='+hdf5') depends_on('rocrand', type='build', when='+rocm') + depends_on('hypre', type='link', when='+hypre') + depends_on('petsc', type='link', when='+petsc') conflicts('%apple-clang') conflicts('%clang') @@ -133,46 +135,10 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage): vf = tuple(float(x) / 10.0 for x in values) return ';'.join(str(x) for x in vf) - # - # For versions <= 20.11 - # - @when('@:20.11') - def cmake_args(self): - args = [ - '-DUSE_XSDK_DEFAULTS=ON', - self.define_from_variant('DIM', 'dimensions'), - self.define_from_variant('BUILD_SHARED_LIBS', 'shared'), - self.define_from_variant('ENABLE_MPI', 'mpi'), - self.define_from_variant('ENABLE_OMP', 'openmp'), - '-DXSDK_PRECISION:STRING=%s' % - self.spec.variants['precision'].value.upper(), - self.define_from_variant('XSDK_ENABLE_Fortran', 'fortran'), - self.define_from_variant('ENABLE_FORTRAN_INTERFACES', 'fortran'), - self.define_from_variant('ENABLE_EB', 'eb'), - self.define_from_variant('ENABLE_LINEAR_SOLVERS', - 'linear_solvers'), - self.define_from_variant('ENABLE_AMRDATA', 'amrdata'), - self.define_from_variant('ENABLE_PARTICLES', 'particles'), - self.define_from_variant('ENABLE_SUNDIALS', 'sundials'), - self.define_from_variant('ENABLE_HDF5', 'hdf5'), - self.define_from_variant('ENABLE_HYPRE', 'hypre'), - self.define_from_variant('ENABLE_PETSC', 'petsc'), - self.define_from_variant('ENABLE_CUDA', 'cuda'), - ] - - if self.spec.satisfies('%fj'): - args.append('-DCMAKE_Fortran_MODDIR_FLAG=-M') - - if '+cuda' in self.spec: - cuda_arch = self.spec.variants['cuda_arch'].value - args.append('-DCUDA_ARCH=' + self.get_cuda_arch_string(cuda_arch)) - - return args - # # For versions > 20.11 # - @when('@20.12:') + @when('@20.12:,develop') def cmake_args(self): args = [ '-DUSE_XSDK_DEFAULTS=ON', @@ -212,3 +178,39 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage): args.append('-DAMReX_AMD_ARCH=' + ';'.join(str(x) for x in targets)) return args + + # + # For versions <= 20.11 + # + @when('@:20.11') + def cmake_args(self): + args = [ + '-DUSE_XSDK_DEFAULTS=ON', + self.define_from_variant('DIM', 'dimensions'), + self.define_from_variant('BUILD_SHARED_LIBS', 'shared'), + self.define_from_variant('ENABLE_MPI', 'mpi'), + self.define_from_variant('ENABLE_OMP', 'openmp'), + '-DXSDK_PRECISION:STRING=%s' % + self.spec.variants['precision'].value.upper(), + self.define_from_variant('XSDK_ENABLE_Fortran', 'fortran'), + self.define_from_variant('ENABLE_FORTRAN_INTERFACES', 'fortran'), + self.define_from_variant('ENABLE_EB', 'eb'), + self.define_from_variant('ENABLE_LINEAR_SOLVERS', + 'linear_solvers'), + self.define_from_variant('ENABLE_AMRDATA', 'amrdata'), + self.define_from_variant('ENABLE_PARTICLES', 'particles'), + self.define_from_variant('ENABLE_SUNDIALS', 'sundials'), + self.define_from_variant('ENABLE_HDF5', 'hdf5'), + self.define_from_variant('ENABLE_HYPRE', 'hypre'), + self.define_from_variant('ENABLE_PETSC', 'petsc'), + self.define_from_variant('ENABLE_CUDA', 'cuda'), + ] + + if self.spec.satisfies('%fj'): + args.append('-DCMAKE_Fortran_MODDIR_FLAG=-M') + + if '+cuda' in self.spec: + cuda_arch = self.spec.variants['cuda_arch'].value + args.append('-DCUDA_ARCH=' + self.get_cuda_arch_string(cuda_arch)) + + return args -- cgit v1.2.3-70-g09d2