diff --git a/cmake/fc.cmake b/cmake/fc.cmake index 4ce1c99d4b..38bd406a3a 100644 --- a/cmake/fc.cmake +++ b/cmake/fc.cmake @@ -269,6 +269,31 @@ if (${F_COMPILER} STREQUAL "CRAY") endif () endif () +if (${F_COMPILER} STREQUAL "NAGFOR") + set(CCOMMON_OPT "${CCOMMON_OPT} -DF_INTERFACE_NAG") + if (INTERFACE64) + set(FCOMMON_OPT "${FCOMMON_OPT} -i8") + endif () + # Options from Makefile.system + # -dcfuns: Enable non-standard double precision complex intrinsic functions + # -ieee=full: enables all IEEE arithmetic facilities including non-stop arithmetic. + # -w=obs: Suppress warning messages about obsolescent features + # -thread_safe: Compile code for safe execution in a multi-threaded environment. + # -recursive: Specifies that procedures are RECURSIVE by default. + set(FCOMMON_OPT "${FCOMMON_OPT} -dcfuns -recursive -ieee=full -w=obs -thread_safe") + # Options from Reference-LAPACK + # Suppress compiler banner and summary + set(FCOMMON_OPT "${FCOMMON_OPT} -quiet") + # Disable other common warnings + # -w=x77: Suppress warning messages about Fortran 77 features + # -w=ques: Suppress warning messages about questionable usage + # -w=unused: Suppress warning messages about unused variables + set(FCOMMON_OPT "${FCOMMON_OPT} -w=x77 -w=ques -w=unused") + if (USE_OPENMP) + set(FCOMMON_OPT "${FCOMMON_OPT} -openmp") + endif () +endif () + # from the root Makefile - this is for lapack-netlib to compile the correct secnd file. if (${F_COMPILER} STREQUAL "GFORTRAN") set(TIMER "INT_ETIME") diff --git a/cmake/lapack.cmake b/cmake/lapack.cmake index 003a8b3c17..6a74fb7640 100644 --- a/cmake/lapack.cmake +++ b/cmake/lapack.cmake @@ -1018,7 +1018,12 @@ foreach (LA_FILE ${LA_GEN_SRC}) endforeach () if (NOT C_LAPACK) - set_source_files_properties(${LA_SOURCES} PROPERTIES COMPILE_FLAGS "${LAPACK_FFLAGS}") + # The below line is duplicating Fortran flags but NAG has a few flags + # that cannot be specified twice. It's possible this is not needed for + # any compiler, but for safety, we only turn off for NAG + if (NOT ${F_COMPILER} STREQUAL "NAGFOR") + set_source_files_properties(${LA_SOURCES} PROPERTIES COMPILE_FLAGS "${LAPACK_FFLAGS}") + endif () if (${F_COMPILER} STREQUAL "GFORTRAN") set_source_files_properties(${LA_SOURCES} PROPERTIES COMPILE_FLAGS "${LAPACK_FFLAGS} -fno-tree-vectorize") endif() diff --git a/cmake/system.cmake b/cmake/system.cmake index 82d16c92fa..b58a0f4b55 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -642,7 +642,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") endif () if (CMAKE_Fortran_COMPILER) -if ("${F_COMPILER}" STREQUAL "NAG" OR "${F_COMPILER}" STREQUAL "CRAY" OR CMAKE_Fortran_COMPILER_ID MATCHES "LLVMFlang.*") + if ("${F_COMPILER}" STREQUAL "NAGFOR" OR "${F_COMPILER}" STREQUAL "CRAY" OR CMAKE_Fortran_COMPILER_ID MATCHES "LLVMFlang.*") set(FILTER_FLAGS "-msse3;-mssse3;-msse4.1;-mavx;-mavx2,-mskylake-avx512") if (CMAKE_Fortran_COMPILER_ID MATCHES "LLVMFlang.*") message(STATUS "removing fortran flags")