PnetCDF has two modes of accessing files: definition mode, where contents of the file are described; and data mode, where the variables can be stored and retrieved. A typical usage of the PnetCDF (and netCDF) library is as follows:

  1. Create a new file
  2. Describe the file content by defining variables, dimensions and attributes
  3. Store data / read data if already stored
  4. Close the file

The next few pages cover these basic file operations using the PnetCDF API.

Data Mode Options

Parallel I/O operations can be performed independently or collectively by a set of MPI processes or tasks. The default data mode in PnetCDF is "collective". Thus, to switch from collective mode to an "independent" mode, PnetCDF provides a pair of functions in its API: ncmpi_begin_indep_data() and ncmpi_end_indep_data(). Any I/O operations performed between these calls are independent I/O operations.

Independent I/O
In an independent I/O operation, each process handles its I/O exclusively. As mentioned previously, these calls have to be enclosed within ncmpi_begin_indep_data() and ncmpi_end_indep_data() calls. The PnetCDF independent I/O calls are similar to the original netCDF calls prepended with the ncmpi_ string, for example, ncmpi_put_vara_int().
Collective I/O
The default I/O calls in PnetCDF are collective in nature. The PnetCDF collective I/O calls are similar to the original netCDF calls prepended with the ncmpi_ string and appended with _all, for example, ncmpi_put_vara_int_all().
 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement