Skip to content

CAM snapshot output broken on Derecho/GNU debug due to integer pbuf fields #1502

@jimmielin

Description

@jimmielin

What happened?

Try to output any CAM snapshot on current Derecho environment in cam6_4_156

GNU debug throws a sigfpe on history write for any snapshot out.

Inspection of the crash site shows the error is on integer-type pbuf fields being written out

Program received signal SIGFPE, Arithmetic exception.
0x000000000066e245 in cam_history::dump_field (fld=76, t=2, f=1, restart=.FALSE.)
    at /glade/derecho/scratch/hplin/260312_sima_presc_volc/CAM64_156/src/control/cam_history.F90:5452
5452	                      tape(t)%hlist(fld)%hbuf(dimind2%beg1:dimind2%end1, 1, ind3)
(gdb) p fld
$1 = 76
(gdb) p tape(t)%hlist(fld)%field%name
$3 = 'pbuf_ZM_JT', ' ' <repeats 25 times>

These fields were declared as dtype_i4

   ! wg top level index of deep cumulus convection.
   call pbuf_add_field('ZM_JT', 'physpkg', dtype_i4, (/pcols/), zm_jt_idx)

   ! wg gathered values of maxi.
   call pbuf_add_field('ZM_MAXG', 'physpkg', dtype_i4, (/pcols/), zm_maxg_idx)

   ! map gathered points to chunk index
   call pbuf_add_field('ZM_IDEEP', 'physpkg', dtype_i4, (/pcols/), zm_ideep_idx)

but cam_pbuf_snapshot_all_outfld attempts to write all as real without any kind of conversion

I previously put in a workaround for clubbtop, but it looks like the workaround is needed for all integer fields now or the model will crash with debug on:

         ! Retrieve the pbuf data. Special handling for certain
         ! integer-type fields.
         if( trim(pbuf_snapshot(i)%ddt_string) == 'clubbtop') then
            call pbuf_get_field(pbuf, pbuf_idx, tmpptr2d_int)
            ! copy into real
            allocate(tmpptr2d(size(tmpptr2d_int, 1), size(tmpptr2d_int, 2)))
            tmpptr2d = real(tmpptr2d_int, r8)
            call outfld(pbuf_snapshot(i)%standard_name, tmpptr2d, pcols, lchnk)
            deallocate(tmpptr2d)
         else

I will put in a fix.

What are the steps to reproduce the bug?

See above.

What CAM tag were you using?

cam6_4_156

What machine were you running CAM on?

CISL machine (e.g. cheyenne)

What compiler were you using?

GNU

debug on

Path to a case directory, if applicable

No response

Will you be addressing this bug yourself?

Yes

Extra info

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working correctly

Type

No type

Projects

Status

To Do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions