[EXTERNAL] Re: Question about ncmpi_begin_indep() and ncmpi_end_indep() symmetry
Sjaardema, Gregory D
gdsjaar at sandia.gov
Tue Nov 14 08:04:18 CST 2017
Thanks.
..Greg
On 11/13/17, 10:30 PM, "Wei-keng Liao" <wkliao at eecs.northwestern.edu> wrote:
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