[MPICH] Testing File open success

William Gropp gropp at mcs.anl.gov
Fri Mar 10 10:56:40 CST 2006


At 09:31 AM 3/10/2006, Robert Latham wrote:
>On Fri, Mar 10, 2006 at 11:12:18AM +0000, James S Perrin wrote:
> >       What is the correct way to test is a file has been opened
> >       successfully using MPI_File_Open()?
>
>Here's what i do:
>
>     errcode = MPI_File_open(MPI_COMM_WORLD, filename,
>                     MPI_MODE_CREATE | MPI_MODE_RDONLY, info, &fh);
>     if (errcode != MPI_SUCCESS) {
>                 /* handle error here */
>     }
>
>i.e. you can't rely on fh, but instead have to check the return value
>of MPI_File_open.

Rob is correct.  One of the reasons is that MPI_FILE_NULL is not the same 
as NULL; it isn't necessarily a pointer (and it isn't in MPICH2).

Bill


>==rob
>
>--
>Rob Latham
>Mathematics and Computer Science Division    A215 0178 EA2D B059 8CDF
>Argonne National Labs, IL USA                B29D F333 664A 4280 315B

William Gropp
http://www.mcs.anl.gov/~gropp 




More information about the mpich-discuss mailing list