Skip to content

Commit

Permalink
Merge pull request #898 from ACSimon33/intelllvm_and_nvhpc
Browse files Browse the repository at this point in the history
CMake config for IntelLLVM (ifx) and NVIDIA HPC SDK (nvfortran)
  • Loading branch information
weslleyspereira authored Aug 30, 2023
2 parents 8da11d1 + 64d95ed commit ae2f14f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
21 changes: 19 additions & 2 deletions CMAKE/CheckLAPACKCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set( FPE_EXIT FALSE )

# FORTRAN ILP default
set(FOPT_ILP64)
if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
if( CMAKE_Fortran_COMPILER_ID MATCHES "Intel" )
if ( WIN32 )
set(FOPT_ILP64 /integer-size:64)
else ()
Expand All @@ -31,6 +31,12 @@ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
else ()
set(FOPT_ILP64 -i8)
endif()
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" )
if ( WIN32 )
set(FOPT_ILP64 /i8)
else ()
set(FOPT_ILP64 -i8)
endif()
else()
set(CPE_ENV $ENV{PE_ENV})
if(CPE_ENV STREQUAL "CRAY")
Expand All @@ -52,7 +58,7 @@ if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
endif()

# Intel Fortran
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
elseif( CMAKE_Fortran_COMPILER_ID MATCHES "Intel" )
if( "${CMAKE_Fortran_FLAGS}" MATCHES "[-/]fpe(-all=|)0" )
set( FPE_EXIT TRUE )
endif()
Expand Down Expand Up @@ -138,6 +144,17 @@ elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -quiet")
endif()

# NVIDIA HPC SDK
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" )
if( ("${CMAKE_Fortran_FLAGS}" MATCHES "-Ktrap=") AND
NOT ("${CMAKE_Fortran_FLAGS}" MATCHES "-Ktrap=none") )
set( FPE_EXIT TRUE )
endif()

if( NOT ("${CMAKE_Fortran_FLAGS}" MATCHES "[-/]Kieee") )
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Kieee")
endif()

else()
endif()

Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,14 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL Flang)
check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
check_fortran_compiler_flag("-frecursive" _frecursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
check_fortran_compiler_flag("-recursive" _recursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
check_fortran_compiler_flag("-qrecur" _qrecurFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NAG)
check_fortran_compiler_flag("-recursive" _recursiveFlag)
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NVHPC)
check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
else()
message(WARNING "Fortran local arrays should be allocated on the stack."
" Please use a compiler which guarantees that feature."
Expand Down Expand Up @@ -175,7 +177,7 @@ elseif(_qrecurFlag)
endif()

if(UNIX)
if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
if(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict")
endif()
if(CMAKE_Fortran_COMPILER_ID STREQUAL XL)
Expand Down

0 comments on commit ae2f14f

Please sign in to comment.