Repository navigation
Bug fix: zero-length write request to a record variable in a collective put API - #239
Conversation
varp is needed to tell if a variable is a record variable. With this change, varid must be valid when reaching to put_varm(). Another fix is required to return error earlier in dispatcher when a invalid varid is detected.
When writing to a record variable, a collective call to MPI_Allreduce() is necessary to update and sync-ed the number of records among all processes. For fix-sized variables, such a call to MPI_Allreduce() is not necessary. The argument varid of a put API supplied by the user may point to either a fix-sized or record variable. Because there is no way to tell if an invalid varid is a fix-sized variable or a record variable, there is no consistent if-condition can be devised to determine whether to call MPI_Allreduce(). The solution adopted by this commit adds a call to MPI_Allreduce() to check the error returned from sanity_check(), which unfortunately adds some communication cost. Luckily, this fix is only necessary for collective blocking put APIs.
…put API This test program was provided by Blaise Bourdin (and revised a little). It calls a collective blocking put API to write to a record variable where one of the processes makes a zero-length request. When writing to a record variable, PnetCDF calls MPI_Allreduce to update and sync the number of records among all processes. If a subset of the processes has a zero-length request, these processes may not participate the call to MPI_Allreduce, causing program to hang. See PR Parallel-NetCDF#239.
|
@wkliao Thanks for your fix. I can confirm that this closed a long-standing bug in my fracture code. Out of curiosity, do you have a tentative date for your next release? Ideally, I'd like to be able to push a patch to PETSc so that it can use a point release instead of pointing to a commit. |
|
Sure, I can do that. I am curious if you would like to give PnetCDF's nonblocking APIs a try. |
It is to test a collective blocking put API that writes to a record variable where one of the processes makes a zero-length request. It is used to test PR #239
|
Thing is that I use pnetcdf through exodusII, but if you point me towards an example or some documentation pages, I'd be happy to see if we could update exodusII to use nonblocking IO |
|
There is a short usage comparison of nonblocking and blocking APIs in Example programs in C can be found in examples/C/nonblocking_write.c Please let me know if you have questions or need further information. I recently collected some performance numbers using the I/O kernels from |
|
Below is a short code fragment, for illustrating how to call nonblocking APIs. |
|
Thanks for the link. "I" have added non-blocking IO to the exodusII library sandialabs/seacas#928 |
|
Hi, @bourdin |
|
You are right, the zero-length but does not affect the non-blocking APIs, and the speedup I observed in 1.15.0 is consistent with that of 1.15.1. |
|
Thanks for confirming it. I will make the new release in a day or two. |
|
@bourdin FYI. PnetCDF 1.15.1 was released today (Sep. 18, 2026) |
This PR fixes the issue reported in #238