PnetCDF and NetCDF-4


A brief history: In the fall of 2008, UCAR released NetCDF4, which took the HDF5 file format and features, and put the serial netCDF interface on top of that. UCAR modified the serial netCDF API to expose some of the new features HDF5 introduced, including a means for parallel I/O.

Some software engineering gave NetCDF-4 the concept of a separation between interface and file format (netCDF API, legacy netCDF or new HDF5 file format). Soon, UCAR extended this interface and gave NetCDF-4 the ability to use PnetCDF. Now, with some caveats, the classic netCDF API can read and write the classic netCDF file format either using the classic netCDF library or our PnetCDF library.

We think this is terrific, and in no way has UCAR usurped or challenged PnetCDF with this move. Instead, UCAR has provided a valuable option to applications developers. In order to transition to parallel I/O, the typical "file per process" or "all I/O from rank 0" approaches need to be re-thought, no matter which underlying library will carry out the I/O. Applications accustomed to serial netCDF can try out PnetCDF while still using an API familiar to them. If they want to use some of the more sophisticated PnetCDF features, or try out PnetCDF down the road, only minor edits to the names of the functions will be needed -- the application has already done the hard work of domain decomposition.

Interoperability of PnetCDF with netCDF-4

Starting from version 4.2.1.1, netCDF-4 program can perform parallel I/O on the classic CDF-1 and CDF-2 files through PnetCDF. Starting from version 4.4.0, the CDF-5 format is supported. This is done by passing file create mode NC_PNETCDF to nc_create_par(), for instance,

nc_create_par(filename, NC_PNETCDF|NC_64BIT_OFFSET, MPI_COMM_WORLD, info, &ncid);
creates a file in CDF-2 format.

Check the netCDF-4 example programs in C and Fortran.

Starting from 4.6.2, NetCDF simply checks the create mode flag, i.e. NC_64BIT_OFFSET, NC_64BIT_DATA, or 0, when creating a new file in classic formats (CDF-1, 2, or 5) and can automatically dispatch the PnetCDF library to perform the parallel I/O. For opening an existing file (a call to nc_open_par), NetCDF first checks the file format and if the file is in classic format, PnetCDF library is dispatched. Otherwise HDF5 library is used.

Note: Currently, using PnetCDF mode is the only way for a netCDF program to perform parallel I/O on files in classic CDF-1, 2, and 5 formats.


Return to PnetCDF Home