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

max_mdims in cam_hist_file: config_define_file is used before defined #331

Closed
jimmielin opened this issue Dec 10, 2024 · 0 comments
Closed
Labels
bug Something isn't working correctly

Comments

@jimmielin
Copy link
Member

What happened?

Run CAM-SIMA with DEBUG=true
The model fails with a run-time check failure:

63: forrtl: severe (194): Run-Time Check Failure. The variable 'cam_hist_file_mp_config_define_file_$MAX_MDIMS' is being used
in '/src/history/cam_hist_file.F90(1019,10)' without being defined
63: Image              PC                Routine            Line        Source
63: cesm.exe           0000000000496291  cam_history_mp_hi         211  cam_history.F90
63: cesm.exe           0000000000482229  cam_comp_mp_cam_t         484  cam_comp.F90
63: cesm.exe           0000000000460DEF  atm_comp_nuopc_mp        1170  atm_comp_nuopc.F90
63: libesmf.so         000014B7CCD77D86  execute                   377  ESMCI_MethodTable.C
63: libesmf.so         000014B7CCD77932  execute                   563  ESMCI_MethodTable.C
63: libesmf.so         000014B7CCD7752A  c_esmc_methodtabl         317  ESMCI_MethodTable.C
63: libesmf.so         000014B7CD11788B  esmf_attachmethod        1287  ESMF_AttachMethods.F90
63: libesmf.so         000014B7CE88D3FD  nuopc_modelbase_m        2212  NUOPC_ModelBase.F90
63: libesmf.so         000014B7CC9D3279  callVFuncPtr             2167  ESMCI_FTable.C
63: libesmf.so         000014B7CC9D22B8  ESMCI_FTableCallE         824  ESMCI_FTable.C
63: libesmf.so         000014B7CCE6FAB2  enter                    2501  ESMCI_VMKernel.C
63: libesmf.so         000014B7CCE58346  enter                    1216  ESMCI_VM.C
63: libesmf.so         000014B7CC9D365F  c_esmc_ftablecall         981  ESMCI_FTable.C
63: libesmf.so         000014B7CD4574FC  esmf_compmod_mp_e        1252  ESMF_Comp.F90
63: libesmf.so         000014B7CDD27D6A  esmf_gridcompmod_        1903  ESMF_GridComp.F90
63: libesmf.so         000014B7CE7C9B75  nuopc_driver_mp_r        3694  NUOPC_Driver.F90
63: libesmf.so         000014B7CE7CFDFA  nuopc_driver_mp_e        3940  NUOPC_Driver.F90
63: libesmf.so         000014B7CCD77D86  execute                   377  ESMCI_MethodTable.C
63: libesmf.so         000014B7CCD77932  execute                   563  ESMCI_MethodTable.C
63: libesmf.so         000014B7CCD7752A  c_esmc_methodtabl         317  ESMCI_MethodTable.C
75: cesm.exe           000000000041C9BD  Unknown               Unknown  Unknown

What are the steps to reproduce the bug?

  1. Check out latest CAM-SIMA (might have to merge Implements cam_thermo_water_update and CCPPized check_energy #316 to allow build)
  2. Create any case with history output (FKESSLER)
  3. ./xmlchange DEBUG=true
  4. ./case.setup and build
  5. Submit case

What CAM-SIMA hash were you using?

f999707

What machine were you running CAM-SIMA on?

CISL machine (e.g. cheyenne)

What compiler were you using?

Intel

Path to a case directory, if applicable

No response

Will you be addressing this bug yourself?

Any Software Engineer can do this

Extra info

max_hdims appears to be used before defined. The only usage is

      ! Determine the maximum number of dimensions
      do field_index = 1, size(this%field_list)
         max_mdims = max(max_mdims, size(this%field_list(field_index)%dimensions()))
      end do
      ! Allocate dimindex to the maximum possible dimensions (plus 1 for time)
      allocate(dimindex(max_hdims + max_mdims + 1), stat=ierr)

On the first loop iteration max_mdims is undefined but used in the max() statement.

I think setting max_mdims = 0 above the loop should fix the issue? Not sure if this is related to #302 as the variable name mentioned there (maxmdims) is suspiciously similar to the problematic one here (max_mdims), but this appears to be just a local variable in the subroutine.

@jimmielin jimmielin added the bug Something isn't working correctly label Dec 10, 2024
jimmielin added a commit that referenced this issue Dec 16, 2024
… with history output (#333)

Tag name (required for release branches):
Originator(s): @jimmielin 

Description (include the issue title, and the keyword ['closes',
'fixes', 'resolves'] followed by the issue number):

- Fixes #332 (`max_mdims` used before defined)
- Fixes #331 (unassociated `of%file_desc` in `cam_register_open_file`
leading to crash with >2 history files)

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the input datasets (e.g. boundary
datasets): N/A

List all files eliminated and why: N/A

List all files added and what they do: N/A

List all existing files that have been modified, and describe the
changes:
(Helpful git command: `git diff --name-status
development...<your_branch_name>`)

```
Fixes #331
M       src/history/cam_hist_file.F90

Fixes #332
M       src/utils/cam_abortutils.F90

```

If there are new failures (compared to the
`test/existing-test-failures.txt` file),
have them OK'd by the gatekeeper, note them here, and add them to the
file.
If there are baseline differences, include the test and the reason for
the
diff. What is the nature of the change? Roundoff?

derecho/intel/aux_sima:

derecho/gnu/aux_sima:

If this changes climate describe any run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced:

CAM-SIMA date used for the baseline comparison tests if different than
latest:
@github-project-automation github-project-automation bot moved this from To Do to Done in CAM Development Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
Status: Done
Development

No branches or pull requests

2 participants