wiki:PnetcdfAndNetcdf4
Last modified 4 years ago Last modified on 01/08/15 12:56:53

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. This is done by passing file create mode NC_PNETCDF to nc_create_par(), for instance,

nc_create_par(filename, NC_PNETCDF, MPI_COMM_WORLD, info, &ncid);

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

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