1 | .\"Copyright 2006-2008 Sun Microsystems, Inc. |
---|
2 | .\" Copyright (c) 1996 Thinking Machines Corporation |
---|
3 | .TH MPI_Type_indexed 3 "Dec 08, 2009" "1.4" "Open MPI" |
---|
4 | .SH NAME |
---|
5 | \fBMPI_Type_indexed\fP \- Creates an indexed datatype. |
---|
6 | |
---|
7 | .SH SYNTAX |
---|
8 | .ft R |
---|
9 | .SH C Syntax |
---|
10 | .nf |
---|
11 | #include <mpi.h> |
---|
12 | int MPI_Type_indexed(int \fIcount\fP, int\fI *array_of_blocklengths\fP, |
---|
13 | int\fI *array_of_displacements\fP, MPI_Datatype\fI oldtype\fP, |
---|
14 | MPI_Datatype\fI *newtype\fP) |
---|
15 | |
---|
16 | .SH Fortran Syntax |
---|
17 | .nf |
---|
18 | INCLUDE 'mpif.h' |
---|
19 | MPI_TYPE_INDEXED(\fICOUNT, ARRAY_OF_BLOCKLENGTHS, |
---|
20 | ARRAY_OF_DISPLACEMENTS, OLDTYPE, NEWTYPE, IERROR\fP) |
---|
21 | INTEGER \fICOUNT, ARRAY_OF_BLOCKLENGTHS(*)\fP |
---|
22 | INTEGER \fIARRAY_OF_DISPLACEMENTS(*), OLDTYPE, NEWTYPE\fP |
---|
23 | INTEGER \fIIERROR\fP |
---|
24 | |
---|
25 | .SH C++ Syntax |
---|
26 | .nf |
---|
27 | #include <mpi.h> |
---|
28 | Datatype Datatype::Create_indexed(int \fIcount\fP, |
---|
29 | const int \fIarray_of_blocklengths\fP[], |
---|
30 | const int \fIarray_of_displacements\fP[]) const |
---|
31 | |
---|
32 | .SH INPUT PARAMETERS |
---|
33 | .ft R |
---|
34 | .TP 1i |
---|
35 | count |
---|
36 | Number of blocks -- also number of entries in array_of_displacements and |
---|
37 | array_of_blocklengths (nonnegative integer). |
---|
38 | .TP 1i |
---|
39 | array_of_blocklengths |
---|
40 | Number of elements per block (array of nonnegative integers). |
---|
41 | .TP 1i |
---|
42 | array_of_displacements |
---|
43 | Displacement for each block, in multiples of oldtype extent (array of |
---|
44 | integer). |
---|
45 | .TP 1i |
---|
46 | oldtype |
---|
47 | Old datatype (handle). |
---|
48 | .sp |
---|
49 | .SH OUTPUT PARAMETERS |
---|
50 | .ft R |
---|
51 | .TP 1i |
---|
52 | newtype |
---|
53 | New datatype (handle). |
---|
54 | .ft R |
---|
55 | .TP 1i |
---|
56 | IERROR |
---|
57 | Fortran only: Error status (integer). |
---|
58 | |
---|
59 | .SH DESCRIPTION |
---|
60 | .ft R |
---|
61 | The function MPI_Type_indexed allows replication of an old datatype into a sequence of blocks (each block is a concatenation of the old datatype), where each block can contain a different number of copies and have a different displacement. All block displacements are multiples of the old data type's extent. |
---|
62 | .sp |
---|
63 | |
---|
64 | \fBExample:\fP Let oldtype have type map {(double, 0), (char, 8)}, with extent 16. Let B = (3, 1) and let D = (4, 0). A call to MPI_Type_indexed(2, B, D, oldtype, newtype) returns a datatype with type map |
---|
65 | .sp |
---|
66 | .nf |
---|
67 | {(double, 64), (char, 72), (double, 80), (char, 88), |
---|
68 | (double, 96), (char, 104), |
---|
69 | (double, 0), (char, 8)} |
---|
70 | .fi |
---|
71 | .sp |
---|
72 | That is, three copies of the old type starting at displacement 4 x 16 = 64, and one copy starting at displacement 0. |
---|
73 | .sp |
---|
74 | In general, assume that oldtype has type map |
---|
75 | .sp |
---|
76 | .nf |
---|
77 | {(type(0), disp(0)), ..., (type(n-1), disp(n-1))}, |
---|
78 | .fi |
---|
79 | .sp |
---|
80 | with extent ex. Let B be the array_of_blocklength argument and D be the |
---|
81 | array_of_displacements argument. The newly created datatype has |
---|
82 | .br |
---|
83 | .nf |
---|
84 | n x S ^count-1 |
---|
85 | i = 0 B[i] entries: |
---|
86 | |
---|
87 | .nf |
---|
88 | {(type(0), disp(0) + D[0]* ex), ..., |
---|
89 | (type(n-1), disp(n-1) + D[0]* ex), ..., |
---|
90 | (type(0), disp(0) + (D[0] + B[0]-1)* ex), ..., |
---|
91 | (type(n-1), disp(n-1) + (D[0]+ B[0]-1)* ex), ..., |
---|
92 | (type(0), disp(0) + D[count-1]* ex), ..., |
---|
93 | (type(n-1), disp(n-1) + D[count-1]* ex), ..., |
---|
94 | (type(0), disp(0) + (D[count-1] + B[count-1] -1)* ex), ..., |
---|
95 | (type(n-1), disp(n-1) + (D[count-1] + B[count-1] -1)* ex)} |
---|
96 | .fi |
---|
97 | .sp |
---|
98 | A call to MPI_Type_vector(count, blocklength, stride, oldtype, newtype) is equivalent to a call to MPI_Type_indexed(count, B, D, oldtype, newtype) where |
---|
99 | .sp |
---|
100 | .nf |
---|
101 | D[j] = j * stride, j = 0,..., count-1 |
---|
102 | |
---|
103 | and |
---|
104 | |
---|
105 | B[j] = blocklength, j = 0, .., count-1 |
---|
106 | .fi |
---|
107 | |
---|
108 | .SH ERRORS |
---|
109 | Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI:Exception object. |
---|
110 | .sp |
---|
111 | Before the error value is returned, the current MPI error handler is |
---|
112 | called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN 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. |
---|
113 | |
---|
114 | .SH SEE ALSO |
---|
115 | .ft R |
---|
116 | .sp |
---|
117 | MPI_Type_create_hindexed |
---|
118 | .br |
---|
119 | MPI_Type_hindexed |
---|
120 | .br |
---|
121 | |
---|