Closed balay closed 8 months ago
for now - using:
diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py
index 5fac0860ea..6e14053355 100644
--- a/var/spack/repos/builtin/packages/mfem/package.py
+++ b/var/spack/repos/builtin/packages/mfem/package.py
@@ -258,6 +258,7 @@ class Mfem(Package, CudaPackage, ROCmPackage):
depends_on("mpi", when="+mpi")
depends_on("hipsparse", when="@4.4.0:+rocm")
+ depends_on("rocthrust", when="@4.4.0:+rocm")
depends_on("hypre@2.10.0:2.13", when="@:3.3+mpi")
depends_on("hypre@:2.20.0", when="@3.4:4.2+mpi")
depends_on("hypre@:2.23.0", when="@4.3.0+mpi")
@@ -933,7 +929,8 @@ def find_optional_library(name, prefix):
# hip_libs += find_libraries("libamdhip64", spec["hip"].prefix.lib)
if "^hipsparse" in spec: # hipsparse is needed @4.4.0:+rocm
hipsparse = spec["hipsparse"]
- options += ["HIP_OPT=%s" % hipsparse.headers.cpp_flags]
+ rocthrust = spec["rocthrust"]
+ options += ["HIP_OPT=%s" % hipsparse.headers.cpp_flags +' '+ rocthrust.headers.cpp_flags]
hip_libs += hipsparse.libs
# Note: MFEM's defaults.mk wants to find librocsparse.* in
# $(HIP_DIR)/lib, so we set HIP_DIR to be $ROCM_PATH when using
It looks like rocthrust is needed by PETSc. This probably means that PETSc does not "export" the rocthrust path in its petscvariables
file -- otherwise MFEM will pick it up from there (from the variable PETSC_CC_INCLUDES
). Maybe there is a different variable that MFEM needs to read when PETSc is built with HIP?
Actually, it looks like PETSc is built +shared
in Spack, so the MFEM Spack package configures MFEM to use the headers
property of the petsc
package (and does not use the petscvariables
file). See https://github.com/spack/spack/blob/8c257d55b49857179c10234d2b04782ce1f5c1ff/var/spack/repos/builtin/packages/mfem/package.py#L813-L821.
It may be best to make sure PETSc's Spack package exports the rocthrust
path in its headers
property when needed. If you don't like this solution, we'll have to add it in the MFEM Spack package.
Hm - this is used by hip
sources - and the corresponding flag for use with hipcc is HIPC_FLAGS
- but yeah - I don't see it in pkg config file
@balay, can you try your HIP build with https://github.com/spack/spack/pull/40768 instead of the patch you posted above? Thanks!
@v-dobrev thanks! I see its merged to spack/develop. I've rebased xsdk-1.0.0 branch - and removed my patch.
This build (with hip) does work for me .
Great! Closing the issue then.
spack-build-out.txt