LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: XMATX_at_[hidden]
Date: 2007-09-02 14:29:33


Hello,

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?

my function looks this:

struct Complex {double r; double i;};

void Class<T>::fct(Matrix<T> *m)
{
     MPI_Send(buf, len, T, requestor, send_tag, world)
}

Sure this does not work because of the T type.
How could i implement the MPI_Send - function only once, both for a buffer holding double values
and for a buffer holding Complex values?

Are derived datatypes the solution? If so - a bit help would be very fine.

Thanks a lot
_______________________________________________________________________
Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220