Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ project(FMS
DESCRIPTION "GFDL FMS Library"
HOMEPAGE_URL "https://www.gfdl.noaa.gov/fms"
LANGUAGES C Fortran)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(GNUInstallDirs)

if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
Expand Down Expand Up @@ -67,6 +67,11 @@ option(LARGEFILE "Enable compiler definition -Duse_LARGEFILE"
option(WITH_YAML "Enable compiler definition -Duse_yaml" OFF)
option(USE_DEPRECATED_IO "THIS OPTION HAS NO EFFECT AND WILL BE REMOVED IN A FUTURE RELEASE" OFF)

if(CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC")
# it seems nvidia does not support quad prec
set(ENABLE_QUAD_PRECISION OFF)
endif()

if(32BIT)
list(APPEND kinds "r4")
endif()
Expand Down Expand Up @@ -332,6 +337,7 @@ foreach(kind ${kinds})
mosaic2/include
constants
astronomy/include
field_manager/
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When building with nvhpc it could not find parse.inc which is here

field_manager/include
time_interp/include
tracer_manager/include
Expand Down
6 changes: 6 additions & 0 deletions cmake/compiler_flags_NVHPC_C.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# NVHPC C
set(CMAKE_C_FLAGS_RELEASE "-O3")

set(CMAKE_C_FLAGS_DEBUG "-O0 -g")

set(CMAKE_C_LINK_FLAGS "")
13 changes: 13 additions & 0 deletions cmake/compiler_flags_NVHPC_Fortran.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Precision-based Fortran compiler flags
set(r8_flags "-r8") # Fortran flags for 64BIT precision

# NVHPC Fortan
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ")

set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -fast")

set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -Ktrap=fp" )
# -g can cause bugs, see: https://forums.developer.nvidia.com/t/bug-compiling-with-g-o0-produces-a-compute-sanitizer-error-removing-g-removes-the-error/341478
# not sure if this is only on GPUs

set(CMAKE_Fortran_LINK_FLAGS "" )
4 changes: 4 additions & 0 deletions cmake/fms_compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
include(compiler_flags_Intel_Fortran)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
include(compiler_flags_IntelLLVM_Fortran)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC")
include(compiler_flags_NVHPC_Fortran)
else()
message(WARNING "Fortran compiler with ID ${CMAKE_Fortran_COMPILER_ID} will be used with CMake default options")
endif()
Expand All @@ -24,6 +26,8 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
include(compiler_flags_IntelLLVM_C)
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
include(compiler_flags_Clang_C)
elseif(CMAKE_C_COMPILER_ID MATCHES "NVHPC")
include(compiler_flags_NVHPC_C)
else()
message(WARNING "C compiler with ID ${CMAKE_C_COMPILER_ID} will be used with CMake default options")
endif()
Loading