From b34e31dbfffac43a2418074d5887394a3bf80e1a Mon Sep 17 00:00:00 2001 From: Yifei Wu Date: Wed, 3 Sep 2025 18:29:32 -0700 Subject: [PATCH] add nvfortran cmake flags --- cmake/compiler_flags_NVHPC_Fortran.cmake | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 cmake/compiler_flags_NVHPC_Fortran.cmake diff --git a/cmake/compiler_flags_NVHPC_Fortran.cmake b/cmake/compiler_flags_NVHPC_Fortran.cmake new file mode 100644 index 000000000..5acb011bd --- /dev/null +++ b/cmake/compiler_flags_NVHPC_Fortran.cmake @@ -0,0 +1,41 @@ +#################################################################### +# FLAGS COMMON TO ALL BUILD TYPES +#################################################################### + +set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + +#################################################################### +# RELEASE FLAGS +#################################################################### + +set( CMAKE_Fortran_FLAGS_RELEASE "-O2 -gopt -mp -Munroll -Minline" ) + +#################################################################### +# DEBUG FLAGS +#################################################################### + +set( CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -Mbounds -Mchkstk -traceback -mp" ) + +#################################################################### +# BIT REPRODUCIBLE FLAGS +#################################################################### + +set( CMAKE_Fortran_FLAGS_BIT "-O2 -gopt -Munroll -Minline" ) + +#################################################################### +# LINK FLAGS +#################################################################### + +set( CMAKE_Fortran_LINK_FLAGS "-mp" ) + +#################################################################### + +# Meaning of flags +# ---------------- +# -mp : Enable OpenMP parallelization +# -gopt : Generate optimization information +# -Munroll : Unroll loops for better performance +# -Minline : Enable function inlining +# -Mbounds : Array bounds checking +# -Mchkstk : Check for stack overflow +# -traceback : Enable traceback on runtime errors \ No newline at end of file