This source file includes following definitions.
- MPI_Type_dup
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/attribute/attribute.h"
29 #include "ompi/memchecker.h"
30
31 #if OMPI_BUILD_MPI_PROFILING
32 #if OPAL_HAVE_WEAK_SYMBOLS
33 #pragma weak MPI_Type_dup = PMPI_Type_dup
34 #endif
35 #define MPI_Type_dup PMPI_Type_dup
36 #endif
37
38 static const char FUNC_NAME[] = "MPI_Type_dup";
39
40
41 int MPI_Type_dup (MPI_Datatype type,
42 MPI_Datatype *newtype)
43 {
44 MEMCHECKER(
45 memchecker_datatype(type);
46 );
47
48 if( MPI_PARAM_CHECK ) {
49 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
50 if (NULL == type || MPI_DATATYPE_NULL == type ||
51 NULL == newtype) {
52 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE,
53 FUNC_NAME );
54 }
55 }
56
57 OPAL_CR_ENTER_LIBRARY();
58
59 if (OMPI_SUCCESS != ompi_datatype_duplicate( type, newtype)) {
60 ompi_datatype_destroy( newtype );
61 OMPI_ERRHANDLER_RETURN (MPI_ERR_INTERN, MPI_COMM_WORLD,
62 MPI_ERR_INTERN, FUNC_NAME );
63 }
64
65 ompi_datatype_set_args( *newtype, 0, NULL, 0, NULL, 1, &type, MPI_COMBINER_DUP );
66
67
68
69
70
71
72 if (NULL != type->d_keyhash) {
73 ompi_attr_hash_init(&(*newtype)->d_keyhash);
74 if (OMPI_SUCCESS != ompi_attr_copy_all(TYPE_ATTR,
75 type, *newtype,
76 type->d_keyhash,
77 (*newtype)->d_keyhash)) {
78 ompi_datatype_destroy(newtype);
79 OMPI_ERRHANDLER_RETURN( MPI_ERR_INTERN, MPI_COMM_WORLD,
80 MPI_ERR_INTERN, FUNC_NAME );
81 }
82 }
83
84 OPAL_CR_EXIT_LIBRARY();
85
86 return MPI_SUCCESS;
87 }