Skip to content

Commit be19966

Browse files
committed
Fixes for NAG CMake
1 parent 2eaf285 commit be19966

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

cmake/fc.cmake

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,31 @@ if (${F_COMPILER} STREQUAL "CRAY")
269269
endif ()
270270
endif ()
271271

272+
if (${F_COMPILER} STREQUAL "NAGFOR")
273+
set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_NAG")
274+
if (INTERFACE64)
275+
set(FCOMMON_OPT "${FCOMMON_OPT} -i8")
276+
endif ()
277+
# Options from Makefile.system
278+
# -dcfuns: Enable non-standard double precision complex intrinsic functions
279+
# -ieee=full: enables all IEEE arithmetic facilities including non-stop arithmetic.
280+
# -w=obs: Suppress warning messages about obsolescent features
281+
# -thread_safe: Compile code for safe execution in a multi-threaded environment.
282+
# -recursive: Specifies that procedures are RECURSIVE by default.
283+
set(FCOMMON_OPT "${FCOMMON_OPT} -dcfuns -recursive -ieee=full -w=obs -thread_safe")
284+
# Options from Reference-LAPACK
285+
# Suppress compiler banner and summary
286+
set(FCOMMON_OPT "${FCOMMON_OPT} -quiet")
287+
# Disable other common warnings
288+
# -w=x77: Suppress warning messages about Fortran 77 features
289+
# -w=ques: Suppress warning messages about questionable usage
290+
# -w=unused: Suppress warning messages about unused variables
291+
set(FCOMMON_OPT "${FCOMMON_OPT} -w=x77 -w=ques -w=unused")
292+
if (USE_OPENMP)
293+
set(FCOMMON_OPT "${FCOMMON_OPT} -openmp")
294+
endif ()
295+
endif ()
296+
272297
# from the root Makefile - this is for lapack-netlib to compile the correct secnd file.
273298
if (${F_COMPILER} STREQUAL "GFORTRAN")
274299
set(TIMER "INT_ETIME")

cmake/lapack.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,12 @@ foreach (LA_FILE ${LA_GEN_SRC})
10181018
endforeach ()
10191019

10201020
if (NOT C_LAPACK)
1021-
set_source_files_properties(${LA_SOURCES} PROPERTIES COMPILE_FLAGS "${LAPACK_FFLAGS}")
1021+
# The below line is duplicating Fortran flags but NAG has a few flags
1022+
# that cannot be specified twice. It's possible this is not needed for
1023+
# any compiler, but for safety, we only turn off for NAG
1024+
if (NOT ${F_COMPILER} STREQUAL "NAGFOR")
1025+
set_source_files_properties(${LA_SOURCES} PROPERTIES COMPILE_FLAGS "${LAPACK_FFLAGS}")
1026+
endif ()
10221027
if (${F_COMPILER} STREQUAL "GFORTRAN")
10231028
set_source_files_properties(${LA_SOURCES} PROPERTIES COMPILE_FLAGS "${LAPACK_FFLAGS} -fno-tree-vectorize")
10241029
endif()

cmake/system.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
642642
endif ()
643643

644644
if (CMAKE_Fortran_COMPILER)
645-
if ("${F_COMPILER}" STREQUAL "NAG" OR "${F_COMPILER}" STREQUAL "CRAY" OR CMAKE_Fortran_COMPILER_ID MATCHES "LLVMFlang.*")
645+
if ("${F_COMPILER}" STREQUAL "NAGFOR" OR "${F_COMPILER}" STREQUAL "CRAY" OR CMAKE_Fortran_COMPILER_ID MATCHES "LLVMFlang.*")
646646
set(FILTER_FLAGS "-msse3;-mssse3;-msse4.1;-mavx;-mavx2,-mskylake-avx512")
647647
if (CMAKE_Fortran_COMPILER_ID MATCHES "LLVMFlang.*")
648648
message(STATUS "removing fortran flags")

0 commit comments

Comments
 (0)