Next: ncmpi_delete, Previous: ncmpi_inq_header_extent, Up: Files [Index]
This API synchronizes the number of records among all processes and flush it to the file.
This API is useful when the file is in independent data mode. In independent mode, some processes’ writes may cause the number of records increased but others may not. To ensure all processes have an up-to-date value of number of records, users should call this API to update/synchronize the value among all processes and the file.
This API has no effect while the file is in collective data mode, because the number of records is always synchronized in collective mode.
This API is collective and can only be called in data mode (collective or independent).
int ncmpi_sync_numrecs(int ncid);
ncid
NetCDF ID, from a previous call to ncmpi_open or ncmpi_create.
ncmpi_sync_numrecs returns the value NC_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:
Here is an example using ncmpi_sync_numrecs.
#include <pnetcdf.h> ... int ncid, varid, err; ... err = ncmpi_create(MPI_COMM_WORLD, "foo.nc", NC_CLOBBER, MPI_INFO_NULL, &ncid); if (err != NC_NOERR) handle_error(err); ... err = ncmpi_enddef(ncid); /* exit define mode */ if (err != NC_NOERR) handle_error(err); ... err = ncmpi_put_vara_int_all(ncid, varid, ...); err = ncmpi_put_vars_float_all(ncid, varid, ...); err = ncmpi_put_var_short_all(ncid, varid, ...); ... err = ncmpi_sync_numrecs(ncid); if (err != NC_NOERR) handle_error(err); ...
Next: ncmpi_delete, Previous: ncmpi_inq_header_extent, Up: Files [Index]