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