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.

This function is only available for netCDF-4 files. The creation mode flag must include NC_NETCDF4.

When a netCDF-4 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 must be present. The NC_NETCDF4 flag is also required.

Setting NC_NOCLOBBER means you do not want to clobber (overwrite) an existing dataset; an error (NC_EEXIST) is returned if the specified dataset already exists.

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.
Passing a dataset name that includes a directory that does not exist.
Specifying a dataset name of a file that exists and also specifying NC_NOCLOBBER.
Specifying a meaningless value for the creation mode.
Attempting to create a netCDF dataset in a directory where you don't have permission to create files.

Examples

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