This source file includes following definitions.
- MPI_Type_create_hindexed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "ompi_config.h"
25
26 #include "ompi/mpi/c/bindings.h"
27 #include "ompi/runtime/params.h"
28 #include "ompi/communicator/communicator.h"
29 #include "ompi/errhandler/errhandler.h"
30 #include "ompi/datatype/ompi_datatype.h"
31 #include "ompi/memchecker.h"
32
33 #if OMPI_BUILD_MPI_PROFILING
34 #if OPAL_HAVE_WEAK_SYMBOLS
35 #pragma weak MPI_Type_create_hindexed = PMPI_Type_create_hindexed
36 #endif
37 #define MPI_Type_create_hindexed PMPI_Type_create_hindexed
38 #endif
39
40 static const char FUNC_NAME[] = "MPI_Type_create_hindexed";
41
42
43 int MPI_Type_create_hindexed(int count,
44 const int array_of_blocklengths[],
45 const MPI_Aint array_of_displacements[],
46 MPI_Datatype oldtype,
47 MPI_Datatype *newtype)
48 {
49 int rc, i;
50
51 MEMCHECKER(
52 memchecker_datatype(oldtype);
53 );
54
55 if( MPI_PARAM_CHECK ) {
56 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
57 if( count < 0 ) {
58 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COUNT,
59 FUNC_NAME);
60 } else if ((count > 0) && (NULL == array_of_blocklengths ||
61 NULL == array_of_displacements)) {
62 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
63 FUNC_NAME);
64 } else if (MPI_DATATYPE_NULL == oldtype || NULL == oldtype ||
65 NULL == newtype) {
66 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE,
67 FUNC_NAME);
68 }
69 for ( i = 0; i < count; i++ ) {
70 if (array_of_blocklengths[i] < 0) {
71 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
72 FUNC_NAME );
73 }
74 }
75 }
76
77 OPAL_CR_ENTER_LIBRARY();
78
79 rc = ompi_datatype_create_hindexed( count, array_of_blocklengths, array_of_displacements,
80 oldtype, newtype );
81 if( rc != MPI_SUCCESS ) {
82 ompi_datatype_destroy( newtype );
83 OMPI_ERRHANDLER_RETURN( rc, MPI_COMM_WORLD, rc, FUNC_NAME );
84 }
85
86 {
87 const int* a_i[2] = {&count, array_of_blocklengths};
88
89 ompi_datatype_set_args( *newtype, count + 1, a_i, count, array_of_displacements,
90 1, &oldtype, MPI_COMBINER_HINDEXED );
91 }
92
93 OPAL_CR_EXIT_LIBRARY();
94 return MPI_SUCCESS;
95 }