Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] MPI Template Datatype?
From: Alexandru Blidaru (alexsb92_at_[hidden])
Date: 2010-08-09 16:27:52


Hello Riccardo,

I basically have to implement a 4D vector. An additional goal of my project
is to support char, int, float and double datatypes in the vector. I figured
that the only way to do this is through a template. Up to this point I was
only supporting doubles in my vector, and I was sending each element
individually from node to node. Since MPI_Send and MPI_Recv require the
programmer to specify which datatype to use, and since I would only use
doubles in the initial version of my project, using MPI_Send and MPI_Recv
was easy. However if I am to declare my 4D vector like this std::vector<T> ,
there will be no way for me to know which datatype to specify in the MPI_Send
and MPI_Recv commands.

No I haven't looked at Boost.MPI . I did a quick Ctrl-F of Boost.MPI in the
MPI 2.2 doc that i found here: http://www.mpi-forum.org/docs/docs.html , but
i was unable to find it. Could you point me to some resources about it? It
would be a lot easier to use that rather than send every element 1 by 1.

Thank you very much for your help.

Alex

On Mon, Aug 9, 2010 at 4:09 PM, Riccardo Murri <riccardo.murri_at_[hidden]>wrote:

> Hello Alexandru,
>
> On Mon, Aug 9, 2010 at 6:05 PM, Alexandru Blidaru <alexsb92_at_[hidden]>
> wrote:
> > I have to send some vectors from node to node, and the vecotrs are built
> > using a template. The datatypes used in the template will be long, int,
> > double, and char. How may I send those vectors since I wouldn't know what
> > MPI datatype i have to specify in MPI_Send and MPI Recv. Is there any way
> to
> > do this?
> >
>
> I'm not sure I understand what your question is about: are you asking
> what MPI datatypes you should use to send C types "long", "int", etc.,
> or are you trying to send a more complex C type ("vector")?
> Can you send some code demonstrating the problem you are trying to solve?
>
> Besides, your wording suggests that you are trying to send a C++
> std::vector<T> over MPI: have you already had a look at Boost.MPI? It
> has out-of-the-box support for STL containers.
>
> Cheers,
> Riccardo
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>

-- 
Alexandru Blidaru
University of Waterloo - Electrical Engineering '15
University email: asblidar_at_[hidden]
Twitter handle: @G_raph
Blog: http://alexblidaru.wordpress.com/