Discussion:
Question from newbie (ScatterV)
(too old to reply)
A K
2008-04-23 07:51:26 UTC
Permalink
I am trying to scatter columns of a matrix.

My 2-D matrix is stored in1-D array

int a[];

for example in 2 process, I am trying to send columns 1 to 5 to Rank
=0 and columns 6 to 10 to rank 1.

I was successful in doing rows using MPI_ScatterV but I couldn't do it
with columns.

Any example code with some comments will be very useful for me.

regards,
abdul
hollowman
2008-05-22 07:50:36 UTC
Permalink
Post by A K
I am trying to scatter columns of a matrix.
My 2-D matrix is stored in1-D array
int a[];
for example in 2 process, I am trying to send columns 1 to 5 to Rank
=0 and columns 6 to 10 to rank 1.
I was successful in doing rows using MPI_ScatterV but I couldn't do it
with columns.
Any example code with some comments will be very useful for me.
regards,
abdul
i encountered the same problem (am another newbie), though didnt use
the MPI_ScatterV function. only workaround was to send one element at
a time...
I too would like to know of the solution to this simple problem

regards
Prateek
David Cronk
2008-05-23 19:12:16 UTC
Permalink
Post by hollowman
Post by A K
I am trying to scatter columns of a matrix.
My 2-D matrix is stored in1-D array
int a[];
for example in 2 process, I am trying to send columns 1 to 5 to Rank
=0 and columns 6 to 10 to rank 1.
I was successful in doing rows using MPI_ScatterV but I couldn't do it
with columns.
Any example code with some comments will be very useful for me.
regards,
abdul
To do it with columns, you will need to use a derived datatype to define
what a column is. I suggest MPI_Type_vector with a stride of the
number of columns. i.e, if your matrix is m rows by n columns

MPI_Type_vector (m, 1, n, MPI_INT, &col_type)

Hope this helps.

Dave.
Post by hollowman
i encountered the same problem (am another newbie), though didnt use
the MPI_ScatterV function. only workaround was to send one element at
a time...
I too would like to know of the solution to this simple problem
regards
Prateek
--
Dr. David Cronk, Ph.D. phone: (865) 974-3735
Research Director fax: (865) 974-8296
Innovative Computing Lab http://www.cs.utk.edu/~cronk
University of Tennessee, Knoxville
Loading...