diff --git a/.github/tools/install-nvhpc.sh b/.github/tools/install-nvhpc.sh index 8a8f332..1d9fa83 100755 --- a/.github/tools/install-nvhpc.sh +++ b/.github/tools/install-nvhpc.sh @@ -12,7 +12,7 @@ # See for # details. -version=21.9 +version=24.3 TEMPORARY_FILES="${TMPDIR:-/tmp}" export NVHPC_INSTALL_DIR=$(pwd)/nvhpc-install @@ -55,8 +55,8 @@ if [ -d "${NVHPC_INSTALL_DIR}" ]; then fi fi -# Example download URL for version 21.9 -# https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2020_219_Linux_x86_64_cuda_11.0.tar.gz +# Example download URL for version 24.3 +# https://developer.download.nvidia.com/hpc-sdk/24.3/nvhpc_2020_219_Linux_x86_64_cuda_11.0.tar.gz ver="$(echo $version | tr -d . )" URL=$(curl -s "https://developer.nvidia.com/nvidia-hpc-sdk-$ver-downloads" | grep -oP "https://developer.download.nvidia.com/hpc-sdk/([0-9]{2}\.[0-9]+)/nvhpc_([0-9]{4})_([0-9]+)_Linux_$(uname -m)_cuda_([0-9\.]+).tar.gz" | sort | tail -1) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6903d48..819663b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,11 +49,21 @@ ecbuild_add_option( FEATURE WARNINGS DEFAULT ON DESCRIPTION "Add warnings to compiler" ) +if(CMAKE_C_COMPILER_ID STREQUAL "PGI" OR CMAKE_C_COMPILER_ID STREQUAL "NVHPC" ) + set (DEFAULT_DR_NVTX ON) +else () + set (DEFAULT_DR_NVTX OFF) +endif () + +ecbuild_add_option( FEATURE DR_NVTX + DEFAULT ${DEFAULT_DR_NVTX} + DESCRIPTION "Add nvtx intrumentation" ) + ecbuild_find_package( NAME Realtime QUIET ) #### -if(CMAKE_C_COMPILER_ID STREQUAL "PGI" OR CMAKE_C_COMPILER_ID STREQUAL "NVHPC" ) +if(HAVE_DR_NVTX) find_package(CUDAToolkit REQUIRED COMPONENTS nvtx3) find_package(NVHPC REQUIRED COMPONENTS HOSTUTILS) diff --git a/src/fiat/CMakeLists.txt b/src/fiat/CMakeLists.txt index a59fc38..6995d54 100644 --- a/src/fiat/CMakeLists.txt +++ b/src/fiat/CMakeLists.txt @@ -44,10 +44,11 @@ endif() configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/library/version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c @ONLY ) ecbuild_list_add_pattern( LIST fiat_src GLOB *.c *.F* *.cc ) -if(NOT (CMAKE_C_COMPILER_ID STREQUAL "PGI" OR CMAKE_C_COMPILER_ID STREQUAL "NVHPC" )) - # The files in the dr_nvtx directory are only intended to work with NVHPC - # So don't try to compile them when using another compiler - ecbuild_list_exclude_pattern( LIST fiat_src REGEX dr_nvtx/* ) + +if( NOT HAVE_DR_NVTX) + # The files in the drnvtx directory are only intended to work with NVHPC + # So don't try to compile them when using another compiler + ecbuild_list_exclude_pattern( LIST fiat_src REGEX drnvtx/* ) endif() set( fiat_src ${fiat_src} PARENT_SCOPE ) @@ -74,7 +75,7 @@ ecbuild_add_library( TARGET fiat ## if compiler is pgi add two libs -if(CMAKE_C_COMPILER_ID STREQUAL "PGI" OR CMAKE_C_COMPILER_ID STREQUAL "NVHPC" ) +if (HAVE_DR_NVTX) target_link_libraries(fiat PUBLIC ${NVTOOLSEXT_LIB}) target_link_libraries(fiat PUBLIC ${NVHPCWRAPNVTX_LIB}) target_include_directories(fiat PRIVATE "${CUDAToolkit_LIBRARY_DIR}/../include") diff --git a/src/fiat/drhook/internal/dr_hook_util.F90 b/src/fiat/drhook/internal/dr_hook_util.F90 index 4c33376..010741e 100644 --- a/src/fiat/drhook/internal/dr_hook_util.F90 +++ b/src/fiat/drhook/internal/dr_hook_util.F90 @@ -13,7 +13,7 @@ SUBROUTINE DR_HOOK_UTIL(LDHOOK,CDNAME,KCASE,PKEY,CDFILENAME,KSIZEINFO) USE OML_MOD , ONLY : OML_MY_THREAD USE YOMHOOK , ONLY : LHOOK USE DR_HACK_MOD, ONLY : LL_DRHACK, DR_HACK_INIT, DR_HACK -#ifdef __PGI +#ifdef HAVE_DR_NVTX USE NVTX USE DR_NVTX #endif @@ -37,13 +37,13 @@ SUBROUTINE DR_HOOK_UTIL(LDHOOK,CDNAME,KCASE,PKEY,CDFILENAME,KSIZEINFO) #include "dr_hook_init.intfb.h" -#ifdef __PGI +#ifdef HAVE_DR_NVTX INTEGER, SAVE :: II_DRNVTX = 0 ! 0=no initialized, -1=nvtx off, +1=nvtx on CHARACTER*32 :: CL_NVTX #endif -#ifdef __PGI +#ifdef HAVE_DR_NVTX IF (II_DRNVTX == 0) THEN CALL GETENV ('DR_NVTX', CL_NVTX) IF (CL_NVTX == '1') THEN diff --git a/src/fiat/dr_nvtx/dr_nvtx.F90 b/src/fiat/drnvtx/dr_nvtx.F90 similarity index 100% rename from src/fiat/dr_nvtx/dr_nvtx.F90 rename to src/fiat/drnvtx/dr_nvtx.F90 diff --git a/src/fiat/dr_nvtx/dr_nvtx.c b/src/fiat/drnvtx/dr_nvtx.c similarity index 100% rename from src/fiat/dr_nvtx/dr_nvtx.c rename to src/fiat/drnvtx/dr_nvtx.c diff --git a/src/fiat/dr_nvtx/dr_nvtx_map.cc b/src/fiat/drnvtx/dr_nvtx_map.cc similarity index 100% rename from src/fiat/dr_nvtx/dr_nvtx_map.cc rename to src/fiat/drnvtx/dr_nvtx_map.cc diff --git a/src/fiat/dr_nvtx/dr_nvtx_map.h b/src/fiat/drnvtx/dr_nvtx_map.h similarity index 100% rename from src/fiat/dr_nvtx/dr_nvtx_map.h rename to src/fiat/drnvtx/dr_nvtx_map.h