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

sync CDEPS with ESCOMP #60

Merged
merged 68 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
5bec8cd
introduce simple data mode as an constant configurable forcing.
alperaltuntas Dec 19, 2022
916ca86
add constant forcing namelist and set forcing fields to values from nml
alperaltuntas Dec 19, 2022
f2688cd
Merge branch 'master' into merge_simple_forcing
jedwards4b Dec 21, 2022
52fdf7b
Merge branch 'master' into merge_simple_forcing
jedwards4b Dec 23, 2022
27e1c3e
Update stream definitions for new coupler history file format.
olyson Apr 28, 2023
8136439
Merge tag 'cdeps1.0.10' into cplhistStreams
olyson Apr 28, 2023
d47f1ba
filename_add_days to filename_advance_days
olyson Apr 28, 2023
00414e1
Remove tabs fixing #231
ekluzek May 8, 2023
977260a
Add externals to the git ignore
ekluzek May 8, 2023
0afab9d
Merge pull request #232 from ekluzek/removetabsindatmbuildnml
jedwards4b May 9, 2023
252acc0
Merge remote-tracking branch 'escomp/main' into cplhistStreams
billsacks May 9, 2023
af2a809
Merge pull request #228 from olyson/cplhistStreams
billsacks May 9, 2023
1ca35a5
black reformat these python files
jedwards4b May 16, 2023
aa77161
Merge pull request #233 from jedwards4b/black_format_python
jedwards4b May 17, 2023
380f6fe
update github to make cdeps ext build an action
jedwards4b May 19, 2023
895f31b
debug action
jedwards4b May 19, 2023
cae6d80
try again
jedwards4b May 19, 2023
169c280
fix run statement format
jedwards4b May 19, 2023
4a1f889
need to build in action to make it useable by other repos
jedwards4b May 19, 2023
d7c8f92
Merge pull request #234 from jedwards4b/update_actions
jedwards4b May 19, 2023
9a1d6f9
update SST files for historical configurations
fvitt Jun 5, 2023
63889cd
Merge pull request #235 from fvitt/sst_files_update
jedwards4b Jun 5, 2023
f5ad119
correct docs link in README.md
klindsay28 Jun 27, 2023
bb232d8
enable DISABLE_FoX for standalone build
uturuncoglu Jul 3, 2023
f3a837b
install data component specific module files
uturuncoglu Jul 4, 2023
2521e4e
introduce export_all option
uturuncoglu Jun 30, 2022
fe5a578
Merge pull request #236 from klindsay28/docs_link_in_readme
jedwards4b Jul 10, 2023
39bc5b1
Merge remote-tracking branch 'upstream/main' into feature/esmx
uturuncoglu Jul 10, 2023
ae827c3
Merge pull request #237 from uturuncoglu/feature/esmx
uturuncoglu Jul 10, 2023
707b505
fix for docn
uturuncoglu Jul 13, 2023
26ab1e0
Merge pull request #238 from uturuncoglu/hotfix/export_all
jedwards4b Jul 13, 2023
4750a27
update esmf bld to use official esmf action
jedwards4b Aug 16, 2023
bb60bdc
update esmf bld to use official esmf action
jedwards4b Aug 16, 2023
aab9411
add pio as external to esmf build
jedwards4b Aug 16, 2023
2e1b9f8
add pio as external to esmf build
jedwards4b Aug 16, 2023
57ef5ec
add pnetcdf-config
jedwards4b Aug 16, 2023
6dce402
cleanup github workflow script
jedwards4b Aug 16, 2023
8276318
response to review
jedwards4b Aug 16, 2023
f415e66
response to review
jedwards4b Aug 16, 2023
f7e657e
Merge pull request #239 from jedwards4b/github_esmf_bld_update
jedwards4b Aug 17, 2023
d31de60
simple fix
Aug 21, 2023
c4a200b
Merge branch 'main' into buildlib_fix
Aug 21, 2023
8b7bb12
make a little nicer
Aug 21, 2023
a04df35
put back...
Aug 21, 2023
4a6b374
Merge pull request #241 from adrifoster/buildlib_fix
billsacks Aug 21, 2023
30477e1
merge cdeps1.0.21 and resolve conflicts
alperaltuntas Oct 4, 2023
57cd466
in simple (idealized) data mode, replace giss radiation with an ideal…
alperaltuntas Oct 8, 2023
3501b20
address change requests: undo nlfilename assignment reorder, use ESMF…
alperaltuntas Oct 9, 2023
74b5c4c
Merge pull request #198 from alperaltuntas/merge_simple_forcing
jedwards4b Oct 9, 2023
4a38196
add save attribute to this variable
jedwards4b Oct 17, 2023
a0e50c9
add namelist lookup to each namelist read call
jedwards4b Oct 20, 2023
7f79dc6
need to add shr_nl_mod for standalone builds
jedwards4b Oct 20, 2023
723d3f9
Merge pull request #250 from jedwards4b/add_nl_lookup_tool
jedwards4b Oct 20, 2023
9de323e
fix minor typo in drof modifier mode
alperaltuntas Oct 24, 2023
7ebbff8
Merge pull request #251 from alperaltuntas/fix_modifier_typo
jedwards4b Oct 24, 2023
9945da5
allow path changes and symlinks in stream filenames
jedwards4b Oct 27, 2023
97a2da6
Merge pull request #253 from jedwards4b/allow_path_changes
jedwards4b Oct 27, 2023
4211498
enabling setting source and destination mask for interpolation
uturuncoglu Nov 9, 2023
ee00179
update default SSTICE_DATA_FILENAME to match that previously used in cam
jedwards4b Dec 13, 2023
416b566
enabling setting source and destination mask for interpolation
uturuncoglu Nov 9, 2023
28cc73e
Merge pull request #259 from uturuncoglu/feature/mask_only
jedwards4b Jan 26, 2024
30a360c
Merge branch 'main' into sst_Had_update
jedwards4b Jan 26, 2024
5d4f62a
sync with escomp
uturuncoglu Jan 26, 2024
9338407
minor fix
uturuncoglu Jan 26, 2024
3c70fc8
Merge pull request #256 from jedwards4b/sst_Had_update
jedwards4b Jan 26, 2024
4cb3a75
Merge remote-tracking branch 'upstream/main' into feature/mask
uturuncoglu Jan 29, 2024
1d6b65a
Merge remote-tracking branch 'remotes/upstream/develop' into feature/…
BinLiu-NOAA Feb 1, 2024
66cc553
Merge pull request #1 from hafs-community/feature/mask
uturuncoglu Feb 1, 2024
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
46 changes: 46 additions & 0 deletions .github/actions/buildcdeps/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CDEPS build and cache
description: 'Build the CDEPS library'
inputs:
cdeps_version:
description: 'Tag in the CDEPS repository to use'
default: main
required: False
type: string
pio_path:
description: 'Path to the installed parallelio code root'
default: $HOME/pio
required: False
type: string
esmfmkfile:
description: 'Path to the installed ESMF library mkfile'
default: $HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk
required: False
type: string
src_root:
description: 'Path to cdeps source'
default: $GITHUB_WORKSPACE
required: False
type: string
cmake_flags:
description: 'Extra flags for cmake command'
default: -Wno-dev
required: False
type: string
install_prefix:
description: 'Install path of cdeps'
default: $HOME/cdeps
required: False
type: string
runs:
using: composite
steps:
- id : Build-CDEPS
shell: bash
run: |
mkdir build-cdeps
pushd build-cdeps
export ESMFMKFILE=${{ inputs.esmfmkfile }}
export PIO=${{ inputs.pio_path }}
cmake ${{ inputs.cmake_flags }} ${{ inputs.src_root }}
make VERBOSE=1
popd
83 changes: 29 additions & 54 deletions .github/workflows/extbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ jobs:
CPPFLAGS: "-I/usr/include -I/usr/local/include "
LDFLAGS: "-L/usr/lib/x86_64-linux-gnu "
# Versions of all dependencies can be updated here - these match tag names in the github repo
ESMF_VERSION: v8.4.0
#PNETCDF_VERSION: checkpoint.1.12.3
#NETCDF_FORTRAN_VERSION: v4.6.0
ParallelIO_VERSION: pio2_5_10
ESMF_VERSION: v8.5.0
ParallelIO_VERSION: pio2_6_0
steps:
- id: checkout-CDEPS
uses: actions/checkout@v3
Expand All @@ -37,68 +35,45 @@ jobs:
sudo apt-get install netcdf-bin libnetcdf-dev libnetcdff-dev
sudo apt-get install pnetcdf-bin libpnetcdf-dev
sudo apt-get install autotools-dev autoconf
# - id: cache-pnetcdf
# uses: actions/cache@v3
# with:
# path: ~/pnetcdf
# key: ${{ runner.os }}-${{ env.PNETCDF_VERSION}}-pnetcdf1
# - name: Build PNetCDF
# if: steps.cache-pnetcdf.outputs.cache-hit != 'true'
# uses: ./.github/actions/buildpnetcdf
# with:
# pnetcdf_version: ${{ env.PNETCDF_VERSION }}
# install_prefix: $HOME/pnetcdf
# - name: Cache netcdf-fortran
# id: cache-netcdf-fortran
# uses: actions/cache@v3
# with:
# path: ~/netcdf-fortran
# key: ${{ runner.os }}-${{ env.NETCDF_FORTRAN_VERSION }}-netcdf-fortran1
# - name: Build NetCDF Fortran
# if: steps.cache-netcdf-fortran.outputs.cache-hit != 'true'
# uses: ./.github/actions/buildnetcdff
# with:
# netcdf_fortran_version: ${{ env.NETCDF_FORTRAN_VERSION }}
# install_prefix: $HOME/netcdf-fortran
# netcdf_c_path: /usr
- name: Cache PARALLELIO
id: cache-PARALLELIO
uses: actions/cache@v3
with:
path: ~/pio
path: ${GITHUB_WORKSPACE}/pio
key: ${{ runner.os }}-${{ env.ParallelIO_VERSION }}-parallelio2
- name: Build ParallelIO
if: steps.cache-PARALLELIO.outputs.cache-hit != 'true'
uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@9390e30e29d4ebbfbef0fc72162cacd9e8f25e4e
with:
parallelio_version: ${{ env.ParallelIO_VERSION }}
enable_fortran: True
install_prefix: $HOME/pio
- name: Cache ESMF
id: cache-esmf
uses: actions/cache@v3
with:
path: ~/ESMF
key: ${{ runner.os }}-${{ env.ESMF_VERSION }}-ESMF2
- name: Build ESMF
if: steps.cache-esmf.outputs.cache-hit != 'true'
uses: ./.github/actions/buildesmf
install_prefix: ${GITHUB_WORKSPACE}/pio
- name: Install ESMF
uses: esmf-org/install-esmf-action@v1
env:
ESMF_COMPILER: gfortran
ESMF_BOPT: g
ESMF_COMM: openmpi
ESMF_NETCDF: nc-config
ESMF_PNETCDF: pnetcdf-config
ESMF_INSTALL_PREFIX: ${GITHUB_WORKSPACE}/ESMF
ESMF_PIO: external
ESMF_PIO_INCLUDE: ${GITHUB_WORKSPACE}/pio/include
ESMF_PIO_LIBPATH: ${GITHUB_WORKSPACE}/pio/lib
with:
esmf_version: ${{ env.ESMF_VERSION }}
esmf_bopt: g
esmf_comm: openmpi
install_prefix: $HOME/ESMF
netcdf_c_path: /usr
netcdf_fortran_path: /usr
pnetcdf_path: /usr
parallelio_path: $HOME/pio
version: ${{ env.ESMF_VERSION }}
esmpy: false
cache: true

- name: Build CDEPS
uses: ./.github/actions/buildcdeps
with:
esmfmkfile: $ESMFMKFILE
pio_path: ${GITHUB_WORKSPACE}/pio
src_root: ${GITHUB_WORKSPACE}
cmake_flags: " -Wno-dev -DCMAKE_BUILD_TYPE=DEBUG -DWERROR=ON -DCMAKE_Fortran_FLAGS=\"-DCPRGNU -g -Wall \
-ffree-form -ffree-line-length-none -fallow-argument-mismatch \""
- name: Test CDEPS
run: |
export ESMFMKFILE=$HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk
export PIO=$HOME/pio
export SRC_ROOT=
mkdir build-cdeps
pushd build-cdeps
cmake -Wno-dev -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_Fortran_FLAGS="-DCPRGNU -g -Wall -ffree-form -ffree-line-length-none -fallow-argument-mismatch " -DWERROR=ON ../
cd build-cdeps
make VERBOSE=1
popd
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@
*.out
*.app

# Externals
fox
share/genf90

# ignore pycache
__pycache__
56 changes: 35 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.10)
include(ExternalProject)
include(FetchContent)

set(DISABLE_FoX OFF CACHE BOOL "Disable FoX library to process XML files.")
message("DISABLE_FoX = ${DISABLE_FoX}")
if(DISABLE_FoX)
add_definitions(-DDISABLE_FoX)
endif()

if (DEFINED CIMEROOT)
message("Using CIME in ${CIMEROOT} with compiler ${COMPILER}")
include(${CASEROOT}/Macros.cmake)
Expand All @@ -23,7 +29,9 @@ else()
set(BLD_STANDALONE TRUE)
project(NUOPC_DATA_MODELS LANGUAGES Fortran VERSION 0.1)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set(FOX_ROOT ${CMAKE_SOURCE_DIR}/fox)
if(NOT DISABLE_FoX)
set(FOX_ROOT ${CMAKE_SOURCE_DIR}/fox)
endif()
endif()
message("CMAKE_MODULE_PATH is ${CMAKE_MODULE_PATH}, CMAKE_Fortran_COMPILER is ${CMAKE_Fortran_COMPILER}")
enable_language(Fortran)
Expand Down Expand Up @@ -62,29 +70,32 @@ endif()
add_subdirectory(streams)
add_subdirectory(dshr)

if(IS_DIRECTORY "${FOX_ROOT}")
message(STATUS "FoX library is already checked out!")
message(STATUS "FoX source dir: ${FOX_ROOT}")
else()
FetchContent_Declare(fox
GIT_REPOSITORY https://github.com/ESMCI/fox.git
GIT_TAG 4.1.2.1
SOURCE_DIR ${FOX_ROOT}
BINARY_DIR ${FOX_ROOT}/..
)
FetchContent_GetProperties(fox)
if(NOT fox_POPULATED)
FetchContent_Populate(fox)
message(STATUS "FoX source dir: ${fox_SOURCE_DIR}")
message(STATUS "FoX binary dir: ${fox_BINARY_DIR}")
if(NOT DISABLE_FoX)
if(IS_DIRECTORY "${FOX_ROOT}")
message(STATUS "FoX library is already checked out!")
message(STATUS "FoX source dir: ${FOX_ROOT}")
else()
FetchContent_Declare(fox
GIT_REPOSITORY https://github.com/ESMCI/fox.git
GIT_TAG 4.1.2.1
SOURCE_DIR ${FOX_ROOT}
BINARY_DIR ${FOX_ROOT}/..
)
FetchContent_GetProperties(fox)
if(NOT fox_POPULATED)
FetchContent_Populate(fox)
message(STATUS "FoX source dir: ${fox_SOURCE_DIR}")
message(STATUS "FoX binary dir: ${fox_BINARY_DIR}")
endif()
endif()
add_subdirectory(fox)

target_include_directories(streams PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/fox/include>
$<INSTALL_INTERFACE:mod>)
target_include_directories(dshr PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/fox/include>
$<INSTALL_INTERFACE:mod>)
endif()
add_subdirectory(fox)

target_include_directories(streams PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/fox/include>
$<INSTALL_INTERFACE:mod>)
target_include_directories(dshr PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/fox/include>
$<INSTALL_INTERFACE:mod>)
target_include_directories(dshr PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/streams>
$<INSTALL_INTERFACE:mod>)

Expand Down Expand Up @@ -112,6 +123,9 @@ foreach(COMP datm dice dlnd docn drof dwav)
endforeach(COMP)

foreach(DEPS streams dshr cdeps_share FoX_dom FoX_wxml FoX_sax FoX_common FoX_utils FoX_fsys)
if(DISABLE_FoX AND ${DEPS} MATCHES "^FoX")
continue()
endif()
if(NOT BLD_STANDALONE AND ${DEPS} STREQUAL "cdeps_share")
continue()
endif()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Community Data Models for Earth Prediction Systems

For documentation see

https://escomp.github.io/CDEPS/html/index.html
https://escomp.github.io/CDEPS/versions/master/html/index.html

## A note on github tag action

Expand Down
8 changes: 3 additions & 5 deletions cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ def buildlib(bldroot, libroot, case):

logger.info("Running cmake for CDEPS")
srcpath = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
cmake_flags = get_standard_cmake_args(
case, os.path.join(sharedpath, "cdeps")
)
cmake_flags = get_standard_cmake_args(case, os.path.join(sharedpath, "cdeps"))
# base path of install to be completed by setting DESTDIR in make install
cmake_flags += " -DCMAKE_INSTALL_PREFIX:PATH=/"
cmake_flags += " -DLIBROOT={} ".format(libroot)
Expand Down Expand Up @@ -180,8 +178,8 @@ def buildlib(bldroot, libroot, case):
# Do not allow any warnings except from fox external
nextline = ""
for line in e.split("\n"):
if "F90" in line and not "fox" in line:
nextline.append(line)
if "f90" in line.lower() and not "fox" in line.lower():
nextline = nextline + line
if len(nextline) > 0:
expect(False, nextline)

Expand Down
22 changes: 15 additions & 7 deletions cime_config/buildlib_comps
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,44 @@ if _CIMEROOT is None:
raise SystemExit("ERROR: must set CIMEROOT environment variable")
sys.path.append(os.path.join(_CIMEROOT, "CIME", "Tools"))

_LIBDIR = os.path.join(_CIMEROOT, "scripts", "lib")
_LIBDIR = os.path.join(_CIMEROOT, "CIME")
sys.path.append(_LIBDIR)

from standard_script_setup import *
from CIME.buildlib import parse_input
from CIME.case import Case
from CIME.utils import run_cmd, symlink_force, expect

# pragma pylint: disable=unused-argument,undefined-variable

logger = logging.getLogger(__name__)


def buildlib(bldroot, libroot, case, compname=None):
if not compname:
expect(bldroot.endswith("obj"),
"It appears that buildlib_comps is being called for the main CDEPS build\n"
"(the main CDEPS build should use buildlib, not buildlib_comps)")
compname = os.path.basename(os.path.abspath(os.path.join(bldroot,os.pardir)))
expect(
bldroot.endswith("obj"),
"It appears that buildlib_comps is being called for the main CDEPS build\n"
"(the main CDEPS build should use buildlib, not buildlib_comps)",
)
compname = os.path.basename(os.path.abspath(os.path.join(bldroot, os.pardir)))

_, o, e = run_cmd("make d{}".format(compname), from_dir=bldroot, verbose=True)
libname = "lib{}.a".format(compname)
dlibname = "libd{}.a".format(compname)
dlibpath = os.path.join(bldroot, dlibname)
if os.path.exists(dlibpath):
symlink_force(os.path.join(bldroot,dlibname), os.path.join(libroot,libname))
symlink_force(os.path.join(bldroot, dlibname), os.path.join(libroot, libname))
else:
expect(False, "ERROR in {} build {} {}".format(compname,o,e))
expect(False, "ERROR in {} build {} {}".format(compname, o, e))
logger.info(f"build successful for comp={compname}")


def _main_func(args):
caseroot, libroot, bldroot = parse_input(args)
with Case(caseroot) as case:
buildlib(bldroot, libroot, case)


if __name__ == "__main__":
_main_func(sys.argv)
Loading