Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] MPI_Alltoall with Vector Datatype
From: Spenser Gilliland (spenser_at_[hidden])
Date: 2014-05-07 04:48:39


Hi,

I've recently started working with MPI and I noticed that when a
Alltoall is utilized with a vector datatype, the call only uses the
extent to determine the location for the back to back transactions.
This makes using the vector type with collective communicators
difficult.

For Example:
Using the code at the bottom. I think I should get

 0 1 8 9
 4 5 12 13
 2 3 10 11
 6 7 14 15

However, the result is

 0 1 2 3
 4 5 8 9
 6 7 10 11
 x x 14 15

Is this the way it is supposed to be?

FYI: This is version 1.6.2 in Rocks 6

Thanks,
Spenser

float A[4][4];
int wsize, wrank;
MPI_Comm_size(MPI_COMM_WORLD, &wsize); // Assume 2
MPI_Comm_rank(MPI_COMM_WORLD, &wrank);
MPI_Type_vector(4/wsize, 4/wsize, 4, MPI_FLOAT, &mpi_all_t);
MPI_Type_commit(&mpi_all_t);

for(int i = 0; i < 4; i++) for (j = 0; j < 4; j++) {
   A[i][j] = i*4+j;
}

MPI_Alltoall(A[rank*4/wsize*4], 1, mpi_all_t,
                     A[rank*4/wsize*4], 1, mpi_all_t,
                     MPI_COMM_WORLD);

for(int i = 0; i < 4; i++) {
   for (j = 0; j < 4; j++) {
      printf("%6.2g")
   }
   printf("\n");
}

-- 
Spenser Gilliland
Computer Engineer
Doctoral Candidate