IBM Books

MPI Subroutine Reference

MPI_ALLTOALLW, MPI_Alltoallw

Purpose

Sends a distinct message from each task to every task. Messages can have different datatypes, sizes, and displacements.

C synopsis

#include <mpi.h>
int MPI_Alltoallw(void* sendbuf, int sendcounts[], int sdispls[],
		  MPI_Datatype sendtypes[], void *recvbuf, int recvcounts[], 
		  int rdispls[], MPI_Datatype recvtypes[], MPI_Comm comm);

C++ synopsis

#include mpi.h
void MPI::Comm::Alltoallw(const void *sendbuf, const int sendcounts[], 
			  const int sdispls[], const MPI::Datatype sendtypes[], 
			  void *recvbuf, const int recvcounts[], const int rdispls[], 
			  const MPI::Datatype recvtypes[]) const;

FORTRAN synopsis

include 'mpif.h' or use mpi
MPI_ALLTOALLW(CHOICE SENDBUF(*), INTEGER SENDCOUNTS(*), INTEGER SDISPLS(*), 
	      INTEGER SENDTYPES(*), CHOICE RECVBUF, INTEGER RECVCOUNTS(*), 
	      INTEGER RDISPLS(*), INTEGER RECVTYPES(*), INTEGER COMM, INTEGER IERROR)

Parameters

sendbuf
is the starting address of the send buffer (choice) (IN)

sendcounts
integer array (of length groupsize) specifying the number of elements to send to each task (IN)

sdispls
integer array (of length groupsize). Entry j specifies the displacement in bytes (relative to sendbuf) from which to take the outgoing data destined for task j. (IN)

sendtypes
is the array of datatypes (of length groupsize). Entry j specifies the type of data to send to task j. (handle) (IN)

recvbuf
is the address of the receive buffer (choice) (OUT)

recvcounts
integer array (of length groupsize) specifying the number of elements to be received from each task (IN)

rdispls
integer array (of length groupsize). Entry i specifies the displacement in bytes (relative to recvbuf) at which to place the incoming data from task i. (IN)

recvtypes
is the array of datatypes (of length groupsize). Entry i specifies the type of data received from task i. (handle) (IN)

comm
is the communicator (handle) (IN)

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

Description

This subroutine is an extension of MPI_ALLTOALLV. It allows separate specification of count, displacement and datatype. In addition, to allow maximum flexibility, the displacement of blocks within the send and receive buffers is specified in bytes.

The jth block sent from task i is received by task j and is placed in the ith block of recvbuf. These blocks need not all have the same size.

The type signature associated with sendcounts[j], sendtypes[j] at task i must be equal to the type signature associated with recvcounts[i], recvtypes[i] at task j. This means the amount of data sent must be equal to the amount of data received, pair wise between every pair of tasks. Distinct type maps between sender and receiver are allowed.

All arguments on all tasks are significant.

MPI_ALLTOALLW does not support MPI_IN_PLACE on either type of communicator.

If comm is an intercommunicator, the outcome is as if each task in group A sends a message to each task in group B, and vice versa. The jth send buffer of task i in group A should be consistent with the ith receive buffer of task j in group B, and vice versa.

When you use this subroutine in a threads application, make sure all collective operations on a particular communicator occur in the same order at each task. See IBM Parallel Environment for AIX: MPI Programming Guide for more information on programming with MPI in a threads environment.

Notes

In the bindings for this subroutine, the send displacement and receive displacements are arrays of integers. This may limit the usability of this subroutine in certain 64-bit applications. It is likely that the MPI Forum will define a replacement for MPI_ALLTOALLW and deprecate this binding. The replacement subroutine will use arrays of address_size integers. The MPI_ALLTOALLW subroutine with the present binding will remain available.

Errors

Fatal errors:

Invalid count(s)
count < 0

Invalid datatype(s)

Type not committed

Invalid communicator

A send and receive have unequal message lengths

Invalid use of MPI_IN_PLACE

MPI not initialized

MPI already finalized

Related information

MPI_ALLTOALLV


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