LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Brian Barrett (brbarret_at_[hidden])
Date: 2007-09-02 22:46:53


On Sep 2, 2007, at 12:29 PM, XMATX_at_[hidden] wrote:

> i'm using C++ with MPI and have a template function.
>
> The two template candidates can be double or a structure called
> Complex which holds two double values.
> Now i wanted to write a MPI_Send - call within this template function.
> But i have problems with the datatype-argument within the signature.
>
> Simply i cannot enter the T value for the datatype-argument so can
> it be that i need to build a derived datatype?
>
> Or do i really need two implementation of this function - one for
> the double input and one for the complex input?

Since MPI type constants don't have any special meaning or mapping to
template type parameters, you can not just pass the type parameter
into the MPI_Send as the specified datatype. The most straight
forward solution is to provide the necessary specializations so that
you can pass in the correct MPI type constant.

Hope this helps,

Brian

-- 
   Brian Barrett
   LAM/MPI Developer
   Make today a LAM/MPI day!