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

Ngen cfe workflow test #97

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
d86f7c0
First commit to cfe
stcui007 Sep 28, 2023
f039d2e
A revised ngen_integration
stcui007 Sep 28, 2023
716065b
Further revised version
stcui007 Sep 28, 2023
d439ecd
Another version
stcui007 Sep 29, 2023
0bfe741
Fix some bugs
stcui007 Sep 29, 2023
62331ea
More revisions
stcui007 Sep 29, 2023
3a666cf
A new attempt
stcui007 Sep 29, 2023
ef049e2
A minor revision
stcui007 Sep 29, 2023
74c97ed
Another test
stcui007 Sep 29, 2023
9f31a17
another version
stcui007 Sep 29, 2023
0322ff2
fix a bug
stcui007 Sep 29, 2023
7fb4441
Fix another bug
stcui007 Sep 29, 2023
4a1a40c
Another try
stcui007 Sep 29, 2023
4905fda
A new test
stcui007 Sep 29, 2023
c695d77
Another test
stcui007 Sep 29, 2023
8bb5ed8
A different workflow
stcui007 Sep 29, 2023
76985ef
Fix a bug
stcui007 Oct 2, 2023
7c8ec1a
Fix another bug
stcui007 Oct 2, 2023
34308f7
Fix some bugs
stcui007 Oct 2, 2023
aec2e18
Fix another minor bug
stcui007 Oct 2, 2023
ed6348c
Fix a directory issue
stcui007 Oct 2, 2023
1fba854
A new aprroach
stcui007 Oct 2, 2023
7b7508f
build ngen first
stcui007 Oct 2, 2023
d227687
add CFE
stcui007 Oct 2, 2023
8b23335
Fix a bug
stcui007 Oct 2, 2023
382cc18
Fix another bug
stcui007 Oct 2, 2023
d4d2b90
Fix one more bug
stcui007 Oct 2, 2023
04b70ff
Some changes
stcui007 Oct 2, 2023
9c6f1aa
add build submodule
stcui007 Oct 2, 2023
cb668e6
save submodule libs
stcui007 Oct 2, 2023
16bbce4
add sloth submodule
stcui007 Oct 2, 2023
14905c7
Run ngen-cfe
stcui007 Oct 2, 2023
ac29bfa
Fix a bug
stcui007 Oct 2, 2023
3461c6e
a test
stcui007 Oct 2, 2023
ec52983
A new test
stcui007 Oct 3, 2023
c1cd47e
An alternative method
stcui007 Oct 3, 2023
3c497c1
Fix a bug
stcui007 Oct 3, 2023
13e6378
Fix one more bug
stcui007 Oct 3, 2023
6359b89
Some changes
stcui007 Oct 3, 2023
565761c
A revision
stcui007 Oct 3, 2023
3ce0a73
Another revision
stcui007 Oct 3, 2023
7c06188
Format change
stcui007 Oct 3, 2023
9b8746f
change repo name format
stcui007 Oct 3, 2023
9a3cb63
a revision
stcui007 Oct 3, 2023
4be9665
cd to ngen
stcui007 Oct 3, 2023
c2c05cb
Syntax change
stcui007 Oct 3, 2023
d41e8ff
Syntax change back
stcui007 Oct 3, 2023
981a6ca
Try another version
stcui007 Oct 3, 2023
f199f88
Fix bugs
stcui007 Oct 3, 2023
4f23861
Add PET submodule
stcui007 Oct 3, 2023
33f4fbe
Revise forcing path
stcui007 Oct 3, 2023
149d931
Fix a bug
stcui007 Oct 3, 2023
4b51a08
Some clean up
stcui007 Oct 3, 2023
031914f
comment out codes
stcui007 Oct 3, 2023
ea0b5dd
umcomment some codes
stcui007 Oct 3, 2023
252b1eb
remove some comments
stcui007 Oct 3, 2023
3557a6f
A new workflow test
stcui007 Oct 4, 2023
2759e86
Clean up
stcui007 Oct 4, 2023
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
107 changes: 107 additions & 0 deletions .github/workflows/ngen_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Test ngen-cfe integration

name: Ngen Integration Tests

# Controls when the action will run.
on:
push:
branches: [ master, dev, notreal ]
pull_request:
branches: [ master, dev, notreal ]
workflow_dispatch:

env:
# Obtained from https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
# TODO: add something later that can check the runners for hyperthreading
LINUX_NUM_PROC_CORES: 2
MACOS_NUM_PROC_CORES: 3
ASAN_OPTIONS: detect_leaks=false

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Run general unit tests in linux environment
test_surfacebmi_plus_cfe:
# The type of runner that the job will run on
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout actions in another repo
uses: actions/checkout@v3
with:
repository: noaa-owp/ngen

# Build some necessary submodules
- name: Build ISO C Fortran BMI
id: submod_build_2
uses: ./.github/actions/ngen-submod-build
with:
mod-dir: "extern/iso_c_fortran_bmi/"

- name: Build PET
id: submod_build_5
uses: ./.github/actions/ngen-submod-build
with:
mod-dir: "extern/evapotranspiration/evapotranspiration"
targets: "petbmi"

- name: Build SLoTH
id: submod_build_6
uses: ./.github/actions/ngen-submod-build
with:
mod-dir: "extern/sloth/"
targets: "slothmodel"

# Build Ngen and save some files
- name: Build Ngen
id: ngen_id1
uses: ./.github/actions/ngen-build
with:
targets: "ngen"
build-cores: ${{ env.LINUX_NUM_PROC_CORES }}
#is this required for this test?
bmi_c: 'ON'
bmi_fortran: 'OFF'
timeout-minutes: 15

- name: Cleanup Ngen Build
run: |
# Move ngen build artifacts to temp directory
mv ${{ steps.ngen_id1.outputs.build-dir }} ${{runner.temp}}/ngen-build/
mv .github ${{runner.temp}}/.github
mv extern ${{runner.temp}}/extern
mv data ${{runner.temp}}/data

- name: Run surfacebmi plus cfebmi
run: |
echo "end of ngen_integration testing"

# Checkout and build CFE
- name: Checkout the commit
uses: actions/checkout@v4

- name: Build CFE Library for Ngen
run: |
cmake -B cmake_build -S . -DNGEN=ON
make -C cmake_build

# Move ngen build and other files to appropriate directory to run ngen
mv ${{runner.temp}}/ngen-build ./ngen-build
mv ${{runner.temp}}/extern/sloth extern
cp -r ${{runner.temp}}/extern/evapotranspiration extern
mv ${{runner.temp}}/data data

# Run ngen with CFE with PET
inputfile='realizations/realization_cfe_pet.json'
./ngen-build/ngen ./data/catchment_data.geojson "cat-27" ./data/nexus_data.geojson "nex-26" $inputfile

# The following remove a post processing error
- name: Re-checkout Ngen
uses: actions/checkout@v3
with:
repository: noaa-owp/ngen
70 changes: 70 additions & 0 deletions realizations/realization_cfe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"global": {
"formulations": [
{
"name": "bmi_multi",
"params": {
"model_type_name": "bmi_multi_noahowp_cfe",
"forcing_file": "",
"init_config": "",
"allow_exceed_end_time": true,
"main_output_variable": "Q_OUT",
"modules": [
{
"name": "bmi_c++",
"params": {
"model_type_name": "bmi_c++_sloth",
"library_file": "./extern/sloth/cmake_build/libslothmodel",
"init_config": "/dev/null",
"allow_exceed_end_time": true,
"main_output_variable": "z",
"uses_forcing_file": false,
"model_params": {
"sloth_ice_fraction_schaake(1,double,m,node)": 0.0,
"sloth_ice_fraction_xinanjiang(1,double,1,node)": 0.0,
"sloth_smp(1,double,1,node)": 0.0
}
}
},
{
"name": "bmi_c",
"params": {
"model_type_name": "bmi_c_cfe",
"library_file": "./cmake_build/libcfebmi",
"forcing_file": "",
"init_config": "./configs/cat_87_bmi_config_cfe_pass.txt",
"allow_exceed_end_time": true,
"main_output_variable": "Q_OUT",
"registration_function": "register_bmi_cfe",
"variables_names_map": {
"water_potential_evaporation_flux" : "water_potential_evaporation_flux",
"atmosphere_water__liquid_equivalent_precipitation_rate" : "APCP_surface",
"atmosphere_air_water~vapor__relative_saturation" : "SPFH_2maboveground",
"land_surface_air__temperature" : "TMP_2maboveground",
"land_surface_wind__x_component_of_velocity" : "UGRD_10maboveground",
"land_surface_wind__y_component_of_velocity" : "VGRD_10maboveground",
"land_surface_radiation~incoming~longwave__energy_flux" : "DLWRF_surface",
"land_surface_radiation~incoming~shortwave__energy_flux" : "DSWRF_surface",
"land_surface_air__pressure" : "PRES_surface",
"ice_fraction_schaake" : "sloth_ice_fraction_schaake",
"ice_fraction_xinanjiang" : "sloth_ice_fraction_xinanjiang",
"soil_moisture_profile" : "sloth_smp"
},
"uses_forcing_file": false
}
}
],
"uses_forcing_file": false
}
}
],
"forcing": {
"path" : "./forcings/cat87_01Dec2015-.csv"
}
},
"time": {
"start_time": "2015-12-01 00:00:00",
"end_time": "2015-12-30 23:00:00",
"output_interval": 3600
}
}
10 changes: 5 additions & 5 deletions realizations/realization_cfe_pet.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"name": "bmi_c",
"params": {
"model_type_name": "bmi_c_pet",
"library_file": "./extern/evapotranspiration/cmake_build/libpetbmi",
"library_file": "./extern/evapotranspiration/evapotranspiration/cmake_build/libpetbmi",
"forcing_file": "",
"init_config": "./extern/cfe/cfe/configs/cat_87_bmi_config_pet_pass.txt",
"init_config": "./configs/cat_87_bmi_config_pet_pass.txt",
"allow_exceed_end_time": true,
"main_output_variable": "water_potential_evaporation_flux",
"registration_function":"register_bmi_pet",
Expand All @@ -43,9 +43,9 @@
"name": "bmi_c",
"params": {
"model_type_name": "bmi_c_cfe",
"library_file": "./extern/cfe/cmake_build/libcfebmi",
"library_file": "./cmake_build/libcfebmi",
"forcing_file": "",
"init_config": "./extern/cfe/cfe/configs/cat_87_bmi_config_cfe_pass.txt",
"init_config": "./configs/cat_87_bmi_config_cfe_pass.txt",
"allow_exceed_end_time": true,
"main_output_variable": "Q_OUT",
"registration_function": "register_bmi_cfe",
Expand All @@ -72,7 +72,7 @@
}
],
"forcing": {
"path" : "./extern/cfe/cfe/forcings/cat87_01Dec2015-.csv"
"path" : "./forcings/cat87_01Dec2015-.csv"
}
},
"time": {
Expand Down
Loading