Basic file operations
First we will look at the calls that are used to create, open, and close files.
Create:
int ncmpi_create(MPI_Comm comm, const char *fname, int mode, MPI_Info info, int *id)
Open:
int ncmpi_open(MPI_Comm comm, const char *fname, int mode, MPI_Info info, int *id)
Both create and open are collective calls over the MPI communicator comm.
The mode parameter for ncmpi_create()
can be any flags such as NC_CLOBBER
(create or overwrite a file) or NC_NOCLOBBER
(create only if the file does not exist).
In the case of ncmpi_open()
, the mode can be used to open a file as NC_WRITE
(for modification) or NC_NOWRITE
(read-only).
The info object provides a mechanism to pass I/O hints such as alignments of variables and file layout.
Hints are of type MPI_Info
, and they are based on the same syntax as MPI-IO.
Close:
int ncmpi_close(int id)