Skip to content
Merged
9 changes: 6 additions & 3 deletions .github/workflows/enforce-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,25 @@ jobs:
require-label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v2
- uses: mheap/github-action-required-labels@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: minimum
count: 1
labels: "0 diff,0 diff trivial,Non 0-diff,0 diff structural,0-diff trivial,Not 0-diff,0-diff,automatic,0-diff uncoupled"
labels: "0 diff,0 diff trivial,Non 0-diff,0 diff structural,0-diff trivial,Not 0-diff,0-diff,automatic,0-diff uncoupled,github_actions"
add_comment: true
message: "This PR is being prevented from merging because you have not added one of our required labels: {{ provided }}. Please add one so that the PR can be merged."

blocking-label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v2
- uses: mheap/github-action-required-labels@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: exactly
count: 0
labels: "Contingent - DNA,Needs Lead Approval,Contingent -- Do Not Approve"
add_comment: true
message: "This PR is being prevented from merging because you have added one of our blocking labels: {{ provided }}. You'll need to remove it before this PR can be merged."
4 changes: 2 additions & 2 deletions .github/workflows/push-to-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Run the action
uses: devops-infra/action-pull-request@v0.4
uses: devops-infra/action-pull-request@v0.5.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: develop
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build Tests

on:
pull_request:
types: [opened, synchronize, reopened]
# Do not run if the only files changed cannot affect the build
paths-ignore:
- "**.md"
- "**.pro"
- "**.sh"
- "**.perl"
- ".github/CODEOWNERS"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build_gcm:
strategy:
matrix:
compiler: [ifort, gfortran-14, gfortran-15]
build-type: [Debug]
uses: GEOS-ESM/CI-workflows/.github/workflows/geosgcm_build_tests.yml@project/geosgcm
with:
compiler: ${{ matrix.compiler }}
cmake-build-type: ${{ matrix.build-type }}
fixture-repo: GEOS-ESM/GEOSgcm

spack_build:
uses: GEOS-ESM/CI-workflows/.github/workflows/spack_gcc_build.yml@project/geosgcm
secrets:
BUILDCACHE_USERNAME: ${{ secrets.BUILDCACHE_USERNAME }}
BUILDCACHE_TOKEN: ${{ secrets.BUILDCACHE_TOKEN }}
with:
fixture-repo: GEOS-ESM/GEOSgcm

87 changes: 56 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,42 +111,35 @@ if (BUILD_GEOS_GTFV3_INTERFACE)
SRCS ${srcs}
SUBCOMPONENTS fvdycore
DEPENDENCIES ${dependencies}
DEPENDENCIES ${GFDL}
DEPENDENCIES geos_gtfv3_interface_py) # Make the main library depend on the Python library
else ()
esma_add_library (${this}
SRCS ${srcs}
SUBCOMPONENTS fvdycore
DEPENDENCIES ${dependencies}
DEPENDENCIES ${GFDL})
DEPENDENCIES ${dependencies})
endif ()

if (FV_PRECISION STREQUAL R4)
set (GFDL fms_r4)
target_link_libraries (${this} PUBLIC fms_r4)
target_compile_definitions (${this} PRIVATE SINGLE_FV OVERLOAD_R4)
elseif (FV_PRECISION STREQUAL R4R8) # FV is R4 but FMS is R8
# We need to add_dependencies for fms_r4 because CMake doesn't know we
# need it for include purposes. In R4R8, we only ever link against
# fms_r4, so it doesn't know we need to build it.
# NOTE NOTE NOTE: This should *not* be included in GEOSgcm v12
# because FMS is pre-built library in that case.
add_dependencies (${this} fms_r4)
get_target_property (extra_incs fms_r4 INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${this} PRIVATE
$<BUILD_INTERFACE:${extra_incs}>
)
set (GFDL fms_r8)
elseif (FV_PRECISION STREQUAL R8)
set (GFDL fms_r8)
string(REPLACE " " ";" tmp ${FREAL8})
foreach(flag ${tmp})
target_compile_options (${this} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:${flag}>)
endforeach()
endif ()
# fvdycore needs r4 .mod interfaces
get_target_property(inc_r4 fms_r4 INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${this} PRIVATE $<BUILD_INTERFACE:${inc_r4}>)

if (FV_PRECISION MATCHES R4)
target_compile_definitions (${this} PRIVATE -DSINGLE_FV -DOVERLOAD_R4)
elseif (FV_PRECISION MATCHES R4R8) # FV is R4 but FMS is R8
target_compile_definitions (${this} PRIVATE -DSINGLE_FV -DOVERLOAD_R4)
# But fvdycore should not *compile* with fms_r8 includes
target_link_libraries(${this} PUBLIC $<LINK_ONLY:fms_r8>)

target_compile_definitions (${this} PRIVATE SINGLE_FV OVERLOAD_R4)

# This tells CMake that we need these targets built before we can build
add_dependencies(${this} fms_r4 fms_r8)
elseif (FV_PRECISION STREQUAL R8)
target_link_libraries (${this} PUBLIC fms_r8)
string(REPLACE " " ";" tmp ${FREAL8})
foreach(flag ${tmp})
target_compile_options (${this} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:${flag}>)
endforeach()
endif ()

message(STATUS "Building FV as ${FV_PRECISION}")
Expand All @@ -157,11 +150,7 @@ if (CRAY_POINTER)
set_target_properties (${this} PROPERTIES COMPILE_FLAGS ${CRAY_POINTER})
endif()

add_definitions (-DSPMD -DMAPL_MODE -DFVREGRID_MAPL_MODE)

foreach(flag ${tmp})
target_compile_options (${this} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:${flag}>)
endforeach()
target_compile_definitions (${this} PRIVATE MAPL_MODE FVREGRID_MAPL_MODE)

ecbuild_add_executable (
TARGET StandAlone_FV3_Dycore.x
Expand Down Expand Up @@ -198,6 +187,32 @@ ecbuild_add_executable (
SOURCES interp_restarts_bin.F90
LIBS ${this} OpenMP::OpenMP_Fortran)

# If we are doing R4R8 we also need add_dependencies for both fms_r4 and fms_r8
# for all our executables that link to ${this} because of the way we set up the
# main library above.
if (FV_PRECISION STREQUAL R4R8)
foreach(executable
StandAlone_FV3_Dycore.x
rs_scale.x
StandAlone_AdvCore.x
StandAlone_DynAdvCore.x
c2c.x
interp_restarts.x
interp_restarts_bin.x)

# fvdycore needs r4 .mod interfaces
get_target_property(inc_r4 fms_r4 INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${executable} PRIVATE $<BUILD_INTERFACE:${inc_r4}>)

# But fvdycore should not *compile* with fms_r8 includes
target_link_libraries(${executable} $<LINK_ONLY:fms_r8>)

# This tells CMake that we need these targets built before we can build
add_dependencies(${executable} fms_r4 fms_r8)
endforeach()
endif ()


if (BUILD_GEOS_GTFV3_INTERFACE)
ecbuild_add_executable (
TARGET fv3_driver.x
Expand All @@ -209,6 +224,16 @@ if (BUILD_GEOS_GTFV3_INTERFACE)
geos-gtfv3/driver/input/input_arrays.f90
geos-gtfv3/driver/fv3_driver.F90
LIBS ${this})
if (FV_PRECISION STREQUAL R4R8)
# fvdycore needs r4 .mod interfaces
get_target_property(inc_r4 fms_r4 INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(fv3_driver.x PRIVATE $<BUILD_INTERFACE:${inc_r4}>)

# But fvdycore should not *compile* with fms_r8 includes
target_link_libraries(fv3_driver.x PUBLIC $<LINK_ONLY:fms_r8>)

add_dependencies(fv3_driver.x fms_r4 fms_r8)
endif ()
endif ()

add_subdirectory(scripts)
2 changes: 1 addition & 1 deletion FV_StateMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2711,7 +2711,7 @@ subroutine fv_getDELZ(delz,temp,pe)
real(REAL8) :: rdg
peln = log(pe)
rdg = -rgas / grav
delz = rdg*temp*(peln(:,:,2:)-peln(:,:,1:))
delz = rdg*temp*(peln(:,:,2:)-peln(:,:,1:FV_Atm(1)%npz))
return
end subroutine fv_getDELZ

Expand Down