From 431a0ed64c5adb90a1682b37693ffe74edc47b1a Mon Sep 17 00:00:00 2001 From: Ahmad Nawab Date: Thu, 26 Sep 2024 13:19:40 +0000 Subject: [PATCH 1/2] Propagate acc link flags via target_link_options --- src/ecwam/CMakeLists.txt | 3 ++- src/programs/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ecwam/CMakeLists.txt b/src/ecwam/CMakeLists.txt index 78c1e0868..2722bef37 100644 --- a/src/ecwam/CMakeLists.txt +++ b/src/ecwam/CMakeLists.txt @@ -454,7 +454,8 @@ ecwam_target_fortran_module_directory( INSTALL_DIRECTORY module/${ecwam} ) -if( HAVE_ACC ) +if( HAVE_ACC AND CMAKE_Fortran_COMPILER_ID MATCHES "PGI|NVHPC") + target_link_options( ${ecwam} INTERFACE SHELL:${OpenACC_Fortran_FLAGS} ) target_compile_options( ${ecwam} PRIVATE "-gpu=maxregcount:128" ) endif() diff --git a/src/programs/CMakeLists.txt b/src/programs/CMakeLists.txt index 53757729a..7c334b0dc 100644 --- a/src/programs/CMakeLists.txt +++ b/src/programs/CMakeLists.txt @@ -17,7 +17,7 @@ foreach( program ecbuild_add_executable( TARGET ${PROJECT_NAME}-${program} SOURCES ${program}.F90 - LIBS ${PROJECT_NAME} ${OpenMP_Fortran_LIBRARIES} $<${HAVE_ACC}:OpenACC::OpenACC_Fortran> + LIBS ${PROJECT_NAME} ${OpenMP_Fortran_LIBRARIES} LINKER_LANGUAGE Fortran ) ecwam_target_compile_definitions_FILENAME(${PROJECT_NAME}-${program}) From 81aa83850821a68a8fcf64034b1d457cfffef3db Mon Sep 17 00:00:00 2001 From: Ahmad Nawab Date: Tue, 1 Oct 2024 10:05:16 +0000 Subject: [PATCH 2/2] LOKI: change default mode to scc-stack --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0918eb25c..c7d1dbc71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,7 @@ ecbuild_add_option( FEATURE LOKI REQUIRED_PACKAGES "loki" ) # Set default Loki transformation mode -set( LOKI_MODE "scc-hoist" CACHE STRING "Transformation mode for Loki source transformations" ) +set( LOKI_MODE "scc-stack" CACHE STRING "Transformation mode for Loki source transformations" ) ### OpenACC if( ${CMAKE_VERSION} VERSION_LESS "3.25" AND HAVE_LOKI AND NOT LOKI_MODE MATCHES "idem|idem-stack" )