IBM Books

MPI Subroutine Reference

MPI_CART_RANK, MPI_Cart_rank

Purpose

Translates task coordinates into a task rank.

C synopsis

#include <mpi.h>
MPI_Cart_rank(MPI_Comm comm,int *coords,int *rank);

C++ synopsis

#include mpi.h
int MPI::Cartcomm::Get_cart_rank(const int coords[]) const;

FORTRAN synopsis

include 'mpif.h' or use mpi
MPI_CART_RANK(INTEGER COMM,INTEGER COORDS(*),INTEGER RANK,
      INTEGER IERROR)

Parameters

comm
is a communicator with cartesian topology (handle) (IN)

coords
is an integer array of size ndims specifying the cartesian coordinates of a task (IN)

rank
is an integer specifying the rank of specified task (OUT)

IERROR
is the FORTRAN return code. It is always the last argument.

Description

This subroutine translates cartesian task coordinates into a task rank.

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 automatically shifted back to the interval 0 >= coords(i) < dims(i). Out-of-range coordinates are erroneous for non-periodic dimensions.

Notes

Task coordinates in a cartesian structure begin their numbering at 0. Row-major numbering is always used for the tasks in a cartesian structure.

Errors

MPI not initialized

MPI already finalized

Invalid communicator

No topology

Invalid topology type
must be cartesian

Invalid coordinates
refer to Description above

Related information

MPI_CART_COORDS
MPI_CART_CREATE


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]