Skip to content

Commit

Permalink
Add PAPI 7.0.1 and 7.1.0 (spack#38443)
Browse files Browse the repository at this point in the history
* Add PAPI 7.0.1

* Add comment about skipping PAPI 7.0.0

* Add patch to avoid adding Intel ifort/ifx flag on Cray ftn

* Modify patch to include Cray-specific flags

* Adjust recipe to always apply patch for 7.0.1

* Expand Cray compiler checks in patch

* Forgot to update recipe

* Adjust recipe so it looks for hipcc in the correct path

* Revert "Adjust recipe so it looks for hipcc in the correct path"

This reverts commit 0db3df4.

* Patch HIP_PATH to work with Spack-built HIP

* Patch LDFLAGS with llvm-amdgpu path

* Forgot the depends_on line

* libomptarget only builds with clang

* Try a self-consistent build of llvm-amdgpu

* Try making llvm-amdgpu depend on llvm for llvmoffloadarch library

* Update prereq to use rocm-openmp-extras instead

* Refactor llvm-amdgpu to use a version dict

* Fix typo

* Hack to exclude older versions without matching rocm-openmp-extras

* Add PAPI 7.1.0

* Revert changes to llvm-amdgpu

* Fix PAPI 7.1.0 checksum
  • Loading branch information
wyphan authored and RikkiButler20 committed Jan 30, 2024
1 parent 980dab3 commit 8da0320
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
43 changes: 43 additions & 0 deletions var/spack/repos/builtin/packages/papi/intel-cray-freeform.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
diff -Naur papi-7.0.1-orig/src/components/sde/tests/Makefile papi-7.0.1/src/components/sde/tests/Makefile
--- papi-7.0.1-orig/src/components/sde/tests/Makefile 2023-06-19 14:27:44.224943877 -0400
+++ papi-7.0.1/src/components/sde/tests/Makefile 2023-06-19 16:25:16.749303194 -0400
@@ -1,12 +1,17 @@
NAME=sde
include ../../Makefile_comp_tests.target
INCLUDE += -I$(datadir)/sde_lib -I..
+
+intel_compilers := ifort ifx
+cray_compilers := ftn crayftn
ifeq ($(notdir $(F77)),gfortran)
FFLAGS +=-ffree-form -ffree-line-length-none
else ifeq ($(notdir $(F77)),flang)
FFLAGS +=-ffree-form
-else
+else ifneq ($(findstring $(notdir $(F77)),$(intel_compilers)),)
FFLAGS +=-free
+else ifneq ($(findstring $(notdir $(F77)),$(cray_compilers)),)
+ FFLAGS +=-ffree
endif
FFLAGS +=-g
CFLAGS +=-g
diff -Naur papi-7.0.1-orig/src/components/sysdetect/tests/Makefile papi-7.0.1/src/components/sysdetect/tests/Makefile
--- papi-7.0.1-orig/src/components/sysdetect/tests/Makefile 2023-06-19 14:27:44.220943888 -0400
+++ papi-7.0.1/src/components/sysdetect/tests/Makefile 2023-06-19 16:25:43.213238526 -0400
@@ -19,12 +19,16 @@
FTESTS =
endif

+intel_compilers := ifort ifx
+cray_compilers := ftn crayftn
ifeq ($(notdir $(F77)),gfortran)
FFLAGS +=-ffree-form -ffree-line-length-none
else ifeq ($(notdir $(F77)),flang)
FFLAGS +=-ffree-form
-else
+else ifneq ($(findstring $(notdir $(F77)),$(intel_compilers)),)
FFLAGS +=-free
+else ifneq ($(findstring $(notdir $(F77)),$(cray_compilers)),)
+ FFLAGS +=-ffree
endif

TESTS = query_device_simple \
9 changes: 8 additions & 1 deletion var/spack/repos/builtin/packages/papi/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class Papi(AutotoolsPackage, ROCmPackage):
git = "https://github.com/icl-utk-edu/papi"

version("master", branch="master")
version("7.1.0", sha256="950d0e997e9e908f58c103efd54983e905b6cffa75ef52ed8fdd1ab441977bb6")
version("7.0.1", sha256="c105da5d8fea7b113b0741a943d467a06c98db959ce71bdd9a50b9f03eecc43e")
# Note: version 7.0.0 is omitted due to build issues, see PR 33940 for more information
version("6.0.0.1", sha256="3cd7ed50c65b0d21d66e46d0ba34cd171178af4bbf9d94e693915c1aca1e287f")
version("6.0.0", sha256="3442709dae3405c2845b304c06a8b15395ecf4f3899a89ceb4d715103cb4055f")
version("5.7.0", sha256="d1a3bb848e292c805bc9f29e09c27870e2ff4cda6c2fba3b7da8b4bba6547589")
Expand Down Expand Up @@ -63,6 +66,7 @@ class Papi(AutotoolsPackage, ROCmPackage):
depends_on("cuda", when="+nvml")
depends_on("hsa-rocr-dev", when="+rocm")
depends_on("rocprofiler-dev", when="+rocm")
depends_on("llvm-amdgpu +openmp", when="+rocm")
depends_on("rocm-smi-lib", when="+rocm_smi")

conflicts("%gcc@8:", when="@5.3.0", msg="Requires GCC version less than 8.0")
Expand All @@ -80,19 +84,22 @@ class Papi(AutotoolsPackage, ROCmPackage):
)
patch("crayftn-fixes.patch", when="@6.0.0:%cce@9:")
patch("intel-oneapi-compiler-fixes.patch", when="@6.0.0:%oneapi")
patch("intel-cray-freeform.patch", when="@7.0.1")
patch("spack-hip-path.patch", when="@7.0.1")

configure_directory = "src"

def setup_build_environment(self, env):
spec = self.spec
if "+lmsensors" in spec and self.version >= Version("6"):
env.set("PAPI_LMSENSORS_ROOT", spec["lm-sensors"].prefix)
if "^cuda" in spec:
if "+cuda" in spec:
env.set("PAPI_CUDA_ROOT", spec["cuda"].prefix)
if "+rocm" in spec:
env.set("PAPI_ROCM_ROOT", spec["hsa-rocr-dev"].prefix)
env.set("HSA_TOOLS_LIB", "%s/librocprofiler64.so" % spec["rocprofiler-dev"].prefix.lib)
env.append_flags("CFLAGS", "-I%s/rocprofiler/include" % spec["rocprofiler-dev"].prefix)
env.append_flags("LDFLAGS", "-L%s/lib" % spec["llvm-amdgpu"].prefix)
env.set(
"ROCP_METRICS", "%s/rocprofiler/lib/metrics.xml" % spec["rocprofiler-dev"].prefix
)
Expand Down
30 changes: 30 additions & 0 deletions var/spack/repos/builtin/packages/papi/spack-hip-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff -Naur papi-7.0.1-orig/src/components/rocm/tests/Makefile papi-7.0.1/src/components/rocm/tests/Makefile
--- papi-7.0.1-orig/src/components/rocm/tests/Makefile 2023-06-19 14:27:44.220943888 -0400
+++ papi-7.0.1/src/components/rocm/tests/Makefile 2023-06-20 19:09:56.564352488 -0400
@@ -1,9 +1,9 @@
NAME = rocm
include ../../Makefile_comp_tests.target
PAPI_ROCM_ROOT ?= /opt/rocm
-
-CC = $(PAPI_ROCM_ROOT)/hip/bin/hipcc
-CXX = $(PAPI_ROCM_ROOT)/hip/bin/hipcc
+HIP_PATH ?= $(PAPI_ROCM_ROOT)/hip
+CC = $(HIP_PATH)/bin/hipcc
+CXX = $(HIP_PATH)/bin/hipcc
CPPFLAGS+= -I$(PAPI_ROCM_ROOT)/include \
-I$(PAPI_ROCM_ROOT)/include/hip \
-I$(PAPI_ROCM_ROOT)/include/hsa \
diff -Naur papi-7.0.1-orig/src/components/rocm_smi/tests/Makefile papi-7.0.1/src/components/rocm_smi/tests/Makefile
--- papi-7.0.1-orig/src/components/rocm_smi/tests/Makefile 2023-06-19 14:27:44.220943888 -0400
+++ papi-7.0.1/src/components/rocm_smi/tests/Makefile 2023-06-20 19:10:49.383840816 -0400
@@ -4,8 +4,8 @@
NAME=rocm_smi
include ../../Makefile_comp_tests.target
PAPI_ROCM_ROOT ?= /opt/rocm
-HIP_PATH= ${PAPI_ROCM_ROOT}/hip
-HIPCC=$(HIP_PATH)/bin/hipcc
+HIP_PATH ?= $(PAPI_ROCM_ROOT)/hip
+HIPCC = $(HIP_PATH)/bin/hipcc

INCLUDE += -I$(PAPI_ROCM_ROOT)/include
INCLUDE += -I$(PAPI_ROCM_ROOT)/include/rocm_smi

0 comments on commit 8da0320

Please sign in to comment.