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_Cart_rank: Out-of-range coordinates are erroneous for non-periodic dimensions
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2009-01-07 06:21:57

Unfortunately, they're erroneous because the MPI spec says that
they're erroneous. MPI-2.1, p250:

"For dimension i with periods(i) = true, if the coordinate, coords(i),
is out of range, that is, coords(i) < 0 or coords(i) ≥ dims(i), it
is shifted back to the interval 0 ≤ coords(i) < dims(i)
automatically. Out-of-range coordinates are erroneous for non-periodic

Therefore, we invoke an MPI exception if you ask for something with
out-of-range coordinates.

That being said, you have [at least] 2 alternatives:

1. Keep meta data around to know the dimensions of your communicator
and ensure that you never call CART_RANK with out-of-range coordinates.

2. Reset the error handler on the communicator in question to
MPI_ERRORS_RETURN (or your own handler). Then when you call CART_RANK
with out-of-range coordinates, you'll just get an error back rather
than the job aborting.

On Jan 7, 2009, at 3:08 AM, Atle Rudshaug wrote:

> Hi!
> I am trying to find the neighbor ranks in a 3D cartesian
> communicator. I use MPI_Cart_shift for 6 of them, but for the 12
> diagonals I tried to use MPI_Cart_rank. However, only x-direction is
> periodic and my program crashed because of out-of-range coordinates.
> Then I found something strange in some MPICH documentation:
> "Out-of-range coordinates are erroneous for non-periodic
> dimensions . Versions of MPICH before 1.2.2 returned MPI_PROC_NULL
> for the rank in this case."
> Why doesn't it anymore? Is this the same for OpenMPI? I expected it
> to return MPI_PROC_NULL which would make things much easier.
> - Atle
> _______________________________________________
> users mailing list
> users_at_[hidden]

Jeff Squyres
Cisco Systems