Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] How to "guess" the incoming data type ?
From: Trent Creekmore (mtcreekmore_at_[hidden])
Date: 2010-04-25 14:11:14


I don't think there is a way to guess, that is why most languages use a
naming type (i.e.: int, float, etc) to explicitly tell what the type is. If
this app is letting them enter whatever they want and without knowing more
about this application, then I could assume it is giving them the type of
string as languages such as Visual Basic, Visual C++ and C# do in the GUI.

-----Original Message-----
From: users-bounces_at_[hidden] [mailto:users-bounces_at_[hidden]] On
Behalf Of Sylvestre Ledru
Sent: Sunday, April 25, 2010 8:46 AM
To: users_at_[hidden]
Subject: [OMPI users] How to "guess" the incoming data type ?

Hello,

I am currently extending an application with MPI capabilities.
This high-level application allows users to use dynamic types. Therefor,
on the slaves, I have no way to know what the master will send me.

Therefor, in the slave side, I need to "guess" what I am receiving.

For example, I am using contiguous data on the master defined this way:

MPI_Datatype matrixOfDouble;
MPI_Type_contiguous(size, MPI_DOUBLE, &matrixOfDouble);
MPI_Type_commit(&matrixOfDouble);

sent this way:
double A[] = {1,3,3,2,3,4};
MPI_Send(&A, 1, matrixOfDouble, i, TAG, MPI_COMM_WORLD);

On the slave, in my example, since I know I am going to receive a
matrixOfDouble, I can do the following:
MPI_Probe( MPI_ANY_SOURCE, TAG, MPI_COMM_WORLD, &stat );
MPI_Get_elements( &stat, matrixOfDouble, &count);
double BRecv[count];
MPI_Recv(BRecv, BUFSIZE, matrixOfDouble, i, TAG, MPI_COMM_WORLD, &stat)

I would like to know if (and how) it is possible on the slave side to
know that the received type is matrixOfDouble ?

If it is not possible, is there any other way in MPI ?
(I would like to avoid a extra master=> slave message to send the type).

Thanks
Sylvestre

_______________________________________________
users mailing list
users_at_[hidden]
http://www.open-mpi.org/mailman/listinfo.cgi/users