Next: NF90_OPEN, Previous: NF90_CREATE, Up: Datasets
This function is a variant of nf90_create; nf90_create_par allows users to open a file on a MPI/IO or MPI/Posix parallel file system.
This function is only available if the netCDF library was built with a HDF5 library for which –enable-parallel was used, and which was linked (like HDF5) to MPI libraries.
The parallel parameters are not written to the data file, they are only used for so long as the file remains open after an nf90_create_par.
This function creates a new netCDF dataset, returning a netCDF ID that can subsequently be used to refer to the netCDF dataset in other netCDF function calls. The new netCDF dataset opened for write access and placed in define mode, ready for you to add dimensions, variables, and attributes.
This function is only available for netCDF-4 files. The creation mode flag must include NF90_NETCDF4.
When a netCDF-4 file is created for parallel access, collective operations are the default. To use independent access on a variable, See NF90_VAR_PAR_ACCESS.
function nf90_create_par(path, cmode, comm, info, ncid)
character (len = *), intent(in) :: path
integer, intent(in) :: cmode
integer, intent(in) :: comm
integer, intent(in) :: info
integer, intent(out) :: ncid
integer :: nf90_create_par
end function nf90_create_par
PATHCMODESetting NF90_NETCDF4 causes netCDF to create a netCDF-4/HDF5 format file. Oring NF90_CLASSIC_MODEL with NF90_NETCDF4 causes the netCDF library to create a netCDF-4/HDF5 data file, with the netCDF classic model enforced - none of the new features of the netCDF-4 data model may be usedin such a file, for example groups and user-defined types.
Only netCDF-4/HDF5 files may be used with parallel I/O.
MPI_COMMMPI_INFOncidNF90_CREATE returns the value NF90_NOERR if no errors occurred. Possible causes of errors include:
This example comes from the test program nf_test/f90tst_parallel.c, which is only run if –enable-parallel-tests is used with configure.
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierr)
call MPI_Comm_size(MPI_COMM_WORLD, p, ierr)
! Create the netCDF file.
mode_flag = IOR(nf90_netcdf4, nf90_classic_model)
retval = nf90_create_par(FILE_NAME, mode_flag, MPI_COMM_WORLD, &
MPI_INFO_NULL, ncid)
if (retval /= nf90_noerr) call handle_err(retval)