Next: , Previous: , Up: Files   [Index]


2.18 Enter independent data mode: ncmpi_begin_indep_data

This API leaves the netCDF data set from collective data mode and enters into independent data mode.

Operational Mode

This API is a collective subroutine.

This API must be called while the file is in collective data mode. Starting from version 1.2.0, if called in the independent mode, this API takes no effect and returns NC_NOERR immediately.

Usage

int ncmpi_begin_indep_data (int ncid);
ncid

NetCDF ID, from a previous call to ncmpi_open or ncmpi_create.

Return Error Codes

ncmpi_begin_indep_data returns the value NC_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:

Example

Here is an example using ncmpi_put_vara_double_all in collective data mode and ncmpi_put_vara_double in independent data mode.

#include <pnetcdf.h>
   ... 
int  err;                       /* error status */
int  ncid;                      /* netCDF ID */
int  varid;                     /* variable ID */
MPI_Offset start[3], count[3];
double *buf;                    /* array to hold values */
    ...
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);
if (err != NC_NOERR) handle_error(err);
   ...
/* collectively write values into netCDF variable */
err = ncmpi_put_vara_double_all(ncid, varid, start, count, buf);
if (err != NC_NOERR) handle_error(err);
   ...
/* entering independent data mode */
err = ncmpi_begin_indep_data(ncid);
if (err != NC_NOERR) handle_error(err);
   ...
/* independently write values into netCDF variable */
err = ncmpi_put_vara_double(ncid, varid, start, count, buf);
if (err != NC_NOERR) handle_error(err);
   ...
/* exiting independent data mode */
err = ncmpi_end_indep_data(ncid);
if (err != NC_NOERR) handle_error(err);

Next: , Previous: , Up: Files   [Index]