Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPI count of zero is often valid

Tags:

c

fortran

mpi

I came across this today

MPI_ERR_COUNT Invalid count argument. Count arguments must be non-negative; a count of zero is often valid.

What does it mean by a count of zero is often valid? Does it mean that it is implementation dependent?

like image 805
mgilson Avatar asked May 01 '12 19:05

mgilson


2 Answers

I think you're reading too much into it. I think it means simply that depending on the user implementation, anything from 0 a random positive integer is a valid count. It's not hard to imagine a message tag that requires no parameters.

If a message tag requires no parameters, then it is valid to send only zero (and, in fact, possibly invalid to send more than that). You have to keep in mind that no parameters is not the same thing as no data, as the message tag is a "parameter" in and of its own.

like image 64
Mahmoud Al-Qudsi Avatar answered Sep 29 '22 11:09

Mahmoud Al-Qudsi


It means that any function in MPI that requires a message data size to be specified accepts zero but that doesn't mean that it would lead to correct application code.

For example, MPI_Send accepts 0 as count and will always send an empty message that carries no data but still has an envelope and that can be received by any matching MPI_Recv. On the other hand if you specify 0 as the count in MPI_Recv you will get a message truncation error for any matching non-empty message that has arrived. That is 0 is almost never a valid (from the application point of view) count value for MPI_Recv although it is perfectly acceptable for MPI.

Zeroes are widely accepted in MPI since that enables one to write more symmetric code (e.g. code without lots of if (count != 0) ...

like image 41
Hristo Iliev Avatar answered Sep 29 '22 09:09

Hristo Iliev