Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] MPI_File_write_ordered does not truncate files
From: Robert Latham (robl_at_[hidden])
Date: 2009-02-18 17:01:48


On Wed, Feb 18, 2009 at 02:24:03PM -0700, Ralph Castain wrote:
> Hi Rob
>
> Guess I'll display my own ignorance here:
>
>>> MPI_File_open( MPI_COMM_WORLD, "foo.txt",
>>> MPI_MODE_CREATE | MPI_MODE_WRONLY,
>>> MPI_INFO_NULL, &fh );
>
>
> Since the file was opened with MPI_MODE_CREATE, shouldn't it have been
> truncated so the prior contents were removed? I think that's the root of
> the confusion here. It appears that MPI_MODE_CREATE doesn't cause the
> opened file to be truncated, but instead just leaves it "as-is".
>
> Is that correct?

"The modes MPI_MODE_RDONLY, MPI_MODE_RDWR, MPI_MODE_WRONLY,
MPI_MODE_CREATE, and MPI_MODE_EXCL have identical semantics to their
POSIX counterparts"

MPI_MODE_CREATE behaves like O_CREATE

There is no MPI-IO flag corresponding to O_TRUNK. Guess you'd have to
MPI_FILE_SET_SIZE after MPI_FILE_OPEN

==rob

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