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: Brian Austin (baustin_at_[hidden])
Date: 2009-02-18 14:10:51

>> Can you confirm - are you -really- using 1.1.2???
>> You might consider updating to something more recent, like 1.3.0 or
>>at least 1.2.8. It would be interesting to know if you see the same
>> problem.

> Also, if you could include a short program that reproduces the
> problem, that would be most helpful.

thanks for your replies.

It's true, I was using 1.1.2.
I just switched to 1.3 and I see the same behavior.
Here's a sample program.

main( int argc, char *argv[]){

  char a2_buff[3] = "aa";
  char b1_buff[2] = "b";

  MPI_File fh;
  MPI_Status status;

  MPI_Init( &argc, &argv );

  //write long file aa
  MPI_File_open( MPI_COMM_WORLD, "foo.txt",
               MPI_INFO_NULL, &fh );

  MPI_File_write_ordered( fh, a2_buff, 2, MPI_BYTE, &status );

  MPI_File_close( &fh );
  //foo.txt now says "aa"

  //write short file b
  MPI_File_open( MPI_COMM_WORLD, "foo.txt",
               MPI_INFO_NULL, &fh );

  MPI_File_write_ordered( fh, b1_buff, 1, MPI_BYTE, &status );

  MPI_File_close( &fh );
  //foo.txt now says "ba"
  //but I expect it to say "b"


  return 0;