NAME
MMPPIITTyyppeeccrreeaatteeddaarrrraayy -
SSYYNNTTAAXX CC SSyynnttaaxx#include
int MPITypecreatedarray(int size, int rank, int ndims, int arrayofgsizes[], int arrayofdistribs[], int arrayofdargs[], int arrayofpsizes[], int order, MPIDatatype oldtype, MPIDatatype *newtype) FFoorrttrraann SSyynnttaaxx INCLUDE 'mpif.h' MPITYPECREATEDARRAY(SIZE, RANK, NDIMS, ARRAYOFGSIZES, ARRAYOFDISTRIBS, ARRAYOFDARGS, ARRAYOFPSIZES, ORDER,OLDTYPE, NEWTYPE, IERROR)
INTEGER SIZE, RANK, NDIMS, ARRAYOFGSIZES(*), ARRAYOFDISTRIBS(*), ARRAYOFDARGS(*), ARRAYOFPSIZES(*), ORDER, OLDTYPE,NEWTYPE, IERROR
CC++++ SSyynnttaaxx#include
MPI::Datatype MPI::Datatype::Createdarray(int size, int rank, int ndims, const int arrayofgsizes[], const int arrayofdistribs[], const int arrayofdargs[], const int arrayofpsizes[], int order) const IINNPPUUTT PPAARRAAMMEETTEERRSS size Size of process group (positive integer). rank Rank in process group (nonnegative integer). ndims Number of array dimensions as well as process grid dimensions (positive integer). arrayofgsizes Number of elements of type oldtype in each dimension of global array (array of positive integers). arrayofdistribs Distribution of array in each dimension (array of state). arrayofdargs Distribution argument in each dimension (array of positive integers). arrayofpsizes Size of process grid in each dimension (array of positive integers). order Array storage order flag (state). oldtype Old data type (handle). OOUUTTPPUUTT PPAARRAAMMEETTEERRSS newtype New data type (handle).IERROR Fortran only: Error status (integer).
DESCRIPTION
MPITypecreatedarray can be used to generate the data types corre-
sponding to the distribution of an ndims-dimensional array of oldtype
elements onto an ndims-dimensional grid of logical processes. Unused
dimensions of arrayofpsizes should be set to 1. For a call to MPITypecreatedarray to be correct, the equationndims-1
pi arrayofpsizes[i] = size i=0 must be satisfied. The ordering of processes in the process grid isassumed to be row-major, as in the case of virtual Cartesian process
topologies in MPI-1.
Each dimension of the array can be distributed in one of three ways:- MPIDISTRIBUTEBLOCK - Block distribution
- MPIDISTRIBUTECYCLIC - Cyclic distribution
- MPIDISTRIBUTENONE - Dimension not distributed.
The constant MPIDISTRIBUTEDFLTDARG specifies a default distributionargument. The distribution argument for a dimension that is not dis-
tributed is ignored. For any dimension i in which the distribution is MPIDISTRIBUTEBLOCK, it erroneous to specify arrayofdargs[i] arrayofpsizes[i] < arrayofgsizes[i].For example, the HPF layout ARRAY(CYCLIC(15)) corresponds to MPIDIS-
TRIBUTECYCLIC with a distribution argument of 15, and the HPF layout ARRAY(BLOCK) corresponds to MPIDISTRIBUTEBLOCK with a distribution argument of MPIDISTRIBUTEDFLTDARG. The order argument is used as in MPITYPECREATESUBARRAY to specify the storage order. Therefore, arrays described by this type constructormay be stored in Fortran (column-major) or C (row-major) order. Valid
values for order are MPIORDERFORTRAN and MPIORDERC. This routine creates a new MPI data type with a typemap defined in terms of a function called "cyclic()" (see below). Without loss of generality, it suffices to define the typemap for the MPIDISTRIBUTECYCLIC case where MPIDISTRIBUTEDFLTDARG is not used. MPIDISTRIBUTEBLOCK and MPIDISTRIBUTENONE can be reduced to the MPIDISTRIBUTECYCLIC case for dimension i as follows.MPIDISTRIBUTEBLOCK with arrayofdargs[i] equal to MPIDISTRIB-
UTEDFLTDARG is equivalent to MPIDISTRIBUTECYCLIC with arrayofdargs[i] set to(arrayofgsizes[i] + arrayofpsizes[i] - 1)/arrayofpsizes[i]
If arrayofdargs[i] is not MPIDISTRIBUTEDFLTDARG, then MPIDISTRIB-
UTEBLOCK and DISTRIBUTECYCLIC are equivalent. MPIDISTRIBUTENONE is equivalent to MPIDISTRIBUTECYCLIC with arrayofdargs[i] set to arrayofgsizes[i].Finally, MPIDISTRIBUTECYCLIC with arrayofdargs[i] equal to MPIDIS-
TRIBUTEDFLTDARG is equivalent to MPIDISTRIBUTECYCLIC with arrayofdargs[i] set to 1. NNOOTTEESS For both Fortran and C arrays, the ordering of processes in the processgrid is assumed to be row-major. This is consistent with the ordering
used in virtual Cartesian process topologies in MPI-1. To create such
virtual process topologies, or to find the coordinates of a process inthe process grid, etc., users may use the corresponding functions pro-
vided in MPI-1.
EERRRROORRSS Almost all MPI routines return an error value; C routines as the valueof the function and Fortran routines in the last argument. C++ func-
tions do not return errors. If the default error handler is set toMPI::ERRORSTHROWEXCEPTIONS, then on error the C++ exception mechanism
will be used to throw an MPI:Exception object. Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed withMPICommseterrhandler; the predefined error handler MPIERRORSRETURN
may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. Open MPI 1.2 September 2006MPITypecreatedarray(3OpenMPI)