Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [OMPI users] Generic Type
From: Gabriele Fatigati (g.fatigati_at_[hidden])
Date: 2009-03-31 06:16:21

OpenMPI functions like MPI_Irecv, does pointer arithmetics over recv
buffer using type info in ompi_datatype_t i suppose. I'm trying to
write a wrapper to MPI_Gather using Irecv functions:

int MPI_FT_Gather(void*sendbuf, int sendcount, MPI_Datatype sendtype,
                          int recvcount, MPI_Datatype recvtype,
                          int root, MPI_Comm comm){


for( nprocs..){

MPI_Irecv(&recvbuff[(i-1)], recvcount, recvtype, i, 0, comm,



where every proc sends 1 double. It doesn't work,( received values are
wrong) because MPI_Irecv are trying to do pointer arithmetic with void
values. In fact, if i write:

 double*buff = &recvbuff[0];

for( nprocs..){

MPI_Irecv(&buff[(i-1)], recvcount, recvtype, i, 0, comm, &array_request[i-1]);


it works well. Do you have an idea to use a portalbe way to do this?(
if is it possible)

2009/3/30 Massimo Cafaro <massimo.cafaro_at_[hidden]>:
> 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
>>                    Tel:   +39 051 6171722
>> g.fatigati [AT]
>> _______________________________________________
>> users mailing list
>> users_at_[hidden]
> --
> *******************************************************************************************************
>  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
> *******************************************************************************************************
> _______________________________________________
> users mailing list
> users_at_[hidden]

Ing. Gabriele Fatigati
Parallel programmer
CINECA Systems & Tecnologies Department
Supercomputing Group
Via Magnanelli 6/3, Casalecchio di Reno (BO) Italy                    Tel:   +39 051 6171722
g.fatigati [AT]