[MPICH] Testing File open success

Robert Latham robl at mcs.anl.gov
Fri Mar 10 09:31:03 CST 2006


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

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




More information about the mpich-discuss mailing list