Reply to topic

MPI::COMM_WORLD.Gather to an Eigen object

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.

 
Reply to topic

Bookmarks



Who is online

Registered users: alake, anditosan, apater, Baidu [Spider], Bing [Bot], einar, Exabot [Bot], Google [Bot], google01103, koriun, La Ninje, lazyit, Majestic-12 [Bot], Mechatronic, mmistretta, paulus3005, pbCyanide, pedrorodriguez, random_fan, Robert Leleu, SeaJey, Sentynel, Sogatori, vascobasque, whatthefunk, Yahoo [Bot]