Hi,

you could try the following (template):

MPI_Send( &vec[first_element],  num_elements*sizeof(T), MPI_BYTE, ..)
MPI_Recv( &vec[first_element],  num_elements*sizeof(T), MPI_BYTE, ..)

As far as I know STL vectors use contiguous memory for the values of the
vector.
However, I didn't test this and boost.mpi may be the safest solution.

Cheers

On 11/02/2011 01:28 PM, Jeff Squyres (jsquyres) wrote:
> You might want to look at boost.mpi. 
> 
> Sent from my phone. No type good. 
> 
> On Nov 1, 2011, at 2:58 PM, "Mudassar Majeed" <mudassar...@yahoo.com
> <mailto:mudassar...@yahoo.com>> wrote:
> 
>> Dear MPI people,
>>                                 I have a vector class with template as
>> follows,
>>
>> template <typename T>
>> class Vector
>>
>> It is a wrapper on the STL vector class. The element type is T that
>> will be replaced by the actual instantiated type on the runtime. I
>> have not seen any support in C++ templates for checking the type of T.
>> I need to send elements of type T that are in the Vector v; using the
>> MPI_Ssend ........ plz help me how can I do that. How can I send few
>> elements may be starting from 4th element to the 10th element in the
>> vector.
>>
>> regards,
>> Mudassar
>> _______________________________________________
>> users mailing list
>> us...@open-mpi.org <mailto:us...@open-mpi.org>
>> http://www.open-mpi.org/mailman/listinfo.cgi/users
> 
> 
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users

Reply via email to