This function opens a netCDF-4 dataset for parallel access.
For netcdf-4/HDF5 files, the HDF5 library parallel I/O is used. This opens the file using either MPI-IO or MPI-POSIX.
DAP access is not allowed with parallel I/O.
When netCDF opens a file for parallel access, collective operations are the default. To use independent access on a variable, See nc_var_par_access.
int nc_open_par(const char *path, int mode, MPI_Comm comm, MPI_Info info, int *ncidp);
path
omode
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
info
ncidp
NC_NOERR
Here is an example (from nc_test4/tst_parallel2.c) using nc_open_par.
/* Reopen the file and check it. */ if (nc_open_par(file_name, NC_NOWRITE, comm, info, &ncid)) ERR; /* Read all the slabs this process is responsible for. */ for (i = 0; i < NUM_SLABS / mpi_size; i++) { start[0] = NUM_SLABS / mpi_size * mpi_rank + i; /* Read one slab of data. */ if (nc_get_vara_int(ncid, varid, start, count, data_in)) ERR; }