1MPI_Type_indexed(3) LAM/MPI MPI_Type_indexed(3)
2
3
4
6 MPI_Type_indexed - Creates an indexed datatype
7
9 #include <mpi.h>
10 int MPI_Type_indexed(int count, int *lengths, int *disps,
11 MPI_Datatype oldtype, MPI_Datatype *newtype)
12
14 count - number of blocks -- also number of entries in indices and
15 blocklens
16 lengths
17 - number of elements in each block (array of nonnegative inte‐
18 gers)
19 disps - displacement of each block in multiples of old_type (array of
20 integers)
21 oldtype
22 - old datatype (handle)
23
24
26 newtype
27 - new datatype (handle)
28
29
31 The indices are displacements, and are based on a zero origin. A com‐
32 mon error is to do something like to following
33
34 integer a(100)
35 integer blens(10), indices(10)
36 do i=1,10
37 blens(i) = 1
38 10 indices(i) = 1 + (i-1)*10
39 call MPI_TYPE_INDEXED(10,blens,indices,MPI_INTEGER,newtype,ierr)
40 call MPI_TYPE_COMMIT(newtype,ierr)
41 call MPI_SEND(a,1,newtype,...)
42
43
44 expecting this to send a(1),a(11),... because the indices have values
45 1,11,... (and so on). Because these are disps from the beginning of a
46 , it actually sends a(1+1),a(1+11),... .
47
48
49 If you wish to consider the displacements as indices into a Fortran
50 array, consider declaring the Fortran array with a zero origin
51
52 integer a(0:99)
53
54
55
57 All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK ) have
58 an additional argument ierr at the end of the argument list. ierr is
59 an integer and has the same meaning as the return value of the routine
60 in C. In Fortran, MPI routines are subroutines, and are invoked with
61 the call statement.
62
63 All MPI objects (e.g., MPI_Datatype , MPI_Comm ) are of type INTEGER in
64 Fortran.
65
66
68 If an error occurs in an MPI function, the current MPI error handler is
69 called to handle it. By default, this error handler aborts the MPI
70 job. The error handler may be changed with MPI_Errhandler_set ; the
71 predefined error handler MPI_ERRORS_RETURN may be used to cause error
72 values to be returned (in C and Fortran; this error handler is less
73 useful in with the C++ MPI bindings. The predefined error handler
74 MPI::ERRORS_THROW_EXCEPTIONS should be used in C++ if the error value
75 needs to be recovered). Note that MPI does not guarantee that an MPI
76 program can continue past an error.
77
78 All MPI routines (except MPI_Wtime and MPI_Wtick ) return an error
79 value; C routines as the value of the function and Fortran routines in
80 the last argument. The C++ bindings for MPI do not return error val‐
81 ues; instead, error values are communicated by throwing exceptions of
82 type MPI::Exception (but not by default). Exceptions are only thrown
83 if the error value is not MPI::SUCCESS .
84
85
86 Note that if the MPI::ERRORS_RETURN handler is set in C++, while MPI
87 functions will return upon an error, there will be no way to recover
88 what the actual error value was.
89 MPI_ERR_COUNT
90 - Invalid count argument. Count arguments must be non-negative;
91 a count of zero is often valid.
92 MPI_ERR_TYPE
93 - Invalid datatype argument. May be an uncommitted MPI_Datatype
94 (see MPI_Type_commit ).
95 MPI_ERR_COUNT
96 - Invalid count argument. Count arguments must be non-negative;
97 a count of zero is often valid.
98 MPI_ERR_ARG
99 - Invalid argument. Some argument is invalid and is not identi‐
100 fied by a specific error class. This is typically a NULL
101 pointer or other such error.
102 MPI_ERR_OTHER
103 - This error is returned when some part of the LAM/MPI implemen‐
104 tation is unable to acquire memory.
105
106
108 For more information, please see the official MPI Forum web site, which
109 contains the text of both the MPI-1 and MPI-2 standards. These docu‐
110 ments contain detailed information about each MPI function (most of
111 which is not duplicated in these man pages).
112
113 http://www.mpi-forum.org/
114
115
116
118 The LAM Team would like the thank the MPICH Team for the handy program
119 to generate man pages ("doctext" from ftp://ftp.mcs.anl.gov/pub/sow‐
120 ing/sowing.tar.gz ), the initial formatting, and some initial text for
121 most of the MPI-1 man pages.
122
124 tindex.c
125
126
127
128LAM/MPI 7.1.2 2/23/2006 MPI_Type_indexed(3)