Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] MPI_Gatherv and 0 size?
From: Richard Treumann (treumann_at_[hidden])
Date: 2009-02-23 15:47:10

Hi George

I have run into the argument that in a case where the number of array
elements that will be accessed is == 0 it is "obviously" valid to pass NULL
as the array address. I recognize the argument has merit but I am not clear
that it really requires that an MPI implementation that tries to check for
an invalid data structure address must first check whether more than 0
items from it are to be accessed.

Perhaps this is something the standard should clarify. For example, must
this call to MPI_Waitall(0, NULL, NULL) return MPI_SUCCESS?

Since checking for valid send buffer or receive buffer addresses is hard, I
suspect most MPI implementations would never check whether a call to

MPI_Send(NULL, 0, my_type, 1, 1, MPI_COMM_WORLD)

has an "invalid" buffer. In this case I think the intent is that NULL
would be valid because the actual data footprint is dictated by the set of
parameters (buf, count, type). I am less sure what the answer for the
MPI_Waitall call should be.


Dick Treumann - MPI Team
IBM Systems & Technology Group
Dept X2ZA / MS P963 -- 2455 South Road -- Poughkeepsie, NY 12601
Tele (845) 433-7846 Fax (845) 433-8363

  From: George Bosilca <bosilca_at_[hidden]>.
  To: Open MPI Users <users_at_[hidden]>
  Date: 02/23/2009 03:30 PM
  Subject: Re: [OMPI users] MPI_Gatherv and 0 size?

The only restriction the MPI standard impose on the sendcounts and
recvcounts arrays is that the values be non-negative, so zero is a
legal value.

I don't really understand your second question. Where do you want to
use NULL ? In general NULL is not accepted in MPI as an argument for
any function ...


On Feb 23, 2009, at 02:55 , jody wrote:

> Hi
> I have an application in which various processes create different
> amounts of data (including no data at all).
> I have found that MPI_Scatterv and MPI_Gatherv do work with arrays
> sendcounts or receivecounts containing zeros.
> Since i didn't find the case of 0 sizes in the descriptions
> of these functions in the MPI reference, i wondered whether
> the use of zeroes is legal or if i was simply lucky that it worked.
> An other point: currently i use 1-sized buffers in the
> case of a 0-sized data transfer.
> Now if 0-sized data transfer is legal, would it be ok to
> pass NULL for the buffer?
> Thank You
> Jody
> _______________________________________________
> users mailing list
> users_at_[hidden]

users mailing list