From 22d35a4d09293de49d3daf7e8746fa28a639ddeb Mon Sep 17 00:00:00 2001 From: Ruipeng Li Date: Fri, 15 Jul 2022 23:28:00 -0700 Subject: [PATCH] Backward compatible ROCm header update. (#680) Backward compatible update to rocm header include path. Co-authored-by: Paul T. Bauman --- src/config/configure.in | 10 +++------- src/configure | 7 +------ src/utilities/_hypre_utilities.hpp | 2 +- src/utilities/device_utils.h | 2 +- src/utilities/nvtx.c | 2 +- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/config/configure.in b/src/config/configure.in index c1b82ed28..9152229b8 100644 --- a/src/config/configure.in +++ b/src/config/configure.in @@ -2365,10 +2365,10 @@ AS_IF([test x"$hypre_using_hip" == x"yes"], CUFLAGS="${HIPCPPFLAGS} ${HIPCXXFLAGS}" fi - dnl rocThrust depends on rocPrim so we need both for Thrust on AMD GPUs. + dnl PB: ROCm 5.2 parked all the headers in /opt/rocm-X.Y/include so we just point there. + dnl This is backwards compatible to previous ROCm versions. dnl These are header-only so no linking needed. - HYPRE_HIP_INCL="-I${HYPRE_ROCM_PREFIX}/rocthrust/include" - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocprim/include" + HYPRE_HIP_INCL="-I${HYPRE_ROCM_PREFIX}/include" dnl HIP library HYPRE_HIP_LIBS="-L${HYPRE_ROCM_PREFIX}/lib -lamdhip64" @@ -2377,7 +2377,6 @@ AS_IF([test x"$hypre_using_hip" == x"yes"], AS_IF([test x"$hypre_using_rocsparse" == x"yes"], [AC_DEFINE(HYPRE_USING_ROCSPARSE, 1, [rocSPARSE being used]) HYPRE_HIP_LIBS="${HYPRE_HIP_LIBS} -lrocsparse" - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocsparse/include" ]) dnl Note rocSPARSE requires rocBLAS, so this is only controlling @@ -2385,20 +2384,17 @@ AS_IF([test x"$hypre_using_hip" == x"yes"], dnl So we don't need to add any extra libs or anything. AS_IF([test x"$hypre_using_rocblas" == x"yes"], [AC_DEFINE(HYPRE_USING_ROCBLAS, 1, [rocBLAS being used]) - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocblas/include" ]) dnl rocRAND: random number generation on AMD GPUs AS_IF([test x"$hypre_using_rocrand" == x"yes"], [AC_DEFINE(HYPRE_USING_ROCRAND, 1, [rocRAND being used]) HYPRE_HIP_LIBS="${HYPRE_HIP_LIBS} -lrocrand" - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocrand/include" ]) dnl rocTX tracing API AS_IF([test x"$hypre_using_gpu_profiling" == x"yes"], [AC_DEFINE(HYPRE_USING_ROCTX, 1, [Define to 1 if using AMD rocTX profiling]) - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/roctracer/include" HYPRE_HIP_LIBS="${HYPRE_HIP_LIBS} -lroctx64" ]) diff --git a/src/configure b/src/configure index f9d911d6a..a8d573619 100755 --- a/src/configure +++ b/src/configure @@ -9282,8 +9282,7 @@ fi CUFLAGS="${HIPCPPFLAGS} ${HIPCXXFLAGS}" fi - HYPRE_HIP_INCL="-I${HYPRE_ROCM_PREFIX}/rocthrust/include" - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocprim/include" + HYPRE_HIP_INCL="-I${HYPRE_ROCM_PREFIX}/include" HYPRE_HIP_LIBS="-L${HYPRE_ROCM_PREFIX}/lib -lamdhip64" @@ -9292,7 +9291,6 @@ fi $as_echo "#define HYPRE_USING_ROCSPARSE 1" >>confdefs.h HYPRE_HIP_LIBS="${HYPRE_HIP_LIBS} -lrocsparse" - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocsparse/include" fi @@ -9300,7 +9298,6 @@ fi $as_echo "#define HYPRE_USING_ROCBLAS 1" >>confdefs.h - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocblas/include" fi @@ -9309,7 +9306,6 @@ fi $as_echo "#define HYPRE_USING_ROCRAND 1" >>confdefs.h HYPRE_HIP_LIBS="${HYPRE_HIP_LIBS} -lrocrand" - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocrand/include" fi @@ -9317,7 +9313,6 @@ fi $as_echo "#define HYPRE_USING_ROCTX 1" >>confdefs.h - HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/roctracer/include" HYPRE_HIP_LIBS="${HYPRE_HIP_LIBS} -lroctx64" fi diff --git a/src/utilities/_hypre_utilities.hpp b/src/utilities/_hypre_utilities.hpp index 6a7f87c90..4a6316077 100644 --- a/src/utilities/_hypre_utilities.hpp +++ b/src/utilities/_hypre_utilities.hpp @@ -119,7 +119,7 @@ using hypre_DeviceItem = void*; #endif #if defined(HYPRE_USING_ROCRAND) -#include +#include #endif #endif // defined(HYPRE_USING_HIP) diff --git a/src/utilities/device_utils.h b/src/utilities/device_utils.h index c66748ce8..e8d123156 100644 --- a/src/utilities/device_utils.h +++ b/src/utilities/device_utils.h @@ -62,7 +62,7 @@ using hypre_DeviceItem = void*; #endif #if defined(HYPRE_USING_ROCRAND) -#include +#include #endif #endif // defined(HYPRE_USING_HIP) diff --git a/src/utilities/nvtx.c b/src/utilities/nvtx.c index 54c13564c..abd7851f1 100644 --- a/src/utilities/nvtx.c +++ b/src/utilities/nvtx.c @@ -9,7 +9,7 @@ #if defined(HYPRE_USING_ROCTX) #include "hip/hip_runtime_api.h" -#include "roctx.h" +#include "roctracer/roctx.h" #endif #if defined(HYPRE_USING_NVTX)