Question about ncmpi_begin_indep() and ncmpi_end_indep() symmetry
Wei-keng Liao
wkliao at eecs.northwestern.edu
Mon Nov 13 23:29:45 CST 2017
Hi Greg
Thanks for point out the asymmetry.
I am going to allow ncmpi_end_indep_data() in collective data mode in 1.9.0.
Will also update the C reference soon.
Wei-keng
On Nov 13, 2017, at 10:13 AM, Sjaardema, Gregory D wrote:
> In `ncmpi_begin_indep_data`, if the file is already in `indep` data mode, there is no error and the routine just returns early:
> int
> ncmpi_begin_indep_data(int ncid)
> {
> int err;
> NC *ncp;
> err = ncmpii_NC_check_id(ncid, &ncp);
> if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
> if (NC_indef(ncp)) /* must not be in define mode */
> DEBUG_RETURN_ERROR(NC_EINDEFINE)
> if (NC_indep(ncp)) /* already in indep data mode */
> return NC_NOERR;
> … deleted…
> }
>
> However, in `ncmpi_end_indep_data`, if the file is *not* in indep mode, an error is returned:
>
> int
> ncmpi_end_indep_data(int ncid) {
> int err;
> NC *ncp;
> err = ncmpii_NC_check_id(ncid, &ncp);
> if (err != NC_NOERR) DEBUG_RETURN_ERROR(err)
> if (!NC_indep(ncp)) /* must be in independent data mode */
> DEBUG_RETURN_ERROR(NC_ENOTINDEP)
> return ncmpii_end_indep_data(ncp);
> }
>
> This may be the correct behavior and there may be some reason for the asymmetry, but at first glance it seems like either both routines should return an error, or both should return NC_NOERR if the file data mode is already the same as the routine is attempting to set.
>
> Thanks,
> ..Greg
More information about the parallel-netcdf
mailing list