From 576be3285e6528625048b329d7a483b331b52d2e Mon Sep 17 00:00:00 2001 From: Purnendu Chakraborty Date: Sat, 24 Jun 2023 14:11:17 -0400 Subject: [PATCH 1/2] Added link flags for GPU Physics (OpenACC) --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42f35741..d7d6e422 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,12 @@ ecbuild_add_executable ( SOURCES GEOSgcm.F90 LIBS GEOSgcm_GridComp esmf OpenMP::OpenMP_Fortran ) +if (GPU_PHYSICS) + target_link_libraries ( + GEOSgcm.x + -fopenacc -foffload="-lgfortran -lgomp -lm" -foffload=nvptx-none + ) +endif () ecbuild_add_executable ( TARGET idfupd.x From 60b5122b262682f2654f5234e43a6dabcdba430b Mon Sep 17 00:00:00 2001 From: Purnendu Chakraborty Date: Fri, 30 Jun 2023 20:29:45 -0400 Subject: [PATCH 2/2] Using variables instead of hardcoding flags --- CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7d6e422..138ac755 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,6 @@ ecbuild_add_executable ( SOURCES GEOSgcm.F90 LIBS GEOSgcm_GridComp esmf OpenMP::OpenMP_Fortran ) -if (GPU_PHYSICS) - target_link_libraries ( - GEOSgcm.x - -fopenacc -foffload="-lgfortran -lgomp -lm" -foffload=nvptx-none - ) -endif () ecbuild_add_executable ( TARGET idfupd.x @@ -17,6 +11,10 @@ ecbuild_add_executable ( ) set (CMAKE_Fortran_FLAGS_RELEASE "${GEOS_Fortran_FLAGS_VECT}") +if (GPU_PHYSICS) + set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${GEOS_Fortran_OpenACC_Flags_Offload_Libs}") + set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${GEOS_Fortran_OpenACC_Flags_Offload_Libs}") +endif () file (GLOB templates CONFIGURE_DEPENDS *.tmpl)