[mpich-discuss] please Help me............

Dorian Krause ddkrause at uni-bonn.de
Thu Aug 6 13:32:52 CDT 2009


Hi Vineet,

what is the template parameter of your vector? If it is just a double or 
float or another pod type you can safely do

MPI_Send(&vec[0], ...)

On the receive side you would have to probe the incoming message using 
MPI_Probe - Retrieve the message length from the status variable and 
then call

vec.resize(...)
MPI_Recv(&vec[0], ...)

Note that boost::MPI 
(http://www.boost.org/doc/libs/1_39_0/doc/html/mpi.html) allows you to 
send a vector without such "tricks".

Hope this helps.
Dorian


Vineet Pratap wrote:
> Respected Sir,
>         i am Vineet Pratap and new in MPI Programming.
>  my problem is How to send/recv a C++ STL vector with MPI?
> my STL vector is object type.
> Please reply me if there is a way to do it..............
>  Thanks to  you..
>                                   Vineet Pratap
>
> ------------------------------------------------------------------------
> Yahoo! recommends that you upgrade to the new and safer Internet 
> Explorer 8 
> <http://in.rd.yahoo.com/tagline_ie8_1/*http://downloads.yahoo.com/in/internetexplorer/>.



More information about the mpich-discuss mailing list