MPI_Type_create_subarray(3)MPI_Type_create_subarray(3)NAMEMPI_Type_create_subarray - Creates a data type describing a subarray of a
multidimensional array
SYNOPSIS
C:
#include "mpi.h"
int MPI_Type_create_subarray(int ndims, int *array_of_sizes,
int *array_of_subsizes, int *array_of_starts, int order,
MPI_Datatype oldtype, MPI_Datatype *newtype)
Fortran:
INCLUDE "mpif.h" (or USE MPI)
INTEGER ndims, array_of_sizes(*), array_of_subsizes(*),
array_of_starts(*), order, oldtype, newtype,
ierror
CALL MPI_TYPE_CREATE_SUBARRAY(ndims, array_of_sizes,
array_of_subsizes, array_of_starts, order, oldtype,
newtype, ierror)
DESCRIPTION
The subarray type constructor creates an MPI data type describing an n-
dimensional subarray of an n-dimensional array. The subarray can be
situated anywhere within the full array, and can be of any nonzero size
up to the size of the larger array as long as it is confined within this
array. This type constructor facilitates creating file types to access
arrays distributed in blocks among processes to a single file that
contains the global array.
This type constructor can handle arrays with an arbitrary number of
dimensions and works for both C and Fortran ordered matrices (that is,
row-major or column-major). A C program can use Fortran order and a
Fortran program can use C order.
The ndims parameter specifies the number of dimensions in the full data
array and gives the number of elements in array_of_sizes,
array_of_subsizes, and array_of_starts.
The number of elements of type oldtype in each dimension of the n-
dimensional array and the requested subarray are specified by
array_of_sizes and array_of_subsizes, respectively. For any dimension i,
it is erroneous to specify array_of_subsizes[i] with a value less than 1
or a value greater than array_of_sizes[i].
Page 1
MPI_Type_create_subarray(3)MPI_Type_create_subarray(3)
The array_of_starts contains the starting coordinates of each dimension
of the subarray. Arrays are assumed to be indexed starting from zero.
For any dimension i, it is erroneous to specify array_of_starts[i] with a
value less than 0 or a value greater than (array_of_sizes[i] -
array_of_subsizes[i]).
MPI_Type_create_subarray accepts the following arguments:
ndims Specifies the number of array dimensions (positive
integer)
array_of_sizes Specifies the number of elements of type oldtype in each
dimension of the full array (array of positive integers)
array_of_subsizes
Specifies the number of elements of type oldtype in each
dimension of the subarray (array of positive integers)
array_of_starts
Specifies the starting coordinates of the subarray in each
dimension (array of nonnegative integers)
order Specifies array storage order flag (state)
oldtype Specifies the old data type (handle)
newtype Returns the new data type (handle)
ierror Specifies the return code value for successful completion,
which is in MPI_SUCCESS. MPI_SUCCESS is defined in the
mpif.h file.
Notes for Fortran
All MPI objects (for example, MPI_Datatype, MPI_Comm, MPI_File) are of
type INTEGER.
SEE ALSOMPI_Type_create_darray(3)
Page 2