Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] Generic Type
From: Massimo Cafaro (massimo.cafaro_at_[hidden])
Date: 2009-03-30 12:36:08


Dear Gabriele,

to the best of my knowledge the MPI standard does not provide such a
function.
The reason is that when calling MPI_Gather, the standard requires
matching type signatures (i.e., the sendcount and sendtype argument on
each of the non root processes must match the recvcount and recvtype
arguments at the root process). This still allows having disting type
maps (type and displacement pairs) at a sender process and at the root
process, but it is a feature seldom used in practice, at least in my
experience.

Therefore, you must know in advance the datatype you are receiving
even in the case this datatype is a derived datatype.
If not, the likely outcome is that the receive buffer at the root
process gets overwritten, which causes MPI_Gather to return an error.

Due to the signature of the MPI_Gather function, the only possibility
I see to achieve what you are trying to do is to use the MPI_BYTE
datatype, and use the communicator argument to distinguish between a
collective gather in which you receive MPI_INT, MPI_DOUBLE etc. Of
course I would not create nor recommend to create new communicators
for this purpose only.

Kind regards,
Massimo

On 30/mar/09, at 17:43, Gabriele Fatigati wrote:

> Dear OpenMPI developers,
> i'm writing an MPI_Gather wrapper to collect void elements. My
> queation is: is there a portable way to know the type of received
> elements, like MPI_INT or MPI_DOUBLE? I've noted that i can retrieve
> this information by ompi_datatype_t-> name field, but i think isn't
> portable. Is there aMPI function that does this check?
>
> --
> Ing. Gabriele Fatigati
>
> Parallel programmer
>
> CINECA Systems & Tecnologies Department
>
> Supercomputing Group
>
> Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy
>
> www.cineca.it Tel: +39 051 6171722
>
> g.fatigati [AT] cineca.it
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users

-- 
*******************************************************************************************************
  Massimo Cafaro, Ph.D.                              Additional  
affiliations:
  Assistant Professor                                     National  
Nanotechnology Laboratory (NNL/CNR-INFM)
  Dept. of Engineering for Innovation         Euro-Mediterranean  
Centre for Climate Change
  University of Salento, Lecce, Italy            SPACI Consortium
  Via per Monteroni                                        E-mail massimo.cafaro_at_[hidden]
  73100 Lecce, Italy						                        cafaro_at_[hidden]
  Voice  +39 0832 297371 					                        cafaro_at_[hidden]
  Fax +39 0832 298173
  Web     http://sara.unisalento.it/~cafaro
*******************************************************************************************************