From d355880110ce66552f6d458accc52a125d4a47a3 Mon Sep 17 00:00:00 2001 From: Giuseppe Congiu Date: Wed, 23 Aug 2023 10:09:54 +0200 Subject: PAPI misc fixes (#39191) Spack installs the hsa-rocr-dev and rocprofiler packages into different directories. However, PAPI typically expects those to be under the same directory and locates such directory through the PAPI_ROCM_ROOT env variable. The PAPI rocm component also allows users to override PAPI_ROCM_ROOT to locate directly the librocprofiler64.so through the HSA_TOOLS_LIB env variable that acts directly onto the HSA runtime tools mechanism. Hence, in order to account for the decoupling of hsa and rocprofiler, this patch sets HSA_TOOLS_LIB to librocprofiler64.so full path. --- var/spack/repos/builtin/packages/papi/package.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/papi/package.py b/var/spack/repos/builtin/packages/papi/package.py index 768196a3da..feacc7e916 100644 --- a/var/spack/repos/builtin/packages/papi/package.py +++ b/var/spack/repos/builtin/packages/papi/package.py @@ -54,6 +54,7 @@ class Papi(AutotoolsPackage, ROCmPackage): variant("shared", default=True, description="Build shared libraries") # PAPI requires building static libraries, so there is no "static" variant variant("static_tools", default=False, description="Statically link the PAPI tools") + variant("debug", default=False, description="Enable debug symbols in PAPI") # The PAPI configure option "--with-shlib-tools" is deprecated # and therefore not implemented here @@ -90,6 +91,7 @@ class Papi(AutotoolsPackage, ROCmPackage): 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.set( "ROCP_METRICS", "%s/rocprofiler/lib/metrics.xml" % spec["rocprofiler-dev"].prefix @@ -97,9 +99,6 @@ class Papi(AutotoolsPackage, ROCmPackage): env.set("ROCPROFILER_LOG", "1") env.set("HSA_VEN_AMD_AQLPROFILE_LOG", "1") env.set("AQLPROFILE_READ_API", "1") - # Setting HSA_TOOLS_LIB=librocprofiler64.so (as recommended) doesn't work - # due to a conflict between the spack and system-installed versions. - env.set("HSA_TOOLS_LIB", "unset") if "+rocm_smi" in spec: env.append_flags("CFLAGS", "-I%s/rocm_smi" % spec["rocm-smi-lib"].prefix.include) # @@ -146,6 +145,9 @@ class Papi(AutotoolsPackage, ROCmPackage): if "+static_tools" in spec: options.append("--with-static-tools") + if "+debug" in spec: + options.append("--with-debug=yes") + return options @run_before("configure") -- cgit v1.2.3-70-g09d2