Next: , Previous: nc__create, Up: Datasets


2.7 Create a NetCDF Dataset With Performance Options: nc_create_par

This function is a variant of nc_create, nc_create_par allows users to open a file on a MPI/IO or MPI/Posix parallel file system.

The parallel parameters are not written to the data file, they are only used for so long as the file remains open after an nc_create_par.

This function creates a new netCDF dataset, returning a netCDF ID that can subsequently be used to refer to the netCDF dataset in other netCDF function calls. The new netCDF dataset opened for write access and placed in define mode, ready for you to add dimensions, variables, and attributes.

If the NC_NETCDF4 flag is used, the HDF5 library is used for parallel I/O. If not, the parallel-netcdf library is used.

When a file is created for parallel access, collective operations are the default. To use independent access on a variable, See nc_var_par_access.

Usage

     int nc_create_par(const char *path, int cmode, MPI_Comm comm,
                       MPI_Info info, int ncidp);
path
The file name of the new netCDF dataset.
cmode
Either the NC_MPIIO or NC_MPIPOSIX flags may be present if the NC_NETCDF4 flag is used.

The NC_SHARE flag is ignored.

comm
The MPI_Comm object returned by the MPI layer.
info
The MPI_Info object returned by the MPI layer, if MPI/IO is being used, or 0 if MPI/Posix is being used.
ncidp
Pointer to location where returned netCDF ID is to be stored.

Return Codes

NC_NOERR
No error.
NC_EPARINIT
Could not initialize parallel access at the HDF5 layer.
NC_EFILEMETA
HDF5 layer cannot handle create or root group open.
NC_EEXIST
Specifying a dataset name of a file that exists and also specifying NC_NOCLOBBER.
NC_EINVAL
Bad value for the creation mode.
NC_EHDFERR
Unexpected error from the HDF5 layer.

Examples

     #include <netcdf.h>
        ...
     int status;
     int ncid;
        ...
     *bufrsize = 1024;
     status = nc__create("foo.nc", NC_NOCLOBBER, initialsz, bufrsize, &ncid);
     if (status != NC_NOERR) handle_error(status);