This source file includes following definitions.
- MPI_Type_create_f90_integer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include "ompi_config.h"
28
29 #include "opal/util/printf.h"
30
31 #include "ompi/mpi/c/bindings.h"
32 #include "ompi/runtime/params.h"
33 #include "ompi/communicator/communicator.h"
34 #include "ompi/errhandler/errhandler.h"
35
36 #if OMPI_BUILD_MPI_PROFILING
37 #if OPAL_HAVE_WEAK_SYMBOLS
38 #pragma weak MPI_Type_create_f90_integer = PMPI_Type_create_f90_integer
39 #endif
40 #define MPI_Type_create_f90_integer PMPI_Type_create_f90_integer
41 #endif
42
43 static const char FUNC_NAME[] = "MPI_Type_create_f90_integer";
44
45
46 int MPI_Type_create_f90_integer(int r, MPI_Datatype *newtype)
47
48 {
49 OPAL_CR_NOOP_PROGRESS();
50
51 if (MPI_PARAM_CHECK) {
52 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
53
54
55
56
57
58 }
59
60
61
62
63
64
65
66
67
68
69 if (r > 38) *newtype = &ompi_mpi_datatype_null.dt;
70 #if OMPI_HAVE_FORTRAN_INTEGER16
71 else if (r > 18) *newtype = &ompi_mpi_long_long_int.dt;
72 #else
73 else if (r > 18) *newtype = &ompi_mpi_datatype_null.dt;
74 #endif
75 #if SIZEOF_LONG > SIZEOF_INT
76 else if (r > 9) *newtype = &ompi_mpi_long.dt;
77 #else
78 #if SIZEOF_LONG_LONG > SIZEOF_INT
79 else if (r > 9) *newtype = &ompi_mpi_long_long_int.dt;
80 #else
81 else if (r > 9) *newtype = &ompi_mpi_datatype_null.dt;
82 #endif
83 #endif
84 else if (r > 4) *newtype = &ompi_mpi_int.dt;
85 else if (r > 2) *newtype = &ompi_mpi_short.dt;
86 else *newtype = &ompi_mpi_byte.dt;
87
88 if( *newtype != &ompi_mpi_datatype_null.dt ) {
89 ompi_datatype_t* datatype;
90 const int* a_i[1];
91 int rc;
92
93 if( OPAL_SUCCESS == opal_hash_table_get_value_uint32( &ompi_mpi_f90_integer_hashtable,
94 r, (void**)newtype ) ) {
95 return MPI_SUCCESS;
96 }
97
98
99
100 if (OMPI_SUCCESS != ompi_datatype_duplicate( *newtype, &datatype)) {
101 OMPI_ERRHANDLER_RETURN (MPI_ERR_INTERN, MPI_COMM_WORLD,
102 MPI_ERR_INTERN, FUNC_NAME );
103 }
104
105
106
107 datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED;
108
109
110
111
112
113 opal_snprintf(datatype->name, sizeof(datatype->name),
114 "COMBINER %s", (*newtype)->name);
115
116 a_i[0] = &r;
117 ompi_datatype_set_args( datatype, 1, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_INTEGER );
118
119 rc = opal_hash_table_set_value_uint32( &ompi_mpi_f90_integer_hashtable, r, datatype );
120 if (OMPI_SUCCESS != rc) {
121 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, rc, FUNC_NAME);
122 }
123 *newtype = datatype;
124 return MPI_SUCCESS;
125 }
126
127 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
128 }