1 | .\"Copyright 2006-2008 Sun Microsystems, Inc. |
---|
2 | .\" Copyright (c) 1996 Thinking Machines Corporation |
---|
3 | .TH MPI_Type_vector 3 "Dec 08, 2009" "1.4" "Open MPI" |
---|
4 | .SH NAME |
---|
5 | \fBMPI_Type_vector\fP \- Creates a vector (strided) datatype. |
---|
6 | |
---|
7 | .SH SYNTAX |
---|
8 | .ft R |
---|
9 | .SH C Syntax |
---|
10 | .nf |
---|
11 | #include <mpi.h> |
---|
12 | int MPI_Type_vector(int \fIcount\fP, int\fI blocklength\fP, int\fI stride\fP, |
---|
13 | MPI_Datatype\fI oldtype\fP, MPI_Datatype\fI *newtype\fP) |
---|
14 | |
---|
15 | .SH Fortran Syntax |
---|
16 | .nf |
---|
17 | INCLUDE 'mpif.h' |
---|
18 | MPI_TYPE_VECTOR(\fICOUNT, BLOCKLENGTH, STRIDE, OLDTYPE, NEWTYPE, |
---|
19 | IERROR\fP) |
---|
20 | INTEGER \fICOUNT, BLOCKLENGTH, STRIDE, OLDTYPE\fP |
---|
21 | INTEGER \fINEWTYPE, IERROR\fP |
---|
22 | |
---|
23 | .SH C++ Syntax |
---|
24 | .nf |
---|
25 | #include <mpi.h> |
---|
26 | Datatype Datatype::Create_vector(int \fIcount\fP, int \fIblocklength\fP, |
---|
27 | int \fIstride\fP) const |
---|
28 | |
---|
29 | .SH INPUT PARAMETERS |
---|
30 | .ft R |
---|
31 | .TP 1i |
---|
32 | count |
---|
33 | Number of blocks (nonnegative integer). |
---|
34 | .TP 1i |
---|
35 | blocklength |
---|
36 | Number of elements in each block (nonnegative integer). |
---|
37 | .TP 1i |
---|
38 | stride |
---|
39 | Number of elements between start of each block (integer). |
---|
40 | .TP 1i |
---|
41 | oldtype |
---|
42 | Old datatype (handle). |
---|
43 | .sp |
---|
44 | |
---|
45 | .SH OUTPUT PARAMETERS |
---|
46 | .ft R |
---|
47 | .TP 1i |
---|
48 | newtype |
---|
49 | New datatype (handle). |
---|
50 | .sp |
---|
51 | .ft R |
---|
52 | .TP 1i |
---|
53 | IERROR |
---|
54 | Fortran only: Error status (integer). |
---|
55 | |
---|
56 | .SH DESCRIPTION |
---|
57 | .ft R |
---|
58 | The function MPI_Type_vector is a general constructor that allows replication of a datatype into locations that consist of equally spaced blocks. Each block is obtained by concatenating the same number of copies of the old datatype. The spacing between blocks is a multiple of the extent of the old datatype. |
---|
59 | .sp |
---|
60 | \fBExample 1:\fP Assume, again, that oldtype has type map {(double, 0), (char, 8)}, with extent 16. A call to MPI_Type_vector(2, 3, 4, oldtype, newtype) will create the datatype with type map |
---|
61 | .nf |
---|
62 | {(double, 0), (char, 8), (double, 16), (char, 24), |
---|
63 | (double, 32), (char, 40), |
---|
64 | (double, 64), (char, 72), |
---|
65 | (double, 80), (char, 88), (double, 96), (char, 104)} |
---|
66 | .fi |
---|
67 | .sp |
---|
68 | That is, two blocks with three copies each of the old type, with a stride of 4 elements (4 x 6 bytes) between the blocks. |
---|
69 | .sp |
---|
70 | \fBExample 2:\fP A call to MPI_Type_vector(3, 1, -2, oldtype, newtype) will create the datatype |
---|
71 | .nf |
---|
72 | |
---|
73 | {(double, 0), (char, 8), (double, -32), (char, -24), |
---|
74 | (double, -64), (char, -56)} |
---|
75 | |
---|
76 | .fi |
---|
77 | In general, assume that oldtype has type map |
---|
78 | .nf |
---|
79 | |
---|
80 | {(type(0), disp(0)), ..., (type(n-1), disp(n-1))}, |
---|
81 | |
---|
82 | .fi |
---|
83 | with extent ex. Let bl be the blocklength. The newly created datatype has a type map with count x bl x n entries: |
---|
84 | .nf |
---|
85 | |
---|
86 | {(type(0), disp(0)), ..., (type(n-1), disp(n-1)), |
---|
87 | (type(0), disp(0) + ex), ..., (type(n-1), disp(n-1) + ex), ..., |
---|
88 | (type(0), disp(0) + (bl -1) * ex),..., |
---|
89 | (type(n-1), disp(n-1) + (bl -1)* ex), |
---|
90 | (type(0), disp(0) + stride * ex),..., (type(n-1), |
---|
91 | disp(n-1) + stride * ex), ..., |
---|
92 | (type(0), disp(0) + (stride + bl - 1) * ex), ..., |
---|
93 | (type(n-1), disp(n-1) + (stride + bl -1) * ex), ..., |
---|
94 | (type(0), disp(0) + stride * (count -1) * ex), ..., |
---|
95 | (type(n-1), disp(n-1) + stride * (count -1) * ex), ..., |
---|
96 | (type(0), disp(0) + (stride * (count -1) + bl -1) * ex), ..., |
---|
97 | (type(n-1), disp(n-1) + (stride * (count -1) + bl -1) * ex)} |
---|
98 | |
---|
99 | .fi |
---|
100 | A call to MPI_Type_contiguous(count, oldtype, newtype) is equivalent to a call to MPI_Type_vector(count, 1, 1, oldtype, newtype), or to a call to MPI_Type_vector(1, count, n, oldtype, newtype), n arbitrary. |
---|
101 | |
---|
102 | .SH ERRORS |
---|
103 | 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. |
---|
104 | .sp |
---|
105 | Before the error value is returned, the current MPI error handler is |
---|
106 | 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. |
---|
107 | |
---|
108 | .SH SEE ALSO |
---|
109 | .ft R |
---|
110 | .sp |
---|
111 | MPI_Type_create_hvector |
---|
112 | .br |
---|
113 | MPI_Type_hvector |
---|
114 | .br |
---|
115 | |
---|