From 327a7a4031a3ebc672484fcf1ca1186074eeb44d Mon Sep 17 00:00:00 2001 From: "Wileam Y. Phan" <50928756+wyphan@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:58:06 -0500 Subject: Add PAPI 7.0.1 and 7.1.0 (#38443) * 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 0db3df4fe2874cea7d0e31fee1709246db668499. * 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 --- .../packages/papi/intel-cray-freeform.patch | 43 ++++++++++++++++++++++ var/spack/repos/builtin/packages/papi/package.py | 9 ++++- .../builtin/packages/papi/spack-hip-path.patch | 30 +++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 var/spack/repos/builtin/packages/papi/intel-cray-freeform.patch create mode 100644 var/spack/repos/builtin/packages/papi/spack-hip-path.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/papi/intel-cray-freeform.patch b/var/spack/repos/builtin/packages/papi/intel-cray-freeform.patch new file mode 100644 index 0000000000..518c2e3d3c --- /dev/null +++ b/var/spack/repos/builtin/packages/papi/intel-cray-freeform.patch @@ -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 \ diff --git a/var/spack/repos/builtin/packages/papi/package.py b/var/spack/repos/builtin/packages/papi/package.py index feacc7e916..afb85eca89 100644 --- a/var/spack/repos/builtin/packages/papi/package.py +++ b/var/spack/repos/builtin/packages/papi/package.py @@ -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") @@ -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") @@ -80,6 +84,8 @@ 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" @@ -87,12 +93,13 @@ class Papi(AutotoolsPackage, ROCmPackage): 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 ) diff --git a/var/spack/repos/builtin/packages/papi/spack-hip-path.patch b/var/spack/repos/builtin/packages/papi/spack-hip-path.patch new file mode 100644 index 0000000000..827d99dd19 --- /dev/null +++ b/var/spack/repos/builtin/packages/papi/spack-hip-path.patch @@ -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 -- cgit v1.2.3-60-g2f50