Skip to content

Bug fix: zero-length write request to a record variable in a collective put API - #239

Open
wkliao wants to merge 3 commits into
Parallel-NetCDF:masterfrom
wkliao:zero_put_rec
Open

Bug fix: zero-length write request to a record variable in a collective put API#239
wkliao wants to merge 3 commits into
Parallel-NetCDF:masterfrom
wkliao:zero_put_rec

Conversation

@wkliao

@wkliao wkliao commented Sep 3, 2026

Copy link
Copy Markdown
Member

This PR fixes the issue reported in #238

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, provided by Blaise Bourdin, 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant