This source file includes following definitions.
- compute_memory_size
- test_upper
- local_copy_ddt_count
- local_copy_with_convertor_2datatypes
- local_copy_with_convertor
- main
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 #include "opal_config.h"
27 #include "opal_ddt_lib.h"
28 #include "opal/runtime/opal.h"
29 #include "opal/datatype/opal_datatype.h"
30 #include "opal/datatype/opal_datatype_internal.h"
31 #include "opal/datatype/opal_convertor.h"
32 #include <time.h>
33 #include <stdlib.h>
34 #ifdef HAVE_SYS_TIME_H
35 #include <sys/time.h>
36 #endif
37 #include <stdio.h>
38 #include <string.h>
39
40
41
42
43
44 #define TIMER_DATA_TYPE struct timeval
45 #define GET_TIME(TV) gettimeofday( &(TV), NULL )
46 #define ELAPSED_TIME(TSTART, TEND) (((TEND).tv_sec - (TSTART).tv_sec) * 1000000 + ((TEND).tv_usec - (TSTART).tv_usec))
47
48 uint32_t remote_arch = 0xffffffff;
49
50
51
52
53
54 static size_t compute_memory_size( opal_datatype_t const * const pdt, int count )
55 {
56 ptrdiff_t extent, true_lb, true_extent;
57
58 opal_datatype_type_extent( pdt, &extent );
59 opal_datatype_get_true_extent( pdt, &true_lb, &true_extent );
60
61 return (size_t)(true_lb + true_extent + (count-1) * extent);
62 }
63
64 static int test_upper( unsigned int length )
65 {
66 double *mat1, *mat2, *inbuf;
67 opal_datatype_t *pdt;
68 opal_convertor_t * pConv;
69 char *ptr;
70 int rc;
71 unsigned int i, j, iov_count, split_chunk, total_length;
72 size_t max_data;
73 struct iovec a;
74 TIMER_DATA_TYPE start, end;
75 long total_time;
76
77
78 pdt = upper_matrix( length );
79
80
81 mat1 = malloc( length * length * sizeof(double) );
82 init_random_upper_matrix( length, mat1 );
83 mat2 = calloc( length * length, sizeof(double) );
84
85 total_length = length * (length + 1) * ( sizeof(double) / 2);
86 inbuf = (double*)malloc( total_length );
87 ptr = (char*)inbuf;
88
89 for( i = 0; i < length; i++ ) {
90 uint32_t pos = i * length + i;
91 for( j = i; j < length; j++, pos++ ) {
92 *inbuf = mat1[pos];
93 inbuf++;
94 }
95 }
96 inbuf = (double*)ptr;
97 pConv = opal_convertor_create( remote_arch, 0 );
98 if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( pConv, pdt, 1, mat2 ) ) {
99 printf( "Cannot attach the datatype to a convertor\n" );
100 return OPAL_ERROR;
101 }
102
103 GET_TIME( start );
104 split_chunk = (length + 1) * sizeof(double);
105
106 for( i = total_length; i > 0; ) {
107 if( i <= split_chunk ) {
108 split_chunk = i;
109 }
110 a.iov_base = ptr;
111 a.iov_len = split_chunk;
112 iov_count = 1;
113 max_data = split_chunk;
114 opal_convertor_unpack( pConv, &a, &iov_count, &max_data );
115 ptr += max_data;
116 i -= max_data;
117 if( mat2[0] != inbuf[0] ) assert(0);
118 }
119 GET_TIME( end );
120 total_time = ELAPSED_TIME( start, end );
121 printf( "complete unpacking in %ld microsec\n", total_time );
122 free( inbuf );
123 rc = check_diag_matrix( length, mat1, mat2 );
124 free( mat1 );
125 free( mat2 );
126
127
128 opal_datatype_destroy( &pdt );
129 assert( pdt == NULL );
130
131 OBJ_RELEASE( pConv );
132 return rc;
133 }
134
135
136
137
138
139
140
141
142
143
144
145 static int local_copy_ddt_count( opal_datatype_t const * const pdt, int count )
146 {
147 ptrdiff_t lb, extent;
148 size_t malloced_size;
149 char *odst, *osrc;
150 void *pdst, *psrc;
151 TIMER_DATA_TYPE start, end;
152 long total_time;
153 int errors = 0;
154
155 malloced_size = compute_memory_size(pdt, count);
156 opal_datatype_get_extent( pdt, &lb, &extent );
157
158 odst = (char*)malloc( malloced_size );
159 osrc = (char*)malloc( malloced_size );
160
161 {
162 for( size_t i = 0; i < malloced_size; i++ )
163 osrc[i] = i % 128 + 32;
164 memcpy(odst, osrc, malloced_size);
165 }
166 pdst = odst - lb;
167 psrc = osrc - lb;
168
169 cache_trash();
170
171 GET_TIME( start );
172 if( OPAL_SUCCESS != opal_datatype_copy_content_same_ddt( pdt, count, pdst, psrc ) ) {
173 printf( "Unable to copy the datatype in the function local_copy_ddt_count."
174 " Is the datatype committed ?\n" );
175 }
176 GET_TIME( end );
177 total_time = ELAPSED_TIME( start, end );
178 printf( "direct local copy in %ld microsec\n", total_time );
179 if(outputFlags & VALIDATE_DATA) {
180 for( size_t i = 0; i < malloced_size; i++ ) {
181 if( odst[i] != osrc[i] ) {
182 printf("error at position %lu (%d != %d)\n",
183 (unsigned long)i, (int)(odst[i]), (int)(osrc[i]));
184 errors++;
185 if(outputFlags & QUIT_ON_FIRST_ERROR) {
186 opal_datatype_dump(pdt);
187 assert(0); exit(-1);
188 }
189 }
190 }
191 if( 0 == errors ) {
192 printf("Validation check successfully passed\n");
193 } else {
194 printf("Found %d errors. Giving up!\n", errors);
195 exit(-1);
196 }
197 }
198 free( odst );
199 free( osrc );
200
201 return (0 == errors ? OPAL_SUCCESS : errors);
202 }
203
204 static int
205 local_copy_with_convertor_2datatypes( opal_datatype_t const * const send_type, int send_count,
206 opal_datatype_t const * const recv_type, int recv_count,
207 int chunk )
208 {
209 ptrdiff_t send_lb, send_extent, recv_lb, recv_extent;
210 void *pdst = NULL, *psrc = NULL, *ptemp = NULL;
211 char *odst, *osrc;
212 opal_convertor_t *send_convertor = NULL, *recv_convertor = NULL;
213 struct iovec iov;
214 uint32_t iov_count;
215 size_t max_data, length = 0, send_malloced_size, recv_malloced_size;;
216 int32_t done1 = 0, done2 = 0;
217 TIMER_DATA_TYPE start, end, unpack_start, unpack_end;
218 long total_time, unpack_time = 0;
219
220 send_malloced_size = compute_memory_size(send_type, send_count);
221 recv_malloced_size = compute_memory_size(recv_type, recv_count);
222
223 opal_datatype_get_extent( send_type, &send_lb, &send_extent );
224 opal_datatype_get_extent( recv_type, &recv_lb, &recv_extent );
225
226 odst = (char*)malloc( recv_malloced_size );
227 osrc = (char*)malloc( send_malloced_size );
228 ptemp = malloc( chunk );
229
230
231 {
232 for( size_t i = 0; i < send_malloced_size; i++ )
233 osrc[i] = i % 128 + 32;
234 }
235 memset( odst, 0, recv_malloced_size );
236 pdst = odst - recv_lb;
237 psrc = osrc - send_lb;
238
239 send_convertor = opal_convertor_create( remote_arch, 0 );
240 if( OPAL_SUCCESS != opal_convertor_prepare_for_send( send_convertor, send_type, send_count, psrc ) ) {
241 printf( "Unable to create the send convertor. Is the datatype committed ?\n" );
242 goto clean_and_return;
243 }
244 recv_convertor = opal_convertor_create( remote_arch, 0 );
245 if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( recv_convertor, recv_type, recv_count, pdst ) ) {
246 printf( "Unable to create the recv convertor. Is the datatype committed ?\n" );
247 goto clean_and_return;
248 }
249
250 cache_trash();
251
252 GET_TIME( start );
253 while( (done1 & done2) != 1 ) {
254
255 if( done1 | done2 ) {
256 printf( "WRONG !!! the send is %s but the receive is %s in local_copy_with_convertor_2datatypes\n",
257 (done1 ? "finish" : "not finish"),
258 (done2 ? "finish" : "not finish") );
259 }
260
261 max_data = chunk;
262 iov_count = 1;
263 iov.iov_base = ptemp;
264 iov.iov_len = chunk;
265
266 if( done1 == 0 ) {
267 done1 = opal_convertor_pack( send_convertor, &iov, &iov_count, &max_data );
268 }
269
270 if( done2 == 0 ) {
271 GET_TIME( unpack_start );
272 done2 = opal_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data );
273 GET_TIME( unpack_end );
274 unpack_time += ELAPSED_TIME( unpack_start, unpack_end );
275 }
276
277 length += max_data;
278
279 if( outputFlags & RESET_CONVERTORS ) {
280 size_t pos = 0;
281 opal_convertor_set_position(send_convertor, &pos);
282 pos = length;
283 opal_convertor_set_position(send_convertor, &pos);
284 assert(pos == length);
285
286 pos = 0;
287 opal_convertor_set_position(recv_convertor, &pos);
288 pos = length;
289 opal_convertor_set_position(recv_convertor, &pos);
290 assert(pos == length);
291 }
292 }
293 GET_TIME( end );
294 total_time = ELAPSED_TIME( start, end );
295 printf( "copying different data-types using convertors in %ld microsec\n", total_time );
296 printf( "\t unpack in %ld microsec [pack in %ld microsec]\n", unpack_time,
297 total_time - unpack_time );
298 clean_and_return:
299 if( send_convertor != NULL ) {
300 OBJ_RELEASE( send_convertor ); assert( send_convertor == NULL );
301 }
302 if( recv_convertor != NULL ) {
303 OBJ_RELEASE( recv_convertor ); assert( recv_convertor == NULL );
304 }
305 if( NULL != odst ) free( odst );
306 if( NULL != osrc ) free( osrc );
307 if( NULL != ptemp ) free( ptemp );
308 return OPAL_SUCCESS;
309 }
310
311 static int local_copy_with_convertor( opal_datatype_t const * const pdt, int count, int chunk )
312 {
313 ptrdiff_t lb, extent;
314 void *pdst = NULL, *psrc = NULL, *ptemp = NULL;
315 char *odst, *osrc;
316 opal_convertor_t *send_convertor = NULL, *recv_convertor = NULL;
317 struct iovec iov;
318 uint32_t iov_count;
319 size_t max_data, length = 0, malloced_size;
320 int32_t done1 = 0, done2 = 0, errors = 0;
321 TIMER_DATA_TYPE start, end, unpack_start, unpack_end;
322 long total_time, unpack_time = 0;
323
324 malloced_size = compute_memory_size(pdt, count);
325 opal_datatype_get_extent( pdt, &lb, &extent );
326
327 odst = (char*)malloc( malloced_size );
328 osrc = (char*)malloc( malloced_size );
329 ptemp = malloc( chunk );
330
331 {
332 for( size_t i = 0; i < malloced_size; osrc[i] = i % 128 + 32, i++ );
333 memcpy(odst, osrc, malloced_size);
334 }
335 pdst = odst - lb;
336 psrc = osrc - lb;
337
338 send_convertor = opal_convertor_create( remote_arch, 0 );
339 if( OPAL_SUCCESS != opal_convertor_prepare_for_send( send_convertor, pdt, count, psrc ) ) {
340 printf( "Unable to create the send convertor. Is the datatype committed ?\n" );
341 goto clean_and_return;
342 }
343
344 recv_convertor = opal_convertor_create( remote_arch, 0 );
345 if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( recv_convertor, pdt, count, pdst ) ) {
346 printf( "Unable to create the recv convertor. Is the datatype committed ?\n" );
347 goto clean_and_return;
348 }
349
350 cache_trash();
351
352 GET_TIME( start );
353 while( (done1 & done2) != 1 ) {
354
355 if( done1 | done2 ) {
356 printf( "WRONG !!! the send is %s but the receive is %s in local_copy_with_convertor\n",
357 (done1 ? "finish" : "not finish"),
358 (done2 ? "finish" : "not finish") );
359 }
360
361 max_data = chunk;
362 iov_count = 1;
363 iov.iov_base = ptemp;
364 iov.iov_len = chunk;
365
366 if( done1 == 0 ) {
367 done1 = opal_convertor_pack( send_convertor, &iov, &iov_count, &max_data );
368 }
369
370 if( done2 == 0 ) {
371 GET_TIME( unpack_start );
372 done2 = opal_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data );
373 GET_TIME( unpack_end );
374 unpack_time += ELAPSED_TIME( unpack_start, unpack_end );
375 }
376
377 length += max_data;
378 if( outputFlags & RESET_CONVERTORS ) {
379 struct dt_stack_t stack[1+send_convertor->stack_pos];
380 int i, stack_pos = send_convertor->stack_pos;
381 size_t pos;
382
383 if( 0 == done1 ) {
384 memcpy(stack, send_convertor->pStack, (1+send_convertor->stack_pos) * sizeof(struct dt_stack_t));
385 pos = 0;
386 opal_convertor_set_position(send_convertor, &pos);
387 pos = length;
388 opal_convertor_set_position(send_convertor, &pos);
389 assert(pos == length);
390 for(i = 0; i <= stack_pos; i++ ) {
391 if( stack[i].index != send_convertor->pStack[i].index )
392 {errors = 1; printf("send stack[%d].index differs (orig %d != new %d) (completed %lu/%lu)\n",
393 i, stack[i].index, send_convertor->pStack[i].index,
394 length, pdt->size * count);}
395 if( stack[i].count != send_convertor->pStack[i].count ) {
396 if( stack[i].type == send_convertor->pStack[i].type ) {
397 {errors = 1; printf("send stack[%d].count differs (orig %lu != new %lu) (completed %lu/%lu)\n",
398 i, stack[i].count, send_convertor->pStack[i].count,
399 length, pdt->size * count);}
400 } else {
401 if( (OPAL_DATATYPE_MAX_PREDEFINED <= stack[i].type) || (OPAL_DATATYPE_MAX_PREDEFINED <= send_convertor->pStack[i].type) )
402 {errors = 1; printf("send stack[%d].type wrong (orig %d != new %d) (completed %lu/%lu)\n",
403 i, (int)stack[i].type, (int)send_convertor->pStack[i].type,
404 length, pdt->size * count);}
405 else if( (stack[i].count * opal_datatype_basicDatatypes[stack[i].type]->size) !=
406 (send_convertor->pStack[i].count * opal_datatype_basicDatatypes[send_convertor->pStack[i].type]->size) )
407 {errors = 1; printf("send stack[%d].type*count differs (orig (%d,%lu) != new (%d, %lu)) (completed %lu/%lu)\n",
408 i, (int)stack[i].type, stack[i].count,
409 (int)send_convertor->pStack[i].type, send_convertor->pStack[i].count,
410 length, pdt->size * count);}
411 }
412 }
413 if( stack[i].disp != send_convertor->pStack[i].disp )
414 {errors = 1; printf("send stack[%d].disp differs (orig %p != new %p) (completed %lu/%lu)\n",
415 i, (void*)stack[i].disp, (void*)send_convertor->pStack[i].disp,
416 length, pdt->size * count);}
417 if(0 != errors) {assert(0); exit(-1);}
418 }
419 }
420 if( 0 == done2 ) {
421 memcpy(stack, recv_convertor->pStack, (1+recv_convertor->stack_pos) * sizeof(struct dt_stack_t));
422 pos = 0;
423 opal_convertor_set_position(recv_convertor, &pos);
424 pos = length;
425 opal_convertor_set_position(recv_convertor, &pos);
426 assert(pos == length);
427 for(i = 0; i <= stack_pos; i++ ) {
428 if( stack[i].index != recv_convertor->pStack[i].index )
429 {errors = 1; printf("recv stack[%d].index differs (orig %d != new %d) (completed %lu/%lu)\n",
430 i, stack[i].index, recv_convertor->pStack[i].index,
431 length, pdt->size * count);}
432 if( stack[i].count != recv_convertor->pStack[i].count ) {
433 if( stack[i].type == recv_convertor->pStack[i].type ) {
434 {errors = 1; printf("recv stack[%d].count differs (orig %lu != new %lu) (completed %lu/%lu)\n",
435 i, stack[i].count, recv_convertor->pStack[i].count,
436 length, pdt->size * count);}
437 } else {
438 if( (OPAL_DATATYPE_MAX_PREDEFINED <= stack[i].type) || (OPAL_DATATYPE_MAX_PREDEFINED <= recv_convertor->pStack[i].type) )
439 {errors = 1; printf("recv stack[%d].type wrong (orig %d != new %d) (completed %lu/%lu)\n",
440 i, (int)stack[i].type, (int)recv_convertor->pStack[i].type,
441 length, pdt->size * count);}
442 else if( (stack[i].count * opal_datatype_basicDatatypes[stack[i].type]->size) !=
443 (recv_convertor->pStack[i].count * opal_datatype_basicDatatypes[recv_convertor->pStack[i].type]->size) )
444 {errors = 1; printf("recv stack[%d].type*count differs (orig (%d,%lu) != new (%d, %lu)) (completed %lu/%lu)\n",
445 i, (int)stack[i].type, stack[i].count,
446 (int)recv_convertor->pStack[i].type, recv_convertor->pStack[i].count,
447 length, pdt->size * count);}
448 }
449 }
450 if( stack[i].disp != recv_convertor->pStack[i].disp )
451 {errors = 1; printf("recv stack[%d].disp differs (orig %p != new %p) (completed %lu/%lu)\n",
452 i, (void*)stack[i].disp, (void*)recv_convertor->pStack[i].disp,
453 length, pdt->size * count);}
454 if(0 != errors) {assert(0); exit(-1);}
455 }
456 }
457 }
458 }
459 GET_TIME( end );
460 total_time = ELAPSED_TIME( start, end );
461 printf( "copying same data-type using convertors in %ld microsec\n", total_time );
462 printf( "\t unpack in %ld microsec [pack in %ld microsec]\n", unpack_time,
463 total_time - unpack_time );
464
465 if(outputFlags & VALIDATE_DATA) {
466 for( size_t i = errors = 0; i < malloced_size; i++ ) {
467 if( odst[i] != osrc[i] ) {
468 printf("error at position %lu (%d != %d)\n",
469 (unsigned long)i, (int)(odst[i]), (int)(osrc[i]));
470 errors++;
471 if(outputFlags & QUIT_ON_FIRST_ERROR) {
472 opal_datatype_dump(pdt);
473 assert(0); exit(-1);
474 }
475 }
476 }
477 if( 0 == errors ) {
478 printf("Validation check successfully passed\n");
479 } else {
480 printf("Found %d errors. Giving up!\n", errors);
481 exit(-1);
482 }
483 }
484 clean_and_return:
485 if( NULL != send_convertor ) OBJ_RELEASE( send_convertor );
486 if( NULL != recv_convertor ) OBJ_RELEASE( recv_convertor );
487
488 if( NULL != odst ) free( odst );
489 if( NULL != osrc ) free( osrc );
490 if( NULL != ptemp ) free( ptemp );
491 return (0 == errors ? OPAL_SUCCESS : errors);
492 }
493
494
495
496
497
498
499
500
501 int main( int argc, char* argv[] )
502 {
503 opal_datatype_t *pdt, *pdt1, *pdt2, *pdt3;
504 int rc, length = 500;
505
506 opal_init_util (NULL, NULL);
507
508
509
510
511 remote_arch = opal_local_arch;
512 printf( "\n\n#\n * TEST CREATE CONTIGUOUS\n#\n\n" );
513 pdt = create_contiguous_type( &opal_datatype_int1, 10 );
514 if( outputFlags & CHECK_PACK_UNPACK ) {
515 local_copy_ddt_count(pdt, 100);
516 local_copy_with_convertor(pdt, 100, 956);
517 }
518 OBJ_RELEASE( pdt ); assert( pdt == NULL );
519
520 printf( "\n\n#\n * TEST STRANGE DATATYPE\n#\n\n" );
521 pdt = create_strange_dt();
522 if( outputFlags & CHECK_PACK_UNPACK ) {
523 local_copy_ddt_count(pdt, 1);
524 local_copy_with_convertor(pdt, 1, 956);
525 }
526 OBJ_RELEASE( pdt ); assert( pdt == NULL );
527
528 printf( "\n\n#\n * TEST UPPER TRIANGULAR MATRIX (size 100)\n#\n\n" );
529 pdt = upper_matrix(100);
530 if( outputFlags & CHECK_PACK_UNPACK ) {
531 local_copy_ddt_count(pdt, 1);
532 local_copy_with_convertor(pdt, 1, 48);
533 }
534 OBJ_RELEASE( pdt ); assert( pdt == NULL );
535
536 printf( "\n\n#\n * TEST UPPER MATRIX\n#\n\n" );
537 rc = test_upper( length );
538 if( rc == 0 )
539 printf( "decode [PASSED]\n" );
540 else
541 printf( "decode [NOT PASSED]\n" );
542
543 printf( "\n\n#\n * TEST MATRIX BORDERS\n#\n\n" );
544 pdt = test_matrix_borders( length, 100 );
545 if( outputFlags & DUMP_DATA_AFTER_COMMIT ) {
546 opal_datatype_dump( pdt );
547 }
548 OBJ_RELEASE( pdt ); assert( pdt == NULL );
549
550
551 printf( "\n\n#\n * TEST CONTIGUOUS\n#\n\n" );
552 pdt = test_contiguous();
553 OBJ_RELEASE( pdt ); assert( pdt == NULL );
554 printf( "\n\n#\n * TEST STRUCT\n#\n\n" );
555 pdt = test_struct();
556 OBJ_RELEASE( pdt ); assert( pdt == NULL );
557
558 opal_datatype_create_contiguous(0, &opal_datatype_empty, &pdt1);
559 opal_datatype_create_contiguous(0, &opal_datatype_empty, &pdt2);
560 opal_datatype_create_contiguous(0, &opal_datatype_empty, &pdt3);
561
562 opal_datatype_add( pdt3, &opal_datatype_int4, 10, 0, -1 );
563 opal_datatype_add( pdt3, &opal_datatype_float4, 5, 10 * sizeof(int), -1 );
564
565 opal_datatype_add( pdt2, &opal_datatype_float4, 1, 0, -1 );
566 opal_datatype_add( pdt2, pdt3, 3, sizeof(int) * 1, -1 );
567
568 opal_datatype_add( pdt1, &opal_datatype_int8, 5, 0, -1 );
569 opal_datatype_add( pdt1, &opal_datatype_float16, 2, sizeof(long long) * 5, -1 );
570
571 printf( ">>--------------------------------------------<<\n" );
572 if( outputFlags & DUMP_DATA_AFTER_COMMIT ) {
573 opal_datatype_dump( pdt1 );
574 }
575 printf( ">>--------------------------------------------<<\n" );
576 if( outputFlags & DUMP_DATA_AFTER_COMMIT ) {
577 opal_datatype_dump( pdt2 );
578 }
579 printf( ">>--------------------------------------------<<\n" );
580 if( outputFlags & DUMP_DATA_AFTER_COMMIT ) {
581 opal_datatype_dump( pdt3 );
582 }
583
584 OBJ_RELEASE( pdt1 ); assert( pdt1 == NULL );
585 OBJ_RELEASE( pdt2 ); assert( pdt2 == NULL );
586 OBJ_RELEASE( pdt3 ); assert( pdt3 == NULL );
587
588 printf( ">>--------------------------------------------<<\n" );
589 printf( " Contiguous data-type (opal_datatype_float8)\n" );
590 if( outputFlags & CHECK_PACK_UNPACK ) {
591 opal_datatype_t const * const ddt = &opal_datatype_float8;
592 local_copy_ddt_count( ddt, 4500);
593 local_copy_with_convertor( ddt, 4500, 12 );
594 local_copy_with_convertor_2datatypes( ddt, 4500, ddt, 4500, 12 );
595 }
596 printf( ">>--------------------------------------------<<\n" );
597
598 printf( ">>--------------------------------------------<<\n" );
599 if( outputFlags & CHECK_PACK_UNPACK ) {
600 printf( "Contiguous multiple data-type (4500*1)\n" );
601 pdt = create_contiguous_type( &opal_datatype_float8, 4500 );
602 local_copy_ddt_count(pdt, 1);
603 local_copy_with_convertor( pdt, 1, 12 );
604 local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 12 );
605 OBJ_RELEASE( pdt ); assert( pdt == NULL );
606 printf( "Contiguous multiple data-type (450*10)\n" );
607 pdt = create_contiguous_type( &opal_datatype_float8, 450 );
608 local_copy_ddt_count(pdt, 10);
609 local_copy_with_convertor( pdt, 10, 12 );
610 local_copy_with_convertor_2datatypes( pdt, 10, pdt, 10, 12 );
611 OBJ_RELEASE( pdt ); assert( pdt == NULL );
612 printf( "Contiguous multiple data-type (45*100)\n" );
613 pdt = create_contiguous_type( &opal_datatype_float8, 45 );
614 local_copy_ddt_count(pdt, 100);
615 local_copy_with_convertor( pdt, 100, 12 );
616 local_copy_with_convertor_2datatypes( pdt, 100, pdt, 100, 12 );
617 OBJ_RELEASE( pdt ); assert( pdt == NULL );
618 printf( "Contiguous multiple data-type (100*45)\n" );
619 pdt = create_contiguous_type( &opal_datatype_float8, 100 );
620 local_copy_ddt_count(pdt, 45);
621 local_copy_with_convertor( pdt, 45, 12 );
622 local_copy_with_convertor_2datatypes( pdt, 45, pdt, 45, 12 );
623 OBJ_RELEASE( pdt ); assert( pdt == NULL );
624 printf( "Contiguous multiple data-type (10*450)\n" );
625 pdt = create_contiguous_type( &opal_datatype_float8, 10 );
626 local_copy_ddt_count(pdt, 450);
627 local_copy_with_convertor( pdt, 450, 12 );
628 local_copy_with_convertor_2datatypes( pdt, 450, pdt, 450, 12 );
629 OBJ_RELEASE( pdt ); assert( pdt == NULL );
630 printf( "Contiguous multiple data-type (1*4500)\n" );
631 pdt = create_contiguous_type( &opal_datatype_float8, 1 );
632 local_copy_ddt_count(pdt, 4500);
633 local_copy_with_convertor( pdt, 4500, 12 );
634 local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 12 );
635 OBJ_RELEASE( pdt ); assert( pdt == NULL );
636 }
637 printf( ">>--------------------------------------------<<\n" );
638 printf( ">>--------------------------------------------<<\n" );
639 printf( "Vector data-type (450 times 10 double stride 11)\n" );
640 pdt = create_vector_type( &opal_datatype_float8, 450, 10, 11 );
641 opal_datatype_dump( pdt );
642 if( outputFlags & CHECK_PACK_UNPACK ) {
643 local_copy_ddt_count(pdt, 1);
644 local_copy_with_convertor( pdt, 1, 12 );
645 local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 12 );
646 local_copy_with_convertor( pdt, 1, 82 );
647 local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 82 );
648 local_copy_with_convertor( pdt, 1, 6000 );
649 local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 6000 );
650 local_copy_with_convertor( pdt, 1, 36000 );
651 local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 36000 );
652 }
653 printf( ">>--------------------------------------------<<\n" );
654 OBJ_RELEASE( pdt ); assert( pdt == NULL );
655
656 printf( ">>--------------------------------------------<<\n" );
657 printf( "Struct data-type resized (double unused followed by 2 used doubles)\n" );
658 pdt = create_struct_constant_gap_resized_ddt( &opal_datatype_float8 );
659 opal_datatype_dump( pdt );
660 if( outputFlags & CHECK_PACK_UNPACK ) {
661 local_copy_ddt_count(pdt, 1);
662 local_copy_with_convertor( pdt, 100, 11 );
663 local_copy_with_convertor_2datatypes( pdt, 100, pdt, 100, 11 );
664 local_copy_with_convertor( pdt, 100, 82 );
665 local_copy_with_convertor_2datatypes( pdt, 100, pdt, 100, 81 );
666 local_copy_with_convertor( pdt, 1500, 6000 );
667 local_copy_with_convertor_2datatypes( pdt, 1500, pdt, 1500, 666 );
668 local_copy_with_convertor( pdt, 10000, 36000 );
669 local_copy_with_convertor_2datatypes( pdt, 10000, pdt, 10000, 1111 );
670 }
671 printf( ">>--------------------------------------------<<\n" );
672 OBJ_RELEASE( pdt ); assert( pdt == NULL );
673
674 printf( ">>--------------------------------------------<<\n" );
675 pdt = test_struct_char_double();
676 if( outputFlags & CHECK_PACK_UNPACK ) {
677 local_copy_ddt_count(pdt, 4500);
678 local_copy_with_convertor( pdt, 4500, 12 );
679 local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 12 );
680 }
681 printf( ">>--------------------------------------------<<\n" );
682 OBJ_RELEASE( pdt ); assert( pdt == NULL );
683
684 printf( ">>--------------------------------------------<<\n" );
685 pdt = test_create_twice_two_doubles();
686 if( outputFlags & CHECK_PACK_UNPACK ) {
687 local_copy_ddt_count(pdt, 4500);
688 local_copy_with_convertor( pdt, 4500, 12 );
689 local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 12 );
690 }
691 printf( ">>--------------------------------------------<<\n" );
692 OBJ_RELEASE( pdt ); assert( pdt == NULL );
693
694 printf( ">>--------------------------------------------<<\n" );
695 pdt = test_create_blacs_type();
696 if( outputFlags & CHECK_PACK_UNPACK ) {
697 opal_datatype_dump( pdt );
698 local_copy_ddt_count(pdt, 4500);
699 local_copy_with_convertor( pdt, 4500, 956 );
700 local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 956 );
701 local_copy_with_convertor( pdt, 4500, 16*1024 );
702 local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 16*1024 );
703 local_copy_with_convertor( pdt, 4500, 64*1024 );
704 local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 64*1024 );
705 }
706 printf( ">>--------------------------------------------<<\n" );
707 OBJ_RELEASE( pdt ); assert( pdt == NULL );
708
709 printf( ">>--------------------------------------------<<\n" );
710 pdt1 = test_create_blacs_type1( &opal_datatype_int4 );
711 pdt2 = test_create_blacs_type2( &opal_datatype_int4 );
712 if( outputFlags & CHECK_PACK_UNPACK ) {
713 local_copy_with_convertor_2datatypes( pdt1, 1, pdt2, 1, 100 );
714 }
715 printf( ">>--------------------------------------------<<\n" );
716 OBJ_RELEASE( pdt1 ); assert( pdt1 == NULL );
717 OBJ_RELEASE( pdt2 ); assert( pdt2 == NULL );
718
719
720 opal_finalize_util ();
721
722 return OPAL_SUCCESS;
723 }