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

gmtb/develop (--> dtc/develop): static build and out-of-source-build capabilities #136

Merged
merged 9 commits into from
Nov 7, 2019

Conversation

climbfuji
Copy link
Collaborator

This PR targets gmtb/develop for code review purposes. Once merged, dtc/develop should be created from gtmtb/develop, made a protected branch and gmtb/develop should be frozen.

This PR:

This PR does not update the documentation wrt building SCM with the static CCPP option.

No changes are required for buidling SCM with dynamic CCPP, i.e. the following still works:

$ ./ccpp/framework/scripts/ccpp_prebuild.py \
    --config=ccpp/config/ccpp_prebuild_config.py \
    2>&1 | tee ccpp_prebuild.log
$ mkdir -p scm/bin
$ cd scm/bin
$ cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMP=ON ../src 2>&1 | tee log.cmake
$ make VERBOSE=1 2>&1 | tee log.make

To build SCM in static mode and use the multi_run_gmtb_scm.py script, the following commands are required (compiling all available suites into the executable):

$ ./ccpp/framework/scripts/ccpp_prebuild.py \
    --config=ccpp/config/ccpp_prebuild_config.py \
    --static \
    --suites=SCM_GFS_2017_myj,SCM_GFS_v15,SCM_GFS_v15_noahmp,SCM_GFS_v15_prescribed_surface,SCM_GFS_v15plus,SCM_GFS_v15plus_prescribed_surface,SCM_GSD_v0,SCM_GSD_v0_prescribed_surface,SCM_csawmg,SCM_csawmg_prescribed_surface \
    2>&1 | tee ccpp_prebuild.log
$ mkdir -p scm/bin
$ cd scm/bin
$ cmake -DCMAKE_BUILD_TYPE=Debug -DOPENMP=ON -DSTATIC=ON ../src 2>&1 | tee log.cmake
$ make VERBOSE=1 2>&1 | tee log.make

With both -DCMAKE_BUILD_TYPE=Debug and -DCMAKE_BUILD_TYPE=Release, the results are identical between the dynamic and static CCPP builds:

$ pwd
/Users/dom.heinzeller/scratch/gmtb-scm/gmtb-scm_develop_static-build/static/scm/bin
$ for dir in output_*; do echo $dir; cmp /Users/dom.heinzeller/scratch/gmtb-scm/gmtb-scm_develop_static-build/dynamic/scm/bin/$dir/output.nc $dir/output.nc; done
output_LASSO_2016051812_SCM_GFS_v15
output_LASSO_2016051812_SCM_GFS_v15plus
output_LASSO_2016051812_SCM_GSD_v0
output_LASSO_2016051812_SCM_csawmg
output_arm_sgp_summer_1997_A_SCM_GFS_v15
output_arm_sgp_summer_1997_A_SCM_GFS_v15plus
output_arm_sgp_summer_1997_A_SCM_GSD_v0
output_arm_sgp_summer_1997_A_SCM_csawmg
output_astex_SCM_GFS_v15
output_astex_SCM_GFS_v15plus
output_astex_SCM_GSD_v0
output_astex_SCM_csawmg
output_bomex_SCM_GFS_v15
output_bomex_SCM_GFS_v15plus
output_bomex_SCM_GSD_v0
output_bomex_SCM_csawmg
output_twpice_SCM_GFS_v15
output_twpice_SCM_GFS_v15plus
output_twpice_SCM_GSD_v0
output_twpice_SCM_csawmg

@climbfuji
Copy link
Collaborator Author

Note: because the two PRs for ccpp-physics, NCAR/ccpp-physics#350 and NCAR/ccpp-physics#343, still need to be tested with ufs-weather-model, this PR cannot be merged until the testing has been completed.

@grantfirl
Copy link
Collaborator

Thanks @climbfuji for making modifications to work with the static build. I started to look at this last week and was a little lost, so thanks for doing this. I tested this on my machine and it works as advertised once a small fix for ccpp_prebuild_config.py was included.

As per the instructions, I'm waiting to merge this until NCAR/ccpp-physics#350 is tested in ufs-weather-model, which is currently ongoing on Hera. If tests pass, I'll merge this PR and create the dtc/develop branch from it.

@grantfirl
Copy link
Collaborator

@climbfuji When I started looking at the static build last week, I played around with calling ccpp_prebuild.py from cmake. With the lack of a more complicated build system as in the UFS, would it make sense for us to cut out the manual step of calling ccpp_prebuild by making cmake do it?

@grantfirl
Copy link
Collaborator

ufs-weather-model RT passes on hera/intel with rt.conf for NCAR/ccpp-physics#350 so, I'm going to merge this and create dtc/develop from it.

@grantfirl grantfirl merged commit f5969be into NCAR:gmtb/develop Nov 7, 2019
@climbfuji
Copy link
Collaborator Author

@climbfuji When I started looking at the static build last week, I played around with calling ccpp_prebuild.py from cmake. With the lack of a more complicated build system as in the UFS, would it make sense for us to cut out the manual step of calling ccpp_prebuild by making cmake do it?

Hi @grantfirl, the problem I had was that cmake wouldn't allow me to execute a script before anything else happens in cmake - it would allow me to run it pre_build (but after cmake). I believe Dusan found a solution for this for UFS - can you touch base with him? Thanks!

dustinswales pushed a commit to dustinswales/ccpp-scm that referenced this pull request May 16, 2022
gmtb/develop (--> dtc/develop): static build and out-of-source-build capabilities
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants