Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support IntelLLVM compiler #353

Merged
merged 9 commits into from
Oct 1, 2024
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|Repro|MinSizeRel|RelWithDebInfo
endif()
message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}'.")

if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU)$")
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM|GNU)$")
message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}")
endif()

Expand Down
24 changes: 24 additions & 0 deletions cmake/compiler_flags_IntelLLVM_Fortran.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Precision-based Fortran compiler flags
set(R4_flags "-real-size 32") # Fortran flags for 32BIT precision
set(R8_flags "-real-size 64") # Fortran flags for 64BIT precision
set(R8_flags "${R8_flags} -no-prec-div")

# Intel Fortran
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -align array64byte -qno-opt-dynamic-align ${${kind}_flags}")

set(CMAKE_Fortran_FLAGS_REPRO "-O2 -debug minimal -fp-model consistent -qoverride-limits")

set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -fp-model strict -qoverride-limits")

set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fp-stack-check -fstack-protector-all -fpe0 -debug -ftrapuv -init=snan,arrays")

set(CMAKE_Fortran_LINK_FLAGS "")

if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Repro)$")
if(AVX2)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -march=core-avx2")
elseif(SIMDMULTIARCH)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -axSSE4.2,CORE-AVX2")
endif()
endif()

4 changes: 3 additions & 1 deletion cmake/fv3_compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
include(compiler_flags_GNU_Fortran)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
include(compiler_flags_Intel_Fortran)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(IntelLLVM)$")
include(compiler_flags_IntelLLVM_Fortran)
else()
message(WARNING "Fortran compiler with ID ${CMAKE_Fortran_COMPILER_ID} will be used with CMake default options")
endif()
10 changes: 10 additions & 0 deletions model/fv_arrays.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,9 @@ subroutine allocate_fv_atmos_type(Atm, isd_in, ied_in, jsd_in, jed_in, is_in, ie
Atm%va(i,j,k) = real_big
Atm%pt(i,j,k) = real_big
Atm%delp(i,j,k) = real_big
#ifdef USE_COND
Atm%q_con(i,j,k) = 0.
#endif
enddo
enddo
do j=jsd, jed+1
Expand Down Expand Up @@ -1618,6 +1621,13 @@ subroutine allocate_fv_atmos_type(Atm, isd_in, ied_in, jsd_in, jed_in, is_in, ie
Atm%phis(i,j) = real_big
enddo
enddo
#ifndef USE_COND
do j=jsd, jed
do i=isd, ied
Atm%q_con(i,j,1) = 0.
enddo
enddo
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding another ifndef block here, you can safely put the Atm%q_con=0, along with proper documentation, where it is allocated at line 1555. In this case, you are not initializing the memory in an OpenMP region.


allocate ( Atm%gridstruct% area(isd_2d:ied_2d ,jsd_2d:jed_2d ) ) ! Cell Centered
allocate ( Atm%gridstruct% area_64(isd_2d:ied_2d ,jsd_2d:jed_2d ) ) ! Cell Centered
Expand Down