Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] MPI_File_write_ordered does not truncate files
From: Brian Austin (baustin_at_[hidden])
Date: 2009-02-15 17:27:08


Hi,

When I use MPI_File_write_ordered to overwrite an existing file, the new
file is not truncated to the appropriate size.
For example, if I first create a new file and write "aa" from two nodes, the
file contains "aaaa".
Then I close the file, and compute for a while.
Later, I reopen the file with amode=CREATE | WRONLY and write "b" from two
nodes, the file contains "bbaa".
I would have expected the file to contain only "bb".

Am I misunderstanding something, or is this a bug?
Now that I think about it, this seems more like a problem with
MPI_File_Open:
this is the behavior I would have expected if I had reopened the file with
amode=CREATE | RDRW.
Shouldn't MPI_File_Open truncate the file to 0 when it is opened WRONLY and
not APPEND?

I'm able to obtain my desired result by calling
MPI_File_get_position_shared()
MPI_File_set_size()

Thanks
-Brian

PS. I'm using (Open MPI) 1.1.2