E3SM-Project / E3SM-Project/scorpio

Unable to set buffer size limit to 0 in PIO2

Open
#103 1 comment 0 reactions 1 assignee Claimed by @jayeshkrishna View on GitHub
bug
Dominant language
C++
Stars
22
Forks
20
Avg merge
12d 19m
Merged PRs (30d)
1

Description

The Fortran unit test nc_wr_buf_limit_zero (defined in tests/general/pio_buf_lim_tests.F90.in) tries to set buffer size limit to 0:
`call pio_set_buffer_size_limit(PIO_BUFFER_SZ_ZERO)`

However, this does not work as expected. The reason is that there is a logic to prevent PIO2 from setting buffer size limit to 0 or negative values.
```
PIO_Offset PIOc_set_buffer_size_limit(PIO_Offset limit)
{
...
/* If the user passed a valid size, use it. */
if (limit > 0)
pio_buffer_size_limit = limit;
...
}
```
In PIO1, we are able to set buffer size limit to 0:
```
subroutine pio_set_buffer_size_limit_i4(limit)
integer, intent(in) :: limit

if(limit<0) then
call piodie(__PIO_FILE__,__LINE__,&
' bad value to pio_set_buffer_size_limit')
end if
pio_buffer_size_limit=limit

end subroutine pio_set_buffer_size_limit_i4
```

Also, in ESMCI/cime code (src/share/util/shr_pio_mod.F90), 0 is a valid value of pio_buffer_size_limit
```
subroutine shr_pio_init2(comp_id, comp_name, comp_iamin, comp_comm, comp_comm_iam)
...
! 0 is a valid value of pio_buffer_size_limit
if(pio_buffer_size_limit>=0) then
if(comp_comm_iam(1)==0) then
write(shr_log_unit,*) 'Setting pio_buffer_size_limit : ',pio_buffer_size_limit
end if
call pio_set_buffer_size_limit(pio_buffer_size_limit)
endif
...
```

We should update the logic in PIOc_set_buffer_size_limit such that users are able to set the buffer size limit to 0 to prevent PIO2 from caching user data.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.