propose a new API ncmpi_get_file_info()
Wei-keng Liao
wkliao at ece.northwestern.edu
Wed Jul 4 02:11:56 CDT 2007
I just found the error checking is not right. Here is the revised
version. Also, the Fortran implementation is also provided below.
(I know the fortran file is automatically generated, but I don't know
where stores the source files.) Some header files, like lib/pnetcdf.h,
libf/mpifnetcdf.h and Makefiles, also need to update.
Wei-keng
---- in mpinetcdf.c ----------------------------------------------------
int
ncmpi_get_file_info(int ncid, MPI_Info *info_used) {
int status = NC_NOERR;
int mpireturn;
NC *ncp;
status = ncmpii_NC_check_id(ncid, &ncp);
if (status != NC_NOERR)
return status;
mpireturn = MPI_File_get_info(ncp->nciop->collective_fh, info_used);
if (mpireturn != MPI_SUCCESS) {
int rank;
char errorString[512];
int errorStringLen;
MPI_Comm_rank(ncp->nciop->comm, &rank);
MPI_Error_string(mpireturn, errorString, &errorStringLen);
printf("%2d: MPI_File_get_info error = %s\n", rank, errorString);
return NC_EFILE;
}
return status;
}
---- new file libf/get_file_infof.c -------------------------------------
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
* (C) 2001 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*
* This file is automatically generated by buildiface
-infile=../lib/pnetcdf.h -deffile=defs
* DO NOT EDIT
*/
#include "mpinetcdf_impl.h"
#ifdef F77_NAME_UPPER
#define nfmpi_get_file_info_ NFMPI_GET_FILE_INFO
#elif defined(F77_NAME_LOWER_2USCORE)
#define nfmpi_get_file_info_ nfmpi_get_file_info__
#elif !defined(F77_NAME_LOWER_USCORE)
#define nfmpi_get_file_info_ nfmpi_get_file_info
/* Else leave name alone */
#endif
/* Prototypes for the Fortran interfaces */
#include "mpifnetcdf.h"
FORTRAN_API int FORT_CALL nfmpi_get_file_info_ ( MPI_Fint *v1, MPI_Fint *v2 ){
int ierr;
MPI_Info info;
ierr = ncmpi_get_file_info( *v1, &info );
*v2 = MPI_Info_c2f(info);
return ierr;
}
On Tue, 3 Jul 2007, Wei-keng Liao wrote:
>
> I propose a new API to obtain the MPI file info object from an opened netcdf
> dataset. The syntax and implementation of this API are given below. This code
> segment can be added into mpinetcdf.c and the API declaration added in header
> file pnetcdf.h. This API may enable IOR benchmark to provide showHints
> option.
>
> Wei-keng
>
>
> int
> ncmpi_get_file_info(int ncid, MPI_Info *info_used) {
> int status = NC_NOERR;
> int mpireturn;
> NC *ncp;
>
> status = ncmpii_NC_check_id(ncid, &ncp);
> if (status != NC_NOERR)
> return status;
>
> mpireturn = MPI_File_get_info(ncp->nciop->collective_fh, info_used);
> if (mpireturn != MPI_SUCCESS) {
> int rank;
> MPI_Comm_rank(ncp->nciop->comm, &rank);
> ncmpii_handle_error(rank, mpireturn, "MPI_File_sync");
> MPI_Finalize();
> return NC_EFILE;
> }
> return status;
> }
>
>
More information about the parallel-netcdf
mailing list