Next: , Previous: , Up: Files   [Index]


2.26 Obtain the MPI Info object that contains all the I/O hints currently used: ncmpi_inq_file_info

The function ncmpi_inq_file_info returns an MPI info object containing all the file hints used by PnetCDF library.

Operational Mode

This API is an independent subroutine and can be called while the file is in either define or data mode (collective or independent).

Usage

int ncmpi_inq_file_info(int       ncid,
                        MPI_Info *info_used);
ncid

NetCDF ID, from a previous call to ncmpi_open or ncmpi_create.

info_used

MPI info object, containing file hints used by PnetCDF library. Note that the returned file hints may be different from the ones set by users, as PnetCDF adjusts the hint values based on some information available from the file system underneath. The user is responsible for freeing info_used via calling MPI_Info_free().

Return Error Codes

ncmpi_inq_file_info returns the value NC_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:

Example

Here is an example using ncmpi_inq_file_info.

#include <pnetcdf.h>
   ...
int ncid, status, i, nkeys;
MPI_Info info_used;
   ...
status = ncmpi_inq_file_info(ncid, &info_used);
if (status != NC_NOERR) handle_error(status);

MPI_Info_inq_nkeys(info_used, &nkeys);
printf("MPI File Info: nkeys = %d\n",nkeys);
for (i=0; i<nkeys; i++) {
    char key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL];
    int  valuelen, flag;

    MPI_Info_get_nthkey(info_used, i, key);
    MPI_Info_get_valuelen(info_used, key, &valuelen, &flag);
    MPI_Info_get(info_used, key, valuelen+1, value, &flag);
    printf("MPI File Info: [%2d] key = %25s, value = %s\n",i,key,value);
}
MPI_Info_free(&info_used);

Full example C program


Next: , Previous: , Up: Files   [Index]