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-2013 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) 2009 Oak Ridge National Labs. All rights reserved. 14 * $COPYRIGHT$ 15 * 16 * Additional copyrights may follow 17 * 18 * $HEADER$ 19 */ 20 21 #include "ompi_config.h" 22 23 #include "opal/datatype/opal_convertor.h" 24 #include "opal/util/arch.h" 25 #include "ompi/datatype/ompi_datatype.h" 26 27 /* From the MPI standard. external32 use the following types: 28 * Type Length 29 * MPI_PACKED 1 30 * MPI_BYTE 1 31 * MPI_CHAR 1 32 * MPI_UNSIGNED_CHAR 1 33 * MPI_SIGNED_CHAR 1 34 * MPI_WCHAR 2 35 * MPI_SHORT 2 36 * MPI_UNSIGNED_SHORT 2 37 * MPI_INT 4 38 * MPI_UNSIGNED 4 39 * MPI_LONG 4 40 * MPI_UNSIGNED_LONG 4 41 * MPI_FLOAT 4 42 * MPI_DOUBLE 8 43 * MPI_LONG_DOUBLE 16 44 * Fortran types 45 * MPI_CHARACTER 1 46 * MPI_LOGICAL 4 47 * MPI_INTEGER 4 48 * MPI_REAL 4 49 * MPI_DOUBLE_PRECISION 8 50 * MPI_COMPLEX 2*4 51 * MPI_DOUBLE_COMPLEX 2*8 52 * Optional types 53 * MPI_INTEGER1 1 54 * MPI_INTEGER2 2 55 * MPI_INTEGER4 4 56 * MPI_INTEGER8 8 57 * MPI_LONG_LONG_INT 8 58 * MPI_UNSIGNED_LONG_LONG 8 59 * MPI_REAL4 4 60 * MPI_REAL8 8 61 * MPI_REAL16 16 62 * 63 * All floating point values are in big-endian IEEE format. Double extended use 16 bytes, with 64 * 15 exponent bits (bias = 10383), 112 mantissa bits and the same encoding as double. All 65 * integers are in two's complement big-endian format. 66 * 67 * All data are byte aligned, regardless of type. That's exactly what we expect as we can 68 * consider the data stored in external32 as being packed. 69 */ 70 71 uint32_t ompi_datatype_external32_arch_id = OPAL_ARCH_LDEXPSIZEIS15 | OPAL_ARCH_LDMANTDIGIS113 | 72 OPAL_ARCH_LONGDOUBLEIS128 | OPAL_ARCH_ISBIGENDIAN | 73 OPAL_ARCH_HEADERMASK | OPAL_ARCH_HEADERMASK2 | 74 OPAL_ARCH_BOOLIS8 | OPAL_ARCH_LOGICALIS8; 75 76 opal_convertor_t* ompi_mpi_external32_convertor = NULL; 77 opal_convertor_t* ompi_mpi_local_convertor = NULL; 78 79 int32_t ompi_datatype_default_convertors_init( void ) 80 { 81 /* create the extern32 convertor */ 82 ompi_mpi_external32_convertor = opal_convertor_create( ompi_datatype_external32_arch_id, 0 ); 83 84 /* create the local convertor */ 85 ompi_mpi_local_convertor = opal_convertor_create( opal_local_arch, 0 ); 86 87 return OMPI_SUCCESS; 88 } 89 90 91 int32_t ompi_datatype_default_convertors_fini( void ) 92 { 93 OBJ_RELEASE( ompi_mpi_external32_convertor ); 94 OBJ_RELEASE( ompi_mpi_local_convertor ); 95 96 return OMPI_SUCCESS; 97 }