Hi,

We have a tool where all workers will use MPI_File_write_shared() on a
file that was opened with MPI_MODE_APPEND, mostly because rank 0 will
have written some format specific header data.

We recently upgraded our openmpi version from v1.10.4 to v2.0.1. And
at that time we noticed a behaviour change ... ompio do not show the
same result as romio with the attached code.

njoly@tars-submit0 [tmp/mpiio]> mpirun --version
mpirun (Open MPI) 2.0.1
[...]
njoly@tars-submit0 [tmp/mpiio]> mpirun -n 1 --mca io romio314 ./openappend
njoly@tars-submit0 [tmp/mpiio]> echo $?
0
njoly@tars-submit0 [tmp/mpiio]> cat openappend.test
Header line
Data line
njoly@tars-submit0 [tmp/mpiio]> mpirun -n 1 --mca io ompio ./openappend
njoly@tars-submit0 [tmp/mpiio]> echo $?
0
njoly@tars-submit0 [tmp/mpiio]> cat openappend.test
Data line
e

With ompio, it seems that, for some reason, the shared file pointer
was reset/initialised(?) to zero ... leading to an unexpected write
position for the "Data line" buffer.

Thanks in advance.
Regards.

-- 
Nicolas Joly

Cluster & Computing Group
Biology IT Center
Institut Pasteur, Paris.
#include <assert.h>
#include <string.h>

#include <mpi.h>

#define PATH "openappend.test"
#define HEAD "Header line\n"
#define DATA "Data line\n"

int main(int argc, char **argv) {
  int res, proc, rank;

  MPI_Comm self = MPI_COMM_SELF, wrld = MPI_COMM_WORLD;
  MPI_File fh;
  MPI_Info info = MPI_INFO_NULL;
  MPI_Status stat;

  res = MPI_Init(&argc, &argv);
  assert(res == MPI_SUCCESS);
  res = MPI_Comm_size(MPI_COMM_WORLD, &proc);
  assert(res == MPI_SUCCESS);
  res = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  assert(res == MPI_SUCCESS);

  if (rank == 0) {
    (void)MPI_File_delete(PATH, MPI_INFO_NULL);
    res = MPI_File_open(self, PATH, MPI_MODE_CREATE|MPI_MODE_WRONLY, info, &fh);
    assert(res == MPI_SUCCESS);
    res = MPI_File_write(fh, HEAD, strlen(HEAD), MPI_CHAR, &stat);
    assert(res == MPI_SUCCESS);
    res = MPI_File_close(&fh);
    assert(res == MPI_SUCCESS); }

  res = MPI_File_open(wrld, PATH, MPI_MODE_WRONLY|MPI_MODE_APPEND, info, &fh);
  assert(res == MPI_SUCCESS);
  res = MPI_File_write_shared(fh, DATA, strlen(DATA), MPI_CHAR, &stat);
  assert(res == MPI_SUCCESS);
  res = MPI_File_close(&fh);
  assert(res == MPI_SUCCESS);

  res = MPI_Finalize();
  assert(res == MPI_SUCCESS);

  return 0; }
_______________________________________________
users mailing list
users@lists.open-mpi.org
https://rfd.newmexicoconsortium.org/mailman/listinfo/users

Reply via email to