|
12 | 12 | * All rights reserved. |
13 | 13 | * Copyright (c) 2006 Sun Microsystems Inc. All rights reserved. |
14 | 14 | * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. |
| 15 | + * Copyright (c) 2018 Los Alamos National Security, LLC. All rights |
| 16 | + * reserved. |
15 | 17 | * $COPYRIGHT$ |
16 | 18 | * |
17 | 19 | * Additional copyrights may follow |
@@ -66,239 +68,6 @@ ompi_datatype_t* create_inversed_vector( const ompi_datatype_t* type, int length |
66 | 68 | return type1; |
67 | 69 | } |
68 | 70 |
|
69 | | -int mpich_typeub( void ) |
70 | | -{ |
71 | | - int errs = 0; |
72 | | - MPI_Aint extent, lb, extent1, extent2, extent3; |
73 | | - MPI_Aint displ[2]; |
74 | | - int blens[2]; |
75 | | - ompi_datatype_t *type1, *type2, *type3, *types[2]; |
76 | | - |
77 | | - ompi_datatype_create_vector( 2, 1, 4, &ompi_mpi_int.dt, &type1 ); |
78 | | - ompi_datatype_commit( &type1 ); |
79 | | - ompi_datatype_get_extent( type1, &lb, &extent ); |
80 | | - extent1 = 5 * sizeof(int); |
81 | | - if (extent != extent1) { |
82 | | - printf("EXTENT 1 %ld != %ld\n", (long)extent, (long)extent1); |
83 | | - errs++; |
84 | | - printf("extent(type1)=%ld\n",(long)extent); |
85 | | - } |
86 | | - |
87 | | - blens[0] = 1; |
88 | | - blens[1] = 1; |
89 | | - displ[0] = 0; |
90 | | - displ[1] = sizeof(int)*4; |
91 | | - types[0] = type1; |
92 | | - types[1] = &ompi_mpi_ub.dt; /*ompi_datatype_basicDatatypes[DT_UB];*/ |
93 | | - extent2 = displ[1]; |
94 | | - |
95 | | - /* using MPI_UB and Type_struct, monkey with the extent, making it 16 |
96 | | - */ |
97 | | - ompi_datatype_create_struct( 2, blens, displ, types, &type2 ); |
98 | | - ompi_datatype_commit( &type2 ); |
99 | | - ompi_datatype_get_extent( type2, &lb, &extent ); |
100 | | - if (extent != extent2) { |
101 | | - printf("EXTENT 2 %ld != %ld\n", (long)extent, (long)extent2); |
102 | | - errs++; |
103 | | - printf("extent(type2)=%ld\n",(long)extent); |
104 | | - } |
105 | | - |
106 | | - /* monkey with the extent again, making it 4 |
107 | | - * ===> MPICH gives 4 |
108 | | - * ===> MPIF gives 16, the old extent |
109 | | - */ |
110 | | - displ[1] = sizeof(int); |
111 | | - types[0] = type2; |
112 | | - types[1] = &ompi_mpi_ub.dt; /*ompi_datatype_basicDatatypes[DT_UB];*/ |
113 | | - extent3 = extent2; |
114 | | - |
115 | | - ompi_datatype_create_struct( 2, blens, displ, types, &type3 ); |
116 | | - ompi_datatype_commit( &type3 ); |
117 | | - |
118 | | - ompi_datatype_get_extent( type3, &lb, &extent ); |
119 | | - if (extent != extent3) { |
120 | | - printf("EXTENT 3 %ld != %ld\n", (long)extent, (long)extent3); |
121 | | - errs++; |
122 | | - printf("extent(type3)=%ld\n",(long)extent); |
123 | | - } |
124 | | - |
125 | | - OBJ_RELEASE( type1 ); /*assert( type1 == NULL );*/ |
126 | | - OBJ_RELEASE( type2 ); /*assert( type2 == NULL );*/ |
127 | | - OBJ_RELEASE( type3 ); assert( type3 == NULL ); |
128 | | - return errs; |
129 | | -} |
130 | | - |
131 | | -int mpich_typeub2( void ) |
132 | | -{ |
133 | | - int blocklen[3], err = 0; |
134 | | - size_t sz1, sz2, sz3; |
135 | | - MPI_Aint disp[3], lb, ub, ex1, ex2, ex3; |
136 | | - ompi_datatype_t *types[3], *dt1, *dt2, *dt3; |
137 | | - |
138 | | - blocklen[0] = 1; |
139 | | - blocklen[1] = 1; |
140 | | - blocklen[2] = 1; |
141 | | - disp[0] = -3; |
142 | | - disp[1] = 0; |
143 | | - disp[2] = 6; |
144 | | - types[0] = &ompi_mpi_lb.dt; /* ompi_datatype_basicDatatypes[DT_LB]; */ |
145 | | - types[1] = &ompi_mpi_int.dt; /* ompi_datatype_basicDatatypes[DT_INT]; */ |
146 | | - types[2] = &ompi_mpi_ub.dt; /* ompi_datatype_basicDatatypes[DT_UB]; */ |
147 | | - |
148 | | - ompi_datatype_create_struct(3,blocklen,disp, types,&dt1); |
149 | | - ompi_datatype_commit(&dt1); |
150 | | - |
151 | | - ompi_datatype_type_lb(dt1, &lb); ompi_datatype_type_ub(dt1, &ub); |
152 | | - ompi_datatype_type_extent(dt1,&ex1); ompi_datatype_type_size(dt1,&sz1); |
153 | | - |
154 | | - /* Values should be lb = -3, ub = 6 extent 9; size depends on implementation */ |
155 | | - if (lb != -3 || ub != 6 || ex1 != 9) { |
156 | | - printf("Example 3.26 type1 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex1, (int)sz1); |
157 | | - err++; |
158 | | - } |
159 | | - else |
160 | | - printf("Example 3.26 type1 correct\n" ); |
161 | | - |
162 | | - ompi_datatype_create_contiguous(2,dt1,&dt2); |
163 | | - ompi_datatype_type_lb(dt2, &lb); ompi_datatype_type_ub(dt2, &ub); |
164 | | - ompi_datatype_type_extent(dt2,&ex2); ompi_datatype_type_size(dt2,&sz2); |
165 | | - /* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */ |
166 | | - if (lb != -3 || ub != 15 || ex2 != 18) { |
167 | | - printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8); |
168 | | - printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2); |
169 | | - err++; |
170 | | - } |
171 | | - else |
172 | | - printf("Example 3.26 type1 correct\n" ); |
173 | | - OBJ_RELEASE( dt2 ); assert( dt2 == NULL ); |
174 | | - ompi_datatype_create_contiguous(2,dt1,&dt2); |
175 | | - ompi_datatype_type_lb(dt2, &lb); ompi_datatype_type_ub(dt2, &ub); |
176 | | - ompi_datatype_type_extent(dt2,&ex2); ompi_datatype_type_size(dt2,&sz2); |
177 | | - /* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */ |
178 | | - if (lb != -3 || ub != 15 || ex2 != 18) { |
179 | | - printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8); |
180 | | - printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2); |
181 | | - err++; |
182 | | - } |
183 | | - else |
184 | | - printf( "Example 3.26 type2 correct\n" ); |
185 | | - |
186 | | - types[0]=dt1; types[1]=dt1; |
187 | | - blocklen[0]=1; blocklen[1]=1; |
188 | | - disp[0]=0; disp[1]=ex1; |
189 | | - |
190 | | - ompi_datatype_create_struct(2, blocklen, disp, types, &dt3); |
191 | | - ompi_datatype_commit(&dt3); |
192 | | - |
193 | | - ompi_datatype_type_lb(dt3, &lb); ompi_datatype_type_ub(dt3, &ub); |
194 | | - ompi_datatype_type_extent(dt3,&ex3); ompi_datatype_type_size(dt3,&sz3); |
195 | | - /* Another way to express type2 */ |
196 | | - if (lb != -3 || ub != 15 || ex3 != 18) { |
197 | | - printf("type3 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8); |
198 | | - printf("type3 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex3, (int)sz2); |
199 | | - err++; |
200 | | - } |
201 | | - else |
202 | | - printf( "type3 correct\n" ); |
203 | | - |
204 | | - OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/ |
205 | | - OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/ |
206 | | - OBJ_RELEASE( dt3 ); assert( dt3 == NULL ); |
207 | | - return err; |
208 | | -} |
209 | | - |
210 | | -int mpich_typeub3( void ) |
211 | | -{ |
212 | | - int blocklen[3], err = 0, idisp[3]; |
213 | | - size_t sz; |
214 | | - MPI_Aint disp[3], lb, ub, ex; |
215 | | - ompi_datatype_t *types[3], *dt1, *dt2, *dt3, *dt4, *dt5; |
216 | | - |
217 | | - /* Create a datatype with explicit LB and UB */ |
218 | | - blocklen[0] = 1; |
219 | | - blocklen[1] = 1; |
220 | | - blocklen[2] = 1; |
221 | | - disp[0] = -3; |
222 | | - disp[1] = 0; |
223 | | - disp[2] = 6; |
224 | | - types[0] = &ompi_mpi_lb.dt; /* ompi_datatype_basicDatatypes[DT_LB]; */ |
225 | | - types[1] = &ompi_mpi_int.dt; /* ompi_datatype_basicDatatypes[DT_INT]; */ |
226 | | - types[2] = &ompi_mpi_ub.dt; /* ompi_datatype_basicDatatypes[DT_UB]; */ |
227 | | - |
228 | | - /* Generate samples for contiguous, hindexed, hvector, indexed, and vector (struct and contiguous tested in typeub2) */ |
229 | | - ompi_datatype_create_struct(3,blocklen,disp, types,&dt1); |
230 | | - ompi_datatype_commit(&dt1); |
231 | | - |
232 | | - /* This type is the same as in typeub2, and is tested there */ |
233 | | - types[0]=dt1; types[1]=dt1; |
234 | | - blocklen[0]=1; blocklen[1]=1; |
235 | | - disp[0]=-4; disp[1]=7; |
236 | | - idisp[0]=-4; idisp[1]=7; |
237 | | - |
238 | | - ompi_datatype_create_hindexed( 2, blocklen, disp, dt1, &dt2 ); |
239 | | - ompi_datatype_commit( &dt2 ); |
240 | | - |
241 | | - ompi_datatype_type_lb( dt2, &lb ); ompi_datatype_type_ub( dt2, &ub ); |
242 | | - ompi_datatype_type_extent( dt2, &ex ); ompi_datatype_type_size( dt2, &sz ); |
243 | | - |
244 | | - if (lb != -7 || ub != 13 || ex != 20) { |
245 | | - printf("hindexed lb %d ub %d extent %d size %d\n", (int)-7, (int)13, (int)20, (int)sz); |
246 | | - printf("hindexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz); |
247 | | - err++; |
248 | | - } |
249 | | - else |
250 | | - printf( "hindexed ok\n" ); |
251 | | - |
252 | | - ompi_datatype_create_indexed( 2, blocklen, idisp, dt1, &dt3 ); |
253 | | - ompi_datatype_commit( &dt3 ); |
254 | | - |
255 | | - ompi_datatype_type_lb( dt3, &lb ); ompi_datatype_type_ub( dt3, &ub ); |
256 | | - ompi_datatype_type_extent( dt3, &ex ); ompi_datatype_type_size( dt3, &sz ); |
257 | | - |
258 | | - if (lb != -39 || ub != 69 || ex != 108) { |
259 | | - printf("indexed lb %d ub %d extent %d size %d\n", (int)-39, (int)69, (int)108, (int)sz); |
260 | | - printf("indexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz); |
261 | | - err++; |
262 | | - } |
263 | | - else |
264 | | - printf( "indexed ok\n" ); |
265 | | - |
266 | | - ompi_datatype_create_hvector( 2, 1, 14, dt1, &dt4 ); |
267 | | - ompi_datatype_commit( &dt4 ); |
268 | | - |
269 | | - ompi_datatype_type_lb( dt4, &lb ); ompi_datatype_type_ub( dt4, &ub ); |
270 | | - ompi_datatype_type_extent( dt4, &ex ); ompi_datatype_type_size( dt4, &sz ); |
271 | | - |
272 | | - if (lb != -3 || ub != 20 || ex != 23) { |
273 | | - printf("hvector lb %d ub %d extent %d size %d\n", (int)-3, (int)20, (int)23, (int)sz); |
274 | | - printf("hvector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz); |
275 | | - err++; |
276 | | - } |
277 | | - else |
278 | | - printf( "hvector ok\n" ); |
279 | | - |
280 | | - ompi_datatype_create_vector( 2, 1, 14, dt1, &dt5 ); |
281 | | - ompi_datatype_commit( &dt5 ); |
282 | | - |
283 | | - ompi_datatype_type_lb( dt5, &lb ); ompi_datatype_type_ub( dt5, &ub ); |
284 | | - ompi_datatype_type_extent( dt5, &ex ); ompi_datatype_type_size( dt5, &sz ); |
285 | | - |
286 | | - if (lb != -3 || ub != 132 || ex != 135) { |
287 | | - printf("vector lb %d ub %d extent %d size %d\n", (int)-3, (int)132, (int)135, (int)sz); |
288 | | - printf("vector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz); |
289 | | - err++; |
290 | | - } |
291 | | - else |
292 | | - printf( "vector ok\n" ); |
293 | | - |
294 | | - OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/ |
295 | | - OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/ |
296 | | - OBJ_RELEASE( dt3 ); /*assert( dt3 == NULL );*/ |
297 | | - OBJ_RELEASE( dt4 ); /*assert( dt4 == NULL );*/ |
298 | | - OBJ_RELEASE( dt5 ); assert( dt5 == NULL ); |
299 | | - return err; |
300 | | -} |
301 | | - |
302 | 71 | void print_double_mat( unsigned int N, double* mat ) |
303 | 72 | { |
304 | 73 | unsigned int i, j; |
|
0 commit comments