mfem: add logic for the C++ standard level when using rocPRIM (#47751)

This commit is contained in:
Veselin Dobrev 2024-11-25 01:13:22 -08:00 committed by GitHub
parent cd8c46e54e
commit 347ec87fc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -361,6 +361,8 @@ class Mfem(Package, CudaPackage, ROCmPackage):
# MUMPS (and SuiteSparse in older versions). On the other hand, PETSc built # MUMPS (and SuiteSparse in older versions). On the other hand, PETSc built
# with MUMPS is not strictly required, so we do not require it here. # with MUMPS is not strictly required, so we do not require it here.
depends_on("petsc@3.8:+mpi+hypre", when="+petsc") depends_on("petsc@3.8:+mpi+hypre", when="+petsc")
# rocPRIM is a dependency when using petsc+rocm and requires C++14 or newer:
conflicts("cxxstd=11", when="^rocprim@5.5.0:")
depends_on("slepc@3.8.0:", when="+slepc") depends_on("slepc@3.8.0:", when="+slepc")
# If petsc is built with +cuda, propagate cuda_arch to petsc and slepc # If petsc is built with +cuda, propagate cuda_arch to petsc and slepc
for sm_ in CudaPackage.cuda_arch_values: for sm_ in CudaPackage.cuda_arch_values:
@ -635,6 +637,9 @@ def find_optional_library(name, prefix):
cxxstd = "14" cxxstd = "14"
if self.spec.satisfies("^ginkgo"): if self.spec.satisfies("^ginkgo"):
cxxstd = "14" cxxstd = "14"
# When rocPRIM is used (e.g. by PETSc + ROCm) we need C++14:
if self.spec.satisfies("^rocprim@5.5.0:"):
cxxstd = "14"
cxxstd_req = spec.variants["cxxstd"].value cxxstd_req = spec.variants["cxxstd"].value
if cxxstd_req != "auto": if cxxstd_req != "auto":
# Constraints for valid standard level should be imposed during # Constraints for valid standard level should be imposed during