This forum has been archived. All content is frozen. Please use KDE Discuss instead.

MPI::COMM_WORLD.Gather to an Eigen object

Tags: None
(comma "," separated)
eduardolenz
Registered Member
Posts
2
Karma
0
Hi,

I have been using Eigen for a while and now I am trying to use it with MPI. So far all my attempts have been successful, but I cannot figure out how to
perform a MPI::COMM_WORLD.Gather to an Eigen object such as a matrix or a vector.

As far I understand, the result of a Gather operation is a vector of vectors ... something like

std::vector < std::vector < double > > result.

The outer vector has the same size of the number of processes and the inner vector the size of a local vector
being send from each process.

So, a command like

MPI::COMM_WORLD.Gather (local.data(),local.size(),MPI::DOUBLE,local_root.data(), local_root.size(),MPI::DOUBLE,0);

where local is an Eigen::Matrix<double, 10,1> and local_root is an Eigen::Matrix<double, 4*10,1> (assuming 4 processes)

does not work.


Any clue ?

Thanks in advance,
Eduardo.
manuels
Registered Member
Posts
47
Karma
0
the receive_count is the number of elements for any *single* receiver
(http://www.open-mpi.org/doc/v1.5/man3/MPI_Gather.3.php)

so it must be
MPI::COMM_WORLD.Gather (local.data(),local.size(),MPI::DOUBLE,local_root.data(), local_root.size()/NPROC,MPI::DOUBLE,0);

where NPROC is the number of processes (4)
eduardolenz
Registered Member
Posts
2
Karma
0
Thanks for your response ! Its is working now.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]