LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Rola Alame (rolasa1_at_[hidden])
Date: 2006-09-29 14:55:43


I'm trying to scatter a two dimensional array by rows, i.e. first x rows go to processor 0, second x rows go to processor 1... and i'm trying to receive these rows in a corresponding array(but starting from the second row). but it just doesn't seem to work. i have an array bigboard of xlocal*size rows and ylocal columns, and i'm trying to distribute it onto subboard of xlocal rows and ylocal columns.
 
I've tried every combination i can think of:
 
MPI_Scatter (bigboard, xlocal*ylocal , MPI_INT, &subboard[1], xlocalx*ylocal, MPI_INT, size-1, MPI_COMM_WORLD);
MPI_Scatter (bigboard[0], xlocal*ylocal , MPI_INT, &subboard[1], xlocalx*ylocal, MPI_INT, size-1, MPI_COMM_WORLD);
 
I've even tried creating a "row" datatype:
 MPI_Type_contiguous(localy, MPI_INT, &row);
 MPI_Type_commit(&row);
and use the following:
MPI_Scatter (bigboard, xlocal, row, &subboard[1], xlocal, row, size-1, MPI_COMM_WORLD);
MPI_Scatter (bigboard[0], xlocal , row, &subboard[1], xlocalx, row, size-1, MPI_COMM_WORLD);
 
everything causes one of the processors to exit with a return value other than 0.
 
This one doesn't, but it doesn't populate the arrays right.
 MPI_Scatter (bigboard,xlocal , row ,subboard[1], xlocal, row, size-1, MPI_COMM_WORLD);
all rows in subboard remain the same except the second one, which is popoulated with the pointers bigboard[0] to bigboard[xlocal] which are just addresses.
 
I've looked everywhere on the web (including other messages in this list) and tried all suggestions and still had problems. Can someone explain to me what is the correct way to use scatter on a 2d array so i can make sense of what's going on? Thanks.
 
Rolasa