Registered Member
|
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. |
Registered Member
|
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) |
Registered Member
|
Thanks for your response ! Its is working now.
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]