Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] bug in MPI_File_set_view?
From: CANELA-XANDRI Oriol (Oriol.CAnela-Xandri_at_[hidden])
Date: 2014-05-14 09:52:53


I am using MPI IO for writing/reading a block cyclic distribution matrix into a file.

It works fine except when there is some MPI threads with no data (i.e. when the matrix is small enough, or the block size is big enough that some processes in the grid do not have any matrix block). In this case, I receive an error when calling MPI_File_set_view saying that the data cannot be freed. I tried with 1.3 and 1.6 versions. When I try with MPICH it works without errors. Could this be a bug?

My function is (where nBlockRows/nBlockCols define the size of the blocks, nGlobRows/nGlobCols define the global size of the matrix, nProcRows/nProcCols define the dimensions of the process grid, and fname is the name of the file.):

void Matrix::writeMatrixMPI(std::string fname) {
  int dims[] = {this->nGlobRows, this->nGlobCols};
  int dargs[] = {this->nBlockRows, this->nBlockCols};
  int dim[] = {communicator->nProcRows, communicator->nProcCols};
  char nat[] = "native";
  int rc;
  MPI_Datatype dcarray;
  MPI_File cFile;
  MPI_Status status;

  MPI_Type_create_darray(communicator->mpiNumTasks, communicator->mpiRank, 2, dims, distribs, dargs, dim, MPI_ORDER_FORTRAN, MPI_DOUBLE, &dcarray);
  std::vector<char> fn(fname.begin(), fname.end());
    std::stringstream ss;
    ss << "Error: Failed to open file: " << rc;
    misc.error(ss.str(), 0);
    MPI_File_set_view(cFile, 0, MPI_DOUBLE, dcarray, nat, MPI_INFO_NULL);
    MPI_File_write_all(cFile, this->m, this->nRows*this->nCols, MPI_DOUBLE, &status);

Best regards,


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.