Skip to content

Commit

Permalink
Fixes for NAG. (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
DJDavies2 authored Mar 5, 2024
1 parent 5589722 commit f797633
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 27 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ include_directories( ${IODA_INCLUDE_DIRS} )
find_package( oops REQUIRED )
include_directories( ${OOPS_INCLUDE_DIRS} )

find_package(SHUM REQUIRED)
include_directories( ${SHUM_INCLUDE_DIR} )

################################################################################
# Export package info
################################################################################
Expand Down
9 changes: 9 additions & 0 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ ${CMAKE_Fortran_FLAGS}"
-check format \
-check pointers \
-check uninit \
${CMAKE_Fortran_DEBUG_FLAGS}"
)
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "NAG")
set(OPS_DEFAULT_Fortran_FLAGS "\
-double \
${CMAKE_Fortran_FLAGS}"
#-Wp,-P \
)
set(CMAKE_Fortran_DEBUG_FLAGS "\
${CMAKE_Fortran_DEBUG_FLAGS}"
)
endif()
Expand Down
29 changes: 21 additions & 8 deletions deps/gcom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ endif()

set(CMAKE_Fortran_FLAGS "\
${OPS_DEFAULT_Fortran_FLAGS} \
${GCOM_EXTRA_Fortran_FLAGS} \
${CMAKE_Fortran_FLAGS}")
${GCOM_EXTRA_Fortran_FLAGS}")

set(GCOM_SOURCE_FILES
gc/gc__abort.c
Expand Down Expand Up @@ -213,9 +212,16 @@ set(GCOM_SOURCE_DIRS

# Setup the parallel version of the gcom library

ecbuild_add_library(
TARGET gcom
SOURCES ${GCOM_SOURCE_FILES})
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "NAG")
ecbuild_add_library(
TARGET gcom
SOURCES ${GCOM_SOURCE_FILES}
LINKER_LANGUAGE CXX)
else()
ecbuild_add_library(
TARGET gcom
SOURCES ${GCOM_SOURCE_FILES})
endif()

target_compile_definitions(gcom PRIVATE
GC_VERSION="'7.2'"
Expand All @@ -240,9 +246,16 @@ target_include_directories(gcom

# Setup the serial version of the gcom library

ecbuild_add_library(
TARGET gcom_serial
SOURCES ${GCOM_SOURCE_FILES})
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "NAG")
ecbuild_add_library(
TARGET gcom_serial
SOURCES ${GCOM_SOURCE_FILES}
LINKER_LANGUAGE CXX)
else()
ecbuild_add_library(
TARGET gcom_serial
SOURCES ${GCOM_SOURCE_FILES})
endif()

# For the serial version, skip the MPI_SRC symbol...
target_compile_definitions(gcom_serial PRIVATE
Expand Down
16 changes: 11 additions & 5 deletions deps/odb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@ endif()

set(CMAKE_Fortran_FLAGS "\
${OPS_DEFAULT_Fortran_FLAGS} \
${ODB_EXTRA_Fortran_FLAGS} \
${CMAKE_Fortran_FLAGS}")
${ODB_EXTRA_Fortran_FLAGS}")

set(ODB_SOURCE_FILES
stubs/parkind1.F90
stubs/yomhook.F90
)

ecbuild_add_library(
TARGET odb
SOURCES ${ODB_SOURCE_FILES})
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "NAG")
ecbuild_add_library(
TARGET odb
SOURCES ${ODB_SOURCE_FILES}
LINKER_LANGUAGE CXX)
else()
ecbuild_add_library(
TARGET odb
SOURCES ${ODB_SOURCE_FILES})
endif()

get_target_property(ODB_Fortran_MODULE_DIRECTORY odb Fortran_MODULE_DIRECTORY)

Expand Down
56 changes: 42 additions & 14 deletions deps/ops/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ endif()

set(CMAKE_Fortran_FLAGS "\
${OPS_DEFAULT_Fortran_FLAGS} \
${OPS_EXTRA_Fortran_FLAGS} \
${CMAKE_Fortran_FLAGS}")
${OPS_EXTRA_Fortran_FLAGS}")

set(OPS_SOURCE_FILES
code/GenMod_ModelIO/GenMod_ModelIO.F90
Expand Down Expand Up @@ -111,6 +110,7 @@ foreach (file ${OPS_SOURCE_FILES})
list(APPEND OPS_SOURCE_DIRS "${dir}")
endforeach()
list(REMOVE_DUPLICATES OPS_SOURCE_DIRS)
include_directories( ${OPS_SOURCE_DIRS} )

# Find extra dependencies

Expand All @@ -119,8 +119,14 @@ find_package(SHUM REQUIRED)

# Setup the parallel version of the ops library

ecbuild_add_library(TARGET ops
SOURCES ${OPS_SOURCE_FILES})
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "NAG")
ecbuild_add_library(TARGET ops
SOURCES ${OPS_SOURCE_FILES}
LINKER_LANGUAGE CXX)
else()
ecbuild_add_library(TARGET ops
SOURCES ${OPS_SOURCE_FILES})
endif()

target_compile_definitions(ops PRIVATE
EXTERNAL_GCOM
Expand Down Expand Up @@ -163,8 +169,14 @@ target_include_directories(ops

# Setup the serial version of the ops library, linked to gcom_serial

ecbuild_add_library(TARGET ops_serial
SOURCES ${OPS_SOURCE_FILES})
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "NAG")
ecbuild_add_library(TARGET ops_serial
SOURCES ${OPS_SOURCE_FILES}
LINKER_LANGUAGE CXX)
else()
ecbuild_add_library(TARGET ops_serial
SOURCES ${OPS_SOURCE_FILES})
endif()

target_compile_definitions(ops_serial PRIVATE
EXTERNAL_GCOM
Expand Down Expand Up @@ -212,16 +224,32 @@ target_include_directories(ops_serial

set(CMAKE_EXECUTABLE_SUFFIX .exe)

ecbuild_add_executable(TARGET OpsProg_PrintCXFile
SOURCES
code/OpsProg_Utils/OpsMod_PrintCX.f90
code/OpsProg_Utils/OpsProg_PrintCXFile.F90)
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "NAG")
ecbuild_add_executable(TARGET OpsProg_PrintCXFile
SOURCES
code/OpsProg_Utils/OpsMod_PrintCX.f90
code/OpsProg_Utils/OpsProg_PrintCXFile.F90
LINKER_LANGUAGE CXX)
else()
ecbuild_add_executable(TARGET OpsProg_PrintCXFile
SOURCES
code/OpsProg_Utils/OpsMod_PrintCX.f90
code/OpsProg_Utils/OpsProg_PrintCXFile.F90)
endif()
target_link_libraries(OpsProg_PrintCXFile
PRIVATE ops_serial)

ecbuild_add_executable(TARGET OpsProg_PrintVarobs
SOURCES
code/OpsProg_Utils/OpsMod_PrintVarobs.f90
code/OpsProg_Utils/OpsProg_PrintVarobs.F90)
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "NAG")
ecbuild_add_executable(TARGET OpsProg_PrintVarobs
SOURCES
code/OpsProg_Utils/OpsMod_PrintVarobs.f90
code/OpsProg_Utils/OpsProg_PrintVarobs.F90
LINKER_LANGUAGE CXX)
else()
ecbuild_add_executable(TARGET OpsProg_PrintVarobs
SOURCES
code/OpsProg_Utils/OpsMod_PrintVarobs.f90
code/OpsProg_Utils/OpsProg_PrintVarobs.F90)
endif()
target_link_libraries(OpsProg_PrintVarobs
PRIVATE ops_serial)
2 changes: 2 additions & 0 deletions src/opsinputs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
set(FORTRAN_FLAGS_64_BIT_TYPES "-fdefault-real-8 -fdefault-integer-8")
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
set(FORTRAN_FLAGS_64_BIT_TYPES "-integer-size 64 -real-size 64")
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "NAG")
set(FORTRAN_FLAGS_64_BIT_TYPES "-double")
endif()
set_source_files_properties(opsinputs_cxgenerate_mod.F90 PROPERTIES
COMPILE_FLAGS "${FORTRAN_FLAGS_64_BIT_TYPES}")
Expand Down

0 comments on commit f797633

Please sign in to comment.