1 /* -*- Mode: C; c-basic-offset:4 ; -*- */ 2 /* 3 * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana 4 * University Research and Technology 5 * Corporation. All rights reserved. 6 * Copyright (c) 2004-2014 The University of Tennessee and The University 7 * of Tennessee Research Foundation. All rights 8 * reserved. 9 * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, 10 * University of Stuttgart. All rights reserved. 11 * Copyright (c) 2004-2006 The Regents of the University of California. 12 * All rights reserved. 13 * Copyright (c) 2006 Sun Microsystems Inc. All rights reserved. 14 * Copyright (c) 2018 Los Alamos National Security, LLC. All rights 15 * reserved. 16 * $COPYRIGHT$ 17 * 18 * Additional copyrights may follow 19 * 20 * $HEADER$ 21 */ 22 23 #include "ompi_config.h" 24 #include "ompi/datatype/ompi_datatype.h" 25 #include <time.h> 26 #include <stdlib.h> 27 #ifdef HAVE_SYS_TIME_H 28 #include <sys/time.h> 29 #endif 30 #include <stdio.h> 31 32 #define TIMER_DATA_TYPE struct timeval 33 #define GET_TIME(TV) gettimeofday( &(TV), NULL ) 34 #define ELAPSED_TIME(TSTART, TEND) (((TEND).tv_sec - (TSTART).tv_sec) * 1000000 + ((TEND).tv_usec - (TSTART).tv_usec)) 35 36 #define DUMP_DATA_AFTER_COMMIT 0x00000001 37 #define CHECK_PACK_UNPACK 0x00000002 38 39 extern uint32_t outputFlags; 40 41 /** 42 * Cache cleanup. 43 */ 44 extern void cache_trash( void ); 45 46 /** 47 * Data-type functions. 48 */ 49 ompi_datatype_t* create_inversed_vector( const ompi_datatype_t* type, int length ); 50 51 extern void print_double_mat( unsigned int N, double* mat ); 52 extern int init_random_upper_matrix( unsigned int N, double* mat ); 53 extern int check_diag_matrix( unsigned int N, double* mat1, double* mat2 ); 54 extern ompi_datatype_t* upper_matrix( unsigned int mat_size ); 55 extern ompi_datatype_t* lower_matrix( unsigned int mat_size ); 56 extern ompi_datatype_t* test_matrix_borders( unsigned int size, unsigned int width ); 57 extern ompi_datatype_t* test_contiguous( void ); 58 extern ompi_datatype_t* test_struct_char_double( void ); 59 extern ompi_datatype_t* test_create_twice_two_doubles( void ); 60 61 /* 62 Datatype 0x832cf28 size 0 align 1 id 0 length 4 used 0 63 true_lb 0 true_ub 0 (true_extent 0) lb 0 ub 0 (extent 0) 64 nbElems 0 loops 0 flags 6 (committed contiguous )-cC--------[---][---] 65 contain 13 disp 0x420 (1056) extent 4 66 --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x478 (1144) extent 4 67 --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x4d0 (1232) extent 4 68 --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x528 (1320) extent 4 69 --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x580 (1408) extent 4 70 --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x5d8 (1496) extent 4 71 --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x630 (1584) extent 4 72 --C-----D*-[ C ][INT] MPI_INT count 12 disp 0x68c (1676) extent 4 73 --C-----D*-[ C ][INT] MPI_INT count 11 disp 0x6e8 (1768) extent 4 74 --C-----D*-[ C ][INT] MPI_INT count 10 disp 0x744 (1860) extent 4 75 --C-----D*-[ C ][INT] MPI_INT count 9 disp 0x7a0 (1952) extent 4 76 --C-----D*-[ C ][INT] MPI_INT count 8 disp 0x7fc (2044) extent 4 77 --C-----D*-[ C ][INT] MPI_INT count 7 disp 0x858 (2136) extent 4 78 --C-----D*-[ C ][INT] MPI_INT count 6 disp 0x8b4 (2228) extent 4 79 --C-----D*-[ C ][INT] MPI_INT count 5 disp 0x910 (2320) extent 4 80 --C-----D*-[ C ][INT] MPI_INT count 4 disp 0x96c (2412) extent 4 81 --C-----D*-[ C ][INT] MPI_INT count 3 disp 0x9c8 (2504) extent 4 82 --C-----D*-[ C ][INT] MPI_INT count 2 disp 0xa24 (2596) extent 4 83 --C-----D*-[ C ][INT] MPI_INT count 1 disp 0xa80 (2688) extent 4 84 */ 85 extern ompi_datatype_t* test_create_blacs_type( void ); 86 extern ompi_datatype_t* test_create_blacs_type1( const ompi_datatype_t* base_type ); 87 extern ompi_datatype_t* test_create_blacs_type2( const ompi_datatype_t* base_type ); 88 extern ompi_datatype_t* test_struct( void ); 89 extern ompi_datatype_t* create_strange_dt( void ); 90 extern ompi_datatype_t* create_contiguous_type( const ompi_datatype_t* data, int count ); 91 extern ompi_datatype_t* create_vector_type( const ompi_datatype_t* data, int count, 92 int length, int stride ); 93 extern ompi_datatype_t* create_struct_constant_gap_resized_ddt( ompi_datatype_t* type ); 94