Skip to content

dtc/develop: run CCPP prebuild step from cmake#142

Merged
grantfirl merged 2 commits into
NCAR:dtc/developfrom
climbfuji:run_ccpp_prebuild_from_cmake
Nov 21, 2019
Merged

dtc/develop: run CCPP prebuild step from cmake#142
grantfirl merged 2 commits into
NCAR:dtc/developfrom
climbfuji:run_ccpp_prebuild_from_cmake

Conversation

@climbfuji
Copy link
Copy Markdown
Collaborator

@climbfuji climbfuji commented Nov 20, 2019

This PR

  • Updates the submodule pointer for ccpp/physics to fix the broken dtc/develop branch (following PR Reinstate gwd interstitial reorg #141 which didn't update the submodule pointer).
  • Runs ccpp_prebuild.py as part of the cmake step for both the dynamic and static CCPP. For the static build, a list of all suites is generated from the suites directory and compiled into the executable.

This code was tested successfully on

  • hera+intel in "Release" mode
  • cheyenne+gnu in "Release" mode
  • macos+clang/gfortran in "Release" mode (build/compile only)
    for both dynamic and static CCPP.

Warning The SCM code is currently broken in "Debug" mode:

  • For the Intel compiler, the compilation step fails because of mismatching arguments in ugwp_driver_v0.F (see known issue address gfortran compilation warning for ugwp_driver_v0.F ccpp-physics#354).
  • For the GNU compiler, the runs segfault in sfc_nst.f, line 384. See the comment below for the full stacktrace.
  • on macos+clang/gfortran, the code crashes in both "Release" and "Debug" mode with Segmentation fault - invalid memory reference right at the beginning.

This PR is not addressing these issues.

@climbfuji
Copy link
Copy Markdown
Collaborator Author

Full stacktrace of segmentation fault on cheyenne+gnu in "Debug" mode:
Running without gdb:

    Opened co2 data file: co2historicaldata_1992.txt
        1992  MONTHLY CO2 (PPMV)   24  12  LON/LAT (N-S/0-360E) IN 15 DEGREE RESOLUTION,  GLB ANNUAL MEAN =   356.35000000000002        GROWTH RATE =  0.57999999999999996
    Global annual mean CO2 data for year        1992   3.5635000000000002E-004
  CHECK: Sample of selected months of CO2 data used for year:        1992
         Month =           1
   3.6260999999999997E-004   3.5968999999999997E-004   3.6257999999999999E-004   3.5789999999999997E-004   3.5789999999999997E-004   3.5550999999999996E-004   3.5431999999999998E-004   3.5431999999999998E-004   3.5404000000000002E-004   3.5346999999999999E-004   3.5346999999999999E-004   3.5346999999999999E-004
         Month =           4
   3.6410000000000001E-004   3.6251999999999996E-004   3.5938999999999996E-004   3.6019999999999997E-004   3.6019999999999997E-004   3.5648000000000000E-004   3.5461999999999999E-004   3.5461999999999999E-004   3.5422000000000003E-004   3.5342000000000001E-004   3.5342000000000001E-004   3.5342000000000001E-004
         Month =           7
   3.5416000000000001E-004   3.5274999999999998E-004   3.5932000000000000E-004   3.5147999999999999E-004   3.5147999999999999E-004   3.5461999999999999E-004   3.5618999999999999E-004   3.5618999999999999E-004   3.5570999999999997E-004   3.5475999999999997E-004   3.5475999999999997E-004   3.5475999999999997E-004
         Month =          10
   3.5304999999999999E-004   3.5244999999999997E-004   3.6151000000000000E-004   3.5500999999999995E-004   3.5500999999999995E-004   3.5562000000000001E-004   3.5592000000000002E-004   3.5592000000000002E-004   3.5570999999999997E-004   3.5527999999999997E-004   3.5527999999999997E-004   3.5527999999999997E-004

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0x7f1e250bc94f in ???
#1  0xf20334 in __sfc_nst_MOD_sfc_nst_run
	at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/ccpp/physics/physics/sfc_nst.f:384
#2  0xb4b9c6 in __ccpp_scm_gfs_v15plus_physics_cap_MOD_scm_gfs_v15plus_physics_run_cap
	at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/ccpp/physics/physics/ccpp_SCM_GFS_v15plus_physics_cap.F90:622
#3  0xb0d86e in __ccpp_scm_gfs_v15plus_cap_MOD_scm_gfs_v15plus_run_cap
	at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/ccpp/physics/physics/ccpp_SCM_GFS_v15plus_cap.F90:117
#4  0x53e35f in __ccpp_static_api_MOD_ccpp_physics_run
	at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/ccpp_static_api.F90:698
#5  0x4bd501 in __gmtb_scm_time_integration_MOD_do_time_step
	at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/gmtb_scm_time_integration.f90:88
#6  0x40d94e in __gmtb_scm_main_MOD_gmtb_scm_main_sub
	at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/gmtb_scm.F90:197
#7  0x424293 in gmtb_scm
	at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/gmtb_scm.F90:360
#8  0x4242df in main
	at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/gmtb_scm.F90:359

Running in gdb:

Program received signal SIGFPE, Arithmetic exception.
0x0000000000f20334 in sfc_nst::sfc_nst_run (im=1, hvap=2500000, cp=1004.6, hfus=333580, jcal=4.1855000000000002, eps=0.62199349945828819, epsm1=-0.37800650054171181, rvrdm1=0.60773384427800026,
    rd=287.05000000000001, rhw0=1022, pi=3.1415926535897931, sbc=5.6704000000000003e-08, ps=..., u1=..., v1=..., t1=..., q1=..., tref=..., cm=..., ch=..., prsl1=..., prslki=..., prsik1=...,
    prslk1=..., wet=..., xlon=..., sinlat=..., stress=..., sfcemis=..., dlwflx=..., sfcnsw=..., rain=..., timestep=600, kdt=1, solhr=0, xcosz=..., wind=..., flag_iter=..., flag_guess=...,
    nstf_name1=2, nstf_name4=0, nstf_name5=5, lprnt=.FALSE., ipr=1, tskin=..., tsurf=..., xt=..., xs=..., xu=..., xv=..., xz=..., zm=..., xtts=..., xzts=..., dt_cool=..., z_c=..., c_0=..., c_d=...,
    w_0=..., w_d=..., d_conv=..., ifd=..., qrain=..., qsurf=..., gflux=..., cmm=..., chh=..., evap=..., hflx=..., ep=..., errmsg=..., errflg=0, _errmsg=512)
    at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/ccpp/physics/physics/sfc_nst.f:384
384	          hl_ts  = rch(i)*elocp*eps*hvap*qss(i)/(rd*t12)
(gdb) bt
#0  0x0000000000f20334 in sfc_nst::sfc_nst_run (im=1, hvap=2500000, cp=1004.6, hfus=333580, jcal=4.1855000000000002, eps=0.62199349945828819, epsm1=-0.37800650054171181, rvrdm1=0.60773384427800026,
    rd=287.05000000000001, rhw0=1022, pi=3.1415926535897931, sbc=5.6704000000000003e-08, ps=..., u1=..., v1=..., t1=..., q1=..., tref=..., cm=..., ch=..., prsl1=..., prslki=..., prsik1=...,
    prslk1=..., wet=..., xlon=..., sinlat=..., stress=..., sfcemis=..., dlwflx=..., sfcnsw=..., rain=..., timestep=600, kdt=1, solhr=0, xcosz=..., wind=..., flag_iter=..., flag_guess=...,
    nstf_name1=2, nstf_name4=0, nstf_name5=5, lprnt=.FALSE., ipr=1, tskin=..., tsurf=..., xt=..., xs=..., xu=..., xv=..., xz=..., zm=..., xtts=..., xzts=..., dt_cool=..., z_c=..., c_0=..., c_d=...,
    w_0=..., w_d=..., d_conv=..., ifd=..., qrain=..., qsurf=..., gflux=..., cmm=..., chh=..., evap=..., hflx=..., ep=..., errmsg=..., errflg=0, _errmsg=512)
    at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/ccpp/physics/physics/sfc_nst.f:384
#1  0x0000000000b4b9c7 in ccpp_scm_gfs_v15plus_physics_cap::scm_gfs_v15plus_physics_run_cap (con_t0c=273.14999999999998, con_rd=287.05000000000001, rlapse=0.0064999999999999997, con_hvap=2500000,
    con_eps=0.62199349945828819, con_g=9.8066499999999994, con_pi=3.1415926535897931, con_sbc=5.6704000000000003e-08, con_epsm1=-0.37800650054171181, huge=9.969209968386869e+36, con_hfus=333580,
    physics=..., con_cp=1004.6, cdata=..., cimin=0.14999999999999999, con_tice=271.19999999999999, con_cvap=1846, con_rv=461.5, con_jcal=4.1855000000000002, con_fvirt=0.60773384427800026,
    con_cliq=4185.5, con_rhw0=1022) at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/ccpp/physics/physics/ccpp_SCM_GFS_v15plus_physics_cap.F90:622
#2  0x0000000000b0d86f in ccpp_scm_gfs_v15plus_cap::scm_gfs_v15plus_run_cap (con_sbc=5.6704000000000003e-08, con_cliq=4185.5, con_rd=287.05000000000001, ltp=0, rlapse=0.0064999999999999997,
    con_hvap=2500000, con_eps=0.62199349945828819, con_g=9.8066499999999994, con_t0c=273.14999999999998, con_pi=3.1415926535897931, cimin=0.14999999999999999, con_epsm1=-0.37800650054171181,
    huge=9.969209968386869e+36, con_hfus=333580, physics=..., con_cp=1004.6, cdata=..., con_cvap=1846, con_rv=461.5, con_jcal=4.1855000000000002, con_fvirt=0.60773384427800026,
    con_tice=271.19999999999999, con_rhw0=1022) at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/ccpp/physics/physics/ccpp_SCM_GFS_v15plus_cap.F90:117
#3  0x000000000053e360 in ccpp_static_api::ccpp_physics_run (cdata=..., suite_name=..., group_name=..., ierr=0, _suite_name=15, _group_name=0)
    at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/ccpp_static_api.F90:698
#4  0x00000000004bd502 in gmtb_scm_time_integration::do_time_step (scm_state=..., cdata_cols=...)
    at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/gmtb_scm_time_integration.f90:88
#5  0x000000000040d94f in gmtb_scm_main::gmtb_scm_main_sub () at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/gmtb_scm.F90:197
#6  0x0000000000424294 in gmtb_scm () at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/gmtb_scm.F90:360
#7  0x00000000004242e0 in main (argc=1, argv=0x7fffffffbfa4) at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/scm/src/gmtb_scm.F90:359
#8  0x00007fffec2276e5 in __libc_start_main () from /glade/u/apps/ch/os/lib64/libc.so.6
#9  0x0000000000405bf9 in _start () at ../sysdeps/x86_64/start.S:118
(gdb) bt full
#0  0x0000000000f20334 in sfc_nst::sfc_nst_run (im=1, hvap=2500000, cp=1004.6, hfus=333580, jcal=4.1855000000000002, eps=0.62199349945828819, epsm1=-0.37800650054171181, rvrdm1=0.60773384427800026,
    rd=287.05000000000001, rhw0=1022, pi=3.1415926535897931, sbc=5.6704000000000003e-08, ps=..., u1=..., v1=..., t1=..., q1=..., tref=..., cm=..., ch=..., prsl1=..., prslki=..., prsik1=...,
    prslk1=..., wet=..., xlon=..., sinlat=..., stress=..., sfcemis=..., dlwflx=..., sfcnsw=..., rain=..., timestep=600, kdt=1, solhr=0, xcosz=..., wind=..., flag_iter=..., flag_guess=...,
    nstf_name1=2, nstf_name4=0, nstf_name5=5, lprnt=.FALSE., ipr=1, tskin=..., tsurf=..., xt=..., xs=..., xu=..., xv=..., xz=..., zm=..., xtts=..., xzts=..., dt_cool=..., z_c=..., c_0=..., c_d=...,
    w_0=..., w_d=..., d_conv=..., ifd=..., qrain=..., qsurf=..., gflux=..., cmm=..., chh=..., evap=..., hflx=..., ep=..., errmsg=..., errflg=0, _errmsg=512)
    at /glade/work/heinzell/scm/gmtb-scm-call-ccpp-prebuild-from-cmake/gnu/static/ccpp/physics/physics/sfc_nst.f:384
        alfac = 0.99434920748239553
        alon = -25
        alpha = 0.017282530986094571
        beta = -0.0032995932975481827
        cosa = nan(0x8000000000000)
        cpinv = 0.00099542106310969544
        dt_cool_old = (nan(0x8000000000000))
        dta = nan(0x8000000000000)
        dtmp = 2.0690163888252816e-05
        dtz = nan(0x8000000000000)
        dwat = 2.3718608390787014e-05
        dz = nan(0x8000000000000)
        elocp = 2488.5526577742385
        f_nsol = -527.820457937215
        fc = nan(0x8000000000000)
        flag = (.TRUE.)
        fw = nan(0x8000000000000)
        grav = 9.7803316893237469
        hl_ts = nan(0x8000000000000)
        hs_ts = 0.63163271943555399
        hvapi = 3.9999999999999998e-07
        i = 1
        ifd_old = (nan(0x8000000000000))
        le = 2501000
        nswsfc = (0)
        q0 = (0.010199999436736107)
        q_ts = nan(0x8000000000000)
        q_warm = nan(0x8000000000000)
        qss = (3.0930747287064577e-08)
        rch = (0.63163271943555399)
        rf_ts = nan(0x8000000000000)
        rho_a = (1.2246409913361593)
        rho_w = -16095.284837717774
        rich = nan(0x8000000000000)
        rnl_ts = 0
        sep = 1.3541813962157574e-08
        sina = nan(0x8000000000000)
        soltim = -6000
        sss = 34
        sstc = nan(0x8000000000000)
        t0 = nan(0x8000000000000)
        t12 = 0
        taux = nan(0x8000000000000)
        tauy = nan(0x8000000000000)
        tem = nan(0x8000000000000)
        theta1 = (290.36036381138433)
        tsea = 0
        tskin_old = (nan(0x8000000000000))
        ttop = nan(0x8000000000000)
        ttop0 = nan(0x8000000000000)
        tv1 = (291.93756531568721)
        ulwflx = (0)
        ustar_a = 0.063606526712090397
        wetc = 1.9912447219968663e-06
        wndmag = (10.087927732514036)
        xs_old = (nan(0x8000000000000))
        xt_old = (nan(0x8000000000000))
        xtts_old = (nan(0x8000000000000))
        xu_old = (nan(0x8000000000000))
        xv_old = (nan(0x8000000000000))
        xz_old = (nan(0x8000000000000))
        xzts_old = (nan(0x8000000000000))
        z_c_old = (nan(0x8000000000000))
        zm_old = (nan(0x8000000000000))
        zsea1 = 0
        zsea2 = 0.0050000000000000001

Copy link
Copy Markdown
Collaborator

@grantfirl grantfirl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for delving into cmake and implementing this. I'll update the docs to reflect this change.

@grantfirl
Copy link
Copy Markdown
Collaborator

DEBUG mode issue will be addressed in a PR later.

@grantfirl grantfirl merged commit 7ca81fa into NCAR:dtc/develop Nov 21, 2019
@grantfirl
Copy link
Copy Markdown
Collaborator

@climbfuji When trying to run this on Hera, cmake is sending up a bunch of errors for me. It seems the default version of cmake on Hera doesn't like a few of the commands. It is easy to just add a statement in the Hera setup script to load a newer version of cmake, and I'll do that, but do you have any idea what we should change the CMAKE_MINIMUM_REQUIRED variable to handle the new commands?

dustinswales pushed a commit to dustinswales/ccpp-scm that referenced this pull request May 16, 2022
dtc/develop: run CCPP prebuild step from cmake
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