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

pio configuration checks #158

Closed
anton-seaice opened this issue May 6, 2024 · 4 comments
Closed

pio configuration checks #158

anton-seaice opened this issue May 6, 2024 · 4 comments
Labels
mediator Related to the CMEPS mediator priority:low

Comments

@anton-seaice
Copy link
Contributor

We should add checks to the pio initialisation modules to confirm that these options are valid for each model component and the mediator:

     pio_async_interface = .false.
     pio_netcdf_format = nothing
     pio_numiotasks = 5
     pio_rearranger = 1
     pio_root = 1
     pio_stride = 48
     pio_typename = netcdf4p

I think the checks would go here:
https://github.com/ESCOMP/CMEPS/blob/ffb573791c7670ada8660dbac96c6c84886f62d3/cesm/nuopc_cap_share/driver_pio_mod.F90#L366

But it may be they fit at a higher level within the CMEPS code.

The most likely error we would make it to request io from a PE which doesn't exist. i.e. we need to check

pio_numiotasks*pio_stride+pio_root<_ntasks

This would avoid isses like #156

Another error to check is if pio_typename is compatible with the pio version built.

@anton-seaice anton-seaice added mediator Related to the CMEPS mediator priority:low labels May 6, 2024
@minghangli-uni
Copy link
Contributor

minghangli-uni commented Aug 29, 2024

pio_numiotasks*pio_stride+pio_root<_ntasks

For sequential runs, the above formula will break using the following setup, since the formula pio_numiotasks * pio_stride in this case already represents the total number of processors.

     pio_async_interface = .false.
     pio_netcdf_format = nothing
     pio_numiotasks = 5
     pio_rearranger = 1
     pio_root = 1
     pio_stride = 48
     pio_typename = netcdf4p

@anton-seaice
Copy link
Contributor Author

anton-seaice commented Aug 29, 2024

For sequential runs, the above formula will break using the following setup, since the formula pio_numiotasks * pio_stride in this case already represents the total number of processors.

Yes -it should be (pio_numiotasks-1)* ...

It looks like there is some logic which just changes these values if they are wrong:

          if(.not. pio_comp_settings(i)%pio_async_interface) then
             call NUOPC_CompAttributeGet(gcomp(i), name="pio_stride", value=cval, rc=rc)
             if (chkerr(rc,__LINE__,u_FILE_u)) return
             read(cval, *) pio_comp_settings(i)%pio_stride
             if(pio_comp_settings(i)%pio_stride <= 0 .or. pio_comp_settings(i)%pio_stride > npets) then
                pio_comp_settings(i)%pio_stride = min(npets, default_stride)
             endif
          
             call NUOPC_CompAttributeGet(gcomp(i), name="pio_numiotasks", value=cval, rc=rc)
             if (chkerr(rc,__LINE__,u_FILE_u)) return
             read(cval, *) pio_comp_settings(i)%pio_numiotasks
          
             if(pio_comp_settings(i)%pio_numiotasks < 0 .or. pio_comp_settings(i)%pio_numiotasks > npets) then
                pio_comp_settings(i)%pio_numiotasks = max(1,npets/pio_comp_settings(i)%pio_stride)
             endif


             call NUOPC_CompAttributeGet(gcomp(i), name="pio_root", value=cval, rc=rc)
             if (chkerr(rc,__LINE__,u_FILE_u)) return
             read(cval, *) pio_comp_settings(i)%pio_root
          
             if(pio_comp_settings(i)%pio_root < 0 .or. pio_comp_settings(i)%pio_root > npets) then
                pio_comp_settings(i)%pio_root = 0
             endif
          endif

I guess we could add

if( (pio_comp_settings(i)%pio_root + (pio_comp_settings(i)%pio_numiotasks-1)*pio_comp_settings(i)%pio_stride > npets) then
                pio_comp_settings(i)%pio_stride = (npets-pio_comp_settings(i)%pio_root)/(pio_comp_settings(i)%pio_numiotasks-1)
             endif

Or throw an error if the condition fails. Shall we do this in the CESM share, or payu, or both ?

@minghangli-uni
Copy link
Contributor

I think there is a bug here. See this payu-org/payu#496 (comment)

@anton-seaice
Copy link
Contributor Author

Closed through payu-org/payu#496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mediator Related to the CMEPS mediator priority:low
Projects
None yet
Development

No branches or pull requests

2 participants