Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 33 additions & 76 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,42 @@
version: 2.1

executors:
gfortran-large:
docker:
- image: gmao/ubuntu20-geos-env-mkl:v6.2.8-openmpi_4.0.6-gcc_11.2.0
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_AUTH_TOKEN
environment:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
OMPI_MCA_btl_vader_single_copy_mechanism: none
resource_class: large
#MEDIUM# resource_class: medium
parameters:
GHA_Actor:
type: string
default: ""
GHA_Action:
type: string
default: ""
GHA_Event:
type: string
default: ""
GHA_Meta:
type: string
default: ""

ifort-large:
docker:
- image: gmao/ubuntu20-geos-env:v6.2.8-intelmpi_2021.2.0-intel_2021.2.0
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_AUTH_TOKEN
resource_class: large
#MEDIUM# resource_class: medium
# Anchors to prevent forgetting to update a version
os_version: &os_version ubuntu20
baselibs_version: &baselibs_version v7.25.0
bcs_version: &bcs_version v11.5.0
tag_build_arg_name: &tag_build_arg_name fv3version

orbs:
ci: geos-esm/circleci-tools@2

workflows:
build-test:
jobs:
- build-GEOSctm:
name: build-GEOSctm-on-<< matrix.compiler >>

# Build GEOSfvdycore
- ci/build:
name: build-GEOSfvdycore-as-<< matrix.fv_precision >>-on-<< matrix.compiler >>
context:
- docker-hub-creds
matrix:
parameters:
compiler: [gfortran, ifort]
context:
- docker-hub-creds

jobs:
build-GEOSctm:
parameters:
compiler:
type: string
executor: << parameters.compiler >>-large
working_directory: /root/project
steps:
- checkout:
path: GEOSctm
- run:
name: "Versions etc"
command: mpirun --version && << parameters.compiler>> --version && echo $BASEDIR && pwd && ls
- run:
name: "Mepo clone external repos"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/GEOSctm
mepo clone
mepo status
- run:
name: "Mepo checkout-if-exists"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/GEOSctm
echo "${CIRCLE_BRANCH}"
if [ "${CIRCLE_BRANCH}" != "develop" ] && [ "${CIRCLE_BRANCH}" != "main" ]
then
mepo checkout-if-exists ${CIRCLE_BRANCH}
fi
mepo status
- run:
name: "CMake"
command: |
mkdir -p /logfiles
cd ${CIRCLE_WORKING_DIRECTORY}/GEOSctm
mkdir -p ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSctm
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSctm
cmake ${CIRCLE_WORKING_DIRECTORY}/GEOSctm -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-GEOSctm -DUSE_F2PY=OFF |& tee /logfiles/cmake.log
- run:
name: "Build and install"
command: |
cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSctm
make -j"$(nproc)" install |& tee /logfiles/make.log
#MEDIUM# make -j4 install |& tee /logfiles/make.log
- run:
name: "Compress artifacts"
command: |
gzip -9 /logfiles/*
- store_artifacts:
path: /logfiles
compiler: [ifort, gfortran]
fv_precision: ["R8"]
baselibs_version: *baselibs_version
repo: GEOSctm
mepodevelop: false
persist_workspace: false # Needs to be true to run fv3/gcm experiment, costs extra
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Global Editor Config for MAPL
#
# This is an ini style configuration. See http://editorconfig.org/ for more information on this file.
#
# Top level editor config.
root = true

# Always use Unix style new lines with new line ending on every file and trim whitespace
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Python: PEP8 defines 4 spaces for indentation
[*.py]
indent_style = space
indent_size = 4

# YAML format, 2 spaces
[{*.yaml,*.yml}]
indent_style = space
indent_size = 2

# CMake (from KitWare: https://github.com/Kitware/CMake/blob/master/.editorconfig)
[{CMakeLists.txt,*.cmake,*.rst}]
indent_style = space
indent_size = 2
14 changes: 7 additions & 7 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
# Order is important; the last matching pattern takes the most
# precedence.

# Everything in GEOSgcm should be owned by the GCM Gatekeepers
# Everything in GEOSctm should be owned by the CTM Gatekeepers
* @GEOS-ESM/ctm-gatekeepers

# The GCM gatekeepers and CMake should know/approve these
# The CTM gatekeepers and CMake should know/approve these
/.github/ @GEOS-ESM/cmake-team @GEOS-ESM/ctm-gatekeepers
/.circleci/ @GEOS-ESM/cmake-team @GEOS-ESM/ctm-gatekeepers
/.codebuild/ @GEOS-ESM/cmake-team @GEOS-ESM/ctm-gatekeepers
/.circleci/ @GEOS-ESM/cmake-team @GEOS-ESM/ctm-gatekeepers
/.codebuild/ @GEOS-ESM/cmake-team @GEOS-ESM/ctm-gatekeepers

# The GEOS CMake Team is the CODEOWNER for the CMakeLists.txt files in this repository
CMakeLists.txt @GEOS-ESM/cmake-team
# The GEOS CMake Team should be notified about changes to the CMakeLists.txt files in this repository
CMakeLists.txt @GEOS-ESM/cmake-team @GEOS-ESM/ctm-gatekeepers

# The GEOS CMake Team should be notified about and approve config changes
/config/ @GEOS-ESM/cmake-team
/config/ @GEOS-ESM/cmake-team @GEOS-ESM/ctm-gatekeepers
10 changes: 7 additions & 3 deletions .github/workflows/enforce-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@ 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."

28 changes: 19 additions & 9 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
# Do not run if the only files changed cannot affect the build
paths-ignore:
- "**.md"
- "**.json"
- "ChangeLog-PreJason.txt"
- "parallel_build.csh"
- ".github/CODEOWNERS"
- ".codebuild/**"
Expand All @@ -17,33 +19,41 @@ jobs:
if: "!contains(github.event.pull_request.labels.*.name, '0 diff trivial')"
runs-on: ubuntu-latest
container:
image: gmao/ubuntu20-geos-env-mkl:v6.2.4-openmpi_4.0.5-gcc_10.3.0
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
image: gmao/ubuntu20-geos-env:v7.25.0-intelmpi_2021.13-intel_2024.2
# Per https://github.com/actions/virtual-environments/issues/1445#issuecomment-713861495
# It seems like we might not need secrets on GitHub Actions which is good for forked
# pull requests
#credentials:
#username: ${{ secrets.DOCKERHUB_USERNAME }}
#password: ${{ secrets.DOCKERHUB_TOKEN }}
env:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
OMPI_MCA_btl_vader_single_copy_mechanism: none
steps:
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.5.0
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout CTM
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set all directories as git safe
run: |
git config --global --add safe.directory '*'
- name: Versions etc.
run: |
gfortran --version
ifort --version
mpirun --version
echo $BASEDIR
- name: Mepo clone external repos
run: |
mepo clone
mepo status
mepo status
- name: Update other branches
if:
"!contains('refs/heads/main,refs/heads/develop', github.ref)"
Expand All @@ -54,7 +64,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_BUILD_TYPE=Debug -DMPIEXEC_PREFLAGS='--oversubscribe' -DUSE_F2PY=OFF
cmake .. -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_BUILD_TYPE=Debug -DMPIEXEC_PREFLAGS='--oversubscribe' -DUSE_F2PY=OFF
- name: Build
run: |
cd build
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@
parallel_build.o*
log.*
CMakeUserPresets.json

# Ignore possible symlinked directories
build-*
install-*

*.swp
*.swo
.DS_Store
*#
.#*
**/CVS/
69 changes: 66 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cmake_minimum_required (VERSION 3.13)
cmake_minimum_required (VERSION 3.17)
cmake_policy (SET CMP0053 NEW)
cmake_policy (SET CMP0054 NEW)

project (
GEOSctm
VERSION 2.0.1
VERSION 2.3.0
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF

if ("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
Expand Down Expand Up @@ -34,10 +34,64 @@ set (FV_PRECISION "R8" CACHE STRING "Precision of FV3 core (R4, R4R8, R8)")
foreach (dir cmake @cmake cmake@)
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/${dir})
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/${dir}")
set (ESMA_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}/${dir}" CACHE PATH "Path to ESMA_cmake code")
endif ()
endforeach ()

# We need to find MPI before we go into esma
# for the MPI stack detection to work
set(MPI_DETERMINE_LIBRARY_VERSION TRUE)
find_package(MPI)

include (esma)

# Add CMake for when not using Baselibs
if (NOT Baselibs_FOUND)

find_package(NetCDF REQUIRED C Fortran)
add_definitions(-DHAS_NETCDF4)
add_definitions(-DHAS_NETCDF3)
add_definitions(-DNETCDF_NEED_NF_MPIIO)
add_definitions(-DHAS_NETCDF3)

find_package(HDF5 REQUIRED)
if(HDF5_IS_PARALLEL)
add_definitions(-DH5_HAVE_PARALLEL)
endif()

if (NOT TARGET ESMF::ESMF)
find_package(ESMF 8.6.1 MODULE REQUIRED)
target_link_libraries(ESMF::ESMF INTERFACE MPI::MPI_Fortran)

# GEOS uses lowercase target due to historical reasons but
# the latest FindESMF.cmake file from ESMF produces an ESMF::ESMF target.
if (NOT TARGET esmf)
add_library(esmf ALIAS ESMF::ESMF)
endif ()
if (NOT TARGET ESMF)
add_library(ESMF ALIAS ESMF::ESMF)
endif ()
endif ()

find_package(GFTL_SHARED REQUIRED)

find_package(ZLIB REQUIRED)
# Another issue with historical reasons, old/wrong zlib target used in GEOS
add_library(ZLIB::zlib ALIAS ZLIB::ZLIB)

# Using FMS from spack requires updates to fvdycore due to interface changes
# in FMS 2022. This is commented for now until this transition can occur.
#################################################
# find_package(FMS QUIET COMPONENTS R4 R8) #
# if (FMS_FOUND) #
# # We need aliases due to historical reasons #
# add_library(fms_r4 ALIAS FMS::fms_r4) #
# add_library(fms_r8 ALIAS FMS::fms_r8) #
# endif () #
#################################################

endif ()

ecbuild_declare_project()

# Generic DFLAGS
Expand All @@ -63,5 +117,14 @@ install(
DESTINATION ${CMAKE_INSTALL_PREFIX}
)

# Adds abiilty to tar source
# Adds ability to tar source
include (esma_cpack)

# This installs a tarball of the source code
# in the installation directory.
# MUST BE THE LAST CODE IN THIS FILE
option(INSTALL_SOURCE_TARFILE "Create and install source tarfile" OFF)
if(INSTALL_SOURCE_TARFILE)
install(CODE "set(CMAKE_PROJECT_NAME \"${CMAKE_PROJECT_NAME}\")")
install(SCRIPT "${ESMA_CMAKE_PATH}/esma_postinstall.cmake")
endif()
Loading