Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Next: , Previous: nc__open, Up: Datasets



2.10 Open a NetCDF Dataset for Parallel Access

This function opens a netCDF-4 dataset for parallel access.

This opens the file using either MPI-IO or MPI-POSIX. The file must be a netCDF-4 file. (That is, it must have been created using NC_NETCDF4 in the creation mode).

This function is only available if netCDF-4 was configured with the –use-parallel option before being built. Also HDF5 parallel must be installed (before netCDF-4 is installed.)

Before either HDF5 or netCDF-4 can be installed with support for parallel programming, and MPI layer must also be installed on the machine, and usually a parallel file system.

NetCDF-4 exposes the parallel access functionality of HDF5. For more information about what is required to install and use the parallel access functions, see the HDF5 web site.

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

Usage

     int nc_open_par(const char *path, int mode, MPI_Comm comm,
                     MPI_Info info, int *ncidp);
path
File name for netCDF dataset to be opened.
omode
Either the NC_MPIIO or NC_MPIPOSIX flags must be present.

The flag NC_WRITE opens the dataset with read-write access. ("Writing" means any kind of change to the dataset, including appending or changing data, adding or renaming dimensions, variables, and attributes, or deleting attributes.)

All other flags are ignored or not allowed. The NC_NETCDF4 flag is not required, as the file type is detected when the file is opened.

comm
MPI_Comm object returned by the MPI layer.
info
MPI_Info object returned by the MPI layer, or NULL if MPI-POSIX access is desired.
ncidp
Pointer to location where returned netCDF ID is to be stored.

Return Codes

NC_NOERR
No error.
NC_ENOTNC4
Not a netCDF-4 file.
The specified netCDF dataset does not exist.
A meaningless mode was specified.

Example

Here is an example using nc_open_par to open an existing netCDF dataset named foo.nc for read-only, non-shared, MPI/IO access:

     #include <netcdf.h>
        ...
     int status;
     int ncid;
     int *chunksize;
        ...
     
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690