diff --git a/AUTHORS b/AUTHORS index 5a0cf815ae..3604b30029 100644 --- a/AUTHORS +++ b/AUTHORS @@ -60,7 +60,7 @@ rhc Ralph Castain LANL rlgraham Rich Graham ORNL, LANL rolfv Rolf Vandevaart Sun rta Rob Awles LANL -rusraink Rainer Keller HLRS +rusraink Rainer Keller HLRS, ORNL sami Sami Ayyorgun LANL santhana Gopal Santhanaraman OSU sharonm Sharon Melamed Voltaire diff --git a/config/f90_check.m4 b/config/f90_check.m4 index d377052e99..4200e9df3a 100644 --- a/config/f90_check.m4 +++ b/config/f90_check.m4 @@ -166,6 +166,9 @@ AC_DEFUN([OMPI_F90_CHECK], [ # functions here (vs. $ompi_upper_var_name, defined above) because # these need to be set at autoconf time, not configure time. [OMPI_SIZEOF_F90_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [a-z], [A-Z])[=$ofc_type_size] + AC_DEFINE_UNQUOTED([OMPI_SIZEOF_F90_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [a-z], [A-Z]), + [$ofc_type_size], + [Size of Fortran 77 $ofc_fortran_type]) AC_SUBST([OMPI_SIZEOF_F90_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [a-z], [A-Z])) # Clean up diff --git a/config/opal_configure_options.m4 b/config/opal_configure_options.m4 index 8bd312c4f1..a28d52b0a4 100644 --- a/config/opal_configure_options.m4 +++ b/config/opal_configure_options.m4 @@ -487,7 +487,7 @@ AC_ARG_WITH([dst-checksum], [Use an alternative checksum algorithm for messages])]) if test "$with_dst_checksum" = "yes"; then AC_MSG_RESULT([yes]) - CFLAGS="-DOMPI_CSUM_DST $CFLAGS" + CFLAGS="-DOPAL_CSUM_DST $CFLAGS" else AC_MSG_RESULT([no]) fi diff --git a/configure.ac b/configure.ac index 77377b3ef9..9482de2f59 100644 --- a/configure.ac +++ b/configure.ac @@ -224,8 +224,6 @@ OMPI_CHECK_IDENT([CC], [CFLAGS], [c], [C]) # Check for some types # -AC_CHECK_TYPES(long long) -AC_CHECK_TYPES(long double) AC_CHECK_TYPES(int8_t) AC_CHECK_TYPES(uint8_t) AC_CHECK_TYPES(int16_t) @@ -234,6 +232,15 @@ AC_CHECK_TYPES(int32_t) AC_CHECK_TYPES(uint32_t) AC_CHECK_TYPES(int64_t) AC_CHECK_TYPES(uint64_t) +AC_CHECK_TYPES(int128_t) +AC_CHECK_TYPES(uint128_t) +AC_CHECK_TYPES(long long) + +AC_CHECK_TYPES(long double) +AC_CHECK_TYPES(float _Complex) +AC_CHECK_TYPES(double _Complex) +AC_CHECK_TYPES(long double _Complex) + AC_CHECK_TYPES(intptr_t) AC_CHECK_TYPES(uintptr_t) AC_CHECK_TYPES(mode_t) @@ -251,11 +258,22 @@ AC_CHECK_SIZEOF(long) if test $ac_cv_type_long_long = yes; then AC_CHECK_SIZEOF(long long) fi +AC_CHECK_SIZEOF(float) +AC_CHECK_SIZEOF(double) if test $ac_cv_type_long_double = yes; then AC_CHECK_SIZEOF(long double) fi -AC_CHECK_SIZEOF(float) -AC_CHECK_SIZEOF(double) + +if test "$ac_cv_type_float__Complex" = yes; then + AC_CHECK_SIZEOF(float _Complex) +fi +if test "$ac_cv_type_double__Complex" = yes; then + AC_CHECK_SIZEOF(double _Complex) +fi +if test "$ac_cv_type_long_double__Complex" = yes; then + AC_CHECK_SIZEOF(long double _Complex) +fi + AC_CHECK_SIZEOF(void *) AC_CHECK_SIZEOF(size_t) if test $ac_cv_type_ssize_t = yes ; then @@ -264,25 +282,46 @@ fi if test $ac_cv_type_ptrdiff_t = yes; then AC_CHECK_SIZEOF(ptrdiff_t) fi +AC_CHECK_SIZEOF(wchar_t) + # # Check for type alignments # +OMPI_C_GET_ALIGNMENT(_Bool, OPAL_ALIGNMENT_BOOL) +OMPI_C_GET_ALIGNMENT(int8_t, OPAL_ALIGNMENT_INT8) +OMPI_C_GET_ALIGNMENT(int16_t, OPAL_ALIGNMENT_INT16) +OMPI_C_GET_ALIGNMENT(int32_t, OPAL_ALIGNMENT_INT32) +OMPI_C_GET_ALIGNMENT(int64_t, OPAL_ALIGNMENT_INT64) +if test "$ac_cv_type_int128_t" = yes ; then + OMPI_C_GET_ALIGNMENT(int128_t, OPAL_ALIGNMENT_INT128) +fi OMPI_C_GET_ALIGNMENT(char, OPAL_ALIGNMENT_CHAR) OMPI_C_GET_ALIGNMENT(short, OPAL_ALIGNMENT_SHORT) -OMPI_C_GET_ALIGNMENT(wchar_t, OMPI_ALIGNMENT_WCHAR) +OMPI_C_GET_ALIGNMENT(wchar_t, OPAL_ALIGNMENT_WCHAR) OMPI_C_GET_ALIGNMENT(int, OPAL_ALIGNMENT_INT) OMPI_C_GET_ALIGNMENT(long, OPAL_ALIGNMENT_LONG) -if test $ac_cv_type_long_long = yes; then +if test "$ac_cv_type_long_long" = yes; then OMPI_C_GET_ALIGNMENT(long long, OPAL_ALIGNMENT_LONG_LONG) fi -OMPI_C_GET_ALIGNMENT(float, OMPI_ALIGNMENT_FLOAT) -OMPI_C_GET_ALIGNMENT(double, OMPI_ALIGNMENT_DOUBLE) -if test $ac_cv_type_long_double = yes; then +OMPI_C_GET_ALIGNMENT(float, OPAL_ALIGNMENT_FLOAT) +OMPI_C_GET_ALIGNMENT(double, OPAL_ALIGNMENT_DOUBLE) +if test "$ac_cv_type_long_double" = yes; then OMPI_C_GET_ALIGNMENT(long double, OPAL_ALIGNMENT_LONG_DOUBLE) fi -OMPI_C_GET_ALIGNMENT(void *, OMPI_ALIGNMENT_VOID_P) + +if test "$ac_cv_type_float__Complex" = yes; then + OMPI_C_GET_ALIGNMENT(float _Complex, OPAL_ALIGNMENT_FLOAT_COMPLEX) +fi +if test "$ac_cv_type_double__Complex" = yes; then + OMPI_C_GET_ALIGNMENT(double _Complex, OPAL_ALIGNMENT_DOUBLE_COMPLEX) +fi +if test "$ac_cv_type_long_double__Complex" = yes; then + OMPI_C_GET_ALIGNMENT(long double _Complex, OPAL_ALIGNMENT_LONG_DOUBLE_COMPLEX) +fi + +OMPI_C_GET_ALIGNMENT(void *, OPAL_ALIGNMENT_VOID_P) # # Does the C compiler native support "bool"? (i.e., without @@ -407,7 +446,7 @@ AC_CHECK_SIZEOF(bool) # check for type alignments -OMPI_C_GET_ALIGNMENT(bool, OMPI_ALIGNMENT_CXX_BOOL) +OMPI_C_GET_ALIGNMENT(bool, OPAL_ALIGNMENT_CXX_BOOL) AC_LANG_POP(C++) # check if we want C++ support @@ -454,6 +493,8 @@ AC_DEFINE([ompi_fortran_bogus_type_t], [int], # We want to set the #define's for all of these, so invoke the macros # regardless of whether we have F77 support or not. +OMPI_F77_CHECK([CHARACTER], [yes], + [char, int32_t, int, int64_t, long long, long], [-1]) OMPI_F77_CHECK([LOGICAL], [yes], [char, int32_t, int, int64_t, long long, long], [-1]) @@ -465,6 +506,7 @@ OMPI_F77_CHECK([LOGICAL*4], [yes], [int32_t, int, int64_t, long long, long], [4]) OMPI_F77_CHECK([LOGICAL*8], [yes], [int, int64_t, long long, long], [8]) + OMPI_F77_CHECK([INTEGER], [yes], [int32_t, int, int64_t, long long, long], [-1]) OMPI_F77_CHECK([INTEGER*1], [no], @@ -566,6 +608,8 @@ OMPI_F90_IKINDS="" OMPI_F90_RKINDS="" OMPI_F90_CKINDS="" +OMPI_F90_CHECK([CHARACTER]) + # LOGICAL and friends OMPI_F90_CHECK([LOGICAL]) OMPI_F90_CHECK([LOGICAL*1], [1]) @@ -1351,6 +1395,7 @@ AC_CONFIG_FILES([ opal/etc/Makefile opal/include/Makefile opal/asm/Makefile + opal/datatype/Makefile opal/event/Makefile opal/event/compat/Makefile opal/event/compat/sys/Makefile diff --git a/ompi/attribute/attribute.c b/ompi/attribute/attribute.c index 7463f0dc42..550a89d2a7 100644 --- a/ompi/attribute/attribute.c +++ b/ompi/attribute/attribute.c @@ -196,7 +196,7 @@ #include "opal/class/opal_bitmap.h" #include "opal/threads/mutex.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" /* ompi_datatype_t generated in [COPY|DELETE]_ATTR_CALLBACKS */ +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" /* ompi_communicator_t generated in [COPY|DELETE]_ATTR_CALLBACKS */ #include "ompi/win/win.h" /* ompi_win_t generated in [COPY|DELETE]_ATTR_CALLBACKS */ #include "ompi/mpi/f77/fint_2_int.h" diff --git a/ompi/datatype/Makefile.am b/ompi/datatype/Makefile.am index ea270f716e..99a98f62bc 100644 --- a/ompi/datatype/Makefile.am +++ b/ompi/datatype/Makefile.am @@ -20,48 +20,25 @@ # headers = \ - datatype.h \ - datatype_internal.h \ - datatype_prototypes.h \ - datatype_pack.h \ - datatype_unpack.h \ - datatype_checksum.h \ - datatype_memcpy.h \ - convertor.h \ - convertor_internal.h + ompi_datatype.h noinst_LTLIBRARIES = \ - libdatatype_reliable.la \ libdatatype.la -# these sources will be compiled with the special -D -libdatatype_reliable_la_SOURCES = datatype_pack.c datatype_unpack.c -libdatatype_reliable_la_CFLAGS = -DCHECKSUM $(AM_CFLAGS) - # these sources will be compiled with the normal CFLAGS only libdatatype_la_SOURCES = \ - dt_add.c \ - dt_create.c \ - dt_create_dup.c \ - dt_create_indexed.c \ - dt_create_struct.c \ - dt_create_vector.c \ - dt_destroy.c \ - dt_module.c \ - dt_optimize.c \ - datatype_pack.c datatype_unpack.c \ - dt_sndrcv.c \ - fake_stack.c \ - dt_args.c \ - dt_copy.c \ - dt_external32.c \ - dt_match_size.c \ - convertor.c convertor_raw.c position.c \ - copy_functions.c \ - copy_functions_heterogeneous.c \ - dt_get_count.c + ompi_datatype_args.c \ + ompi_datatype_create.c \ + ompi_datatype_create_contiguous.c \ + ompi_datatype_create_indexed.c \ + ompi_datatype_create_struct.c \ + ompi_datatype_create_vector.c \ + ompi_datatype_external32.c \ + ompi_datatype_match_size.c \ + ompi_datatype_module.c \ + ompi_datatype_sndrcv.c -libdatatype_la_LIBADD = libdatatype_reliable.la +libdatatype_la_LIBADD = # Conditionally install the header files if WANT_INSTALL_HEADERS diff --git a/ompi/datatype/convertor.h b/ompi/datatype/convertor.h deleted file mode 100644 index 5225c15e38..0000000000 --- a/ompi/datatype/convertor.h +++ /dev/null @@ -1,353 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2009 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef CONVERTOR_H_HAS_BEEN_INCLUDED -#define CONVERTOR_H_HAS_BEEN_INCLUDED - -#include "ompi_config.h" -#include "ompi/constants.h" -#include "ompi/datatype/datatype.h" -#include "opal/prefetch.h" -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_UIO_H -#include -#endif -#ifdef HAVE_NET_UIO_H -#include -#endif - -BEGIN_C_DECLS -/* - * CONVERTOR SECTION - */ -/* keep the last 16 bits free for data flags */ -#define CONVERTOR_DATATYPE_MASK 0x0000FFFF -#define CONVERTOR_SEND_CONVERSION 0x00010000 -#define CONVERTOR_RECV 0x00020000 -#define CONVERTOR_SEND 0x00040000 -#define CONVERTOR_HOMOGENEOUS 0x00080000 -#define CONVERTOR_NO_OP 0x00100000 -#define CONVERTOR_WITH_CHECKSUM 0x00200000 -#define CONVERTOR_TYPE_MASK 0x00FF0000 -#define CONVERTOR_STATE_START 0x01000000 -#define CONVERTOR_STATE_COMPLETE 0x02000000 -#define CONVERTOR_STATE_ALLOC 0x04000000 -#define CONVERTOR_COMPLETED 0x08000000 - -typedef struct ompi_convertor_t ompi_convertor_t; - -typedef int32_t (*convertor_advance_fct_t)( ompi_convertor_t* pConvertor, - struct iovec* iov, - uint32_t* out_size, - size_t* max_data ); -typedef void*(*memalloc_fct_t)( size_t* pLength, void* userdata ); - -/* The master convertor struct (defined in convertor_internal.h) */ -struct ompi_convertor_master_t; - -typedef struct dt_stack { - int32_t index; /**< index in the element description */ - int16_t type; /**< the type used for the last pack/unpack (original or DT_BYTE) */ - size_t count; /**< number of times we still have to do it */ - ptrdiff_t disp; /**< actual displacement depending on the count field */ -} dt_stack_t; - -/** - * - */ - -#define DT_STATIC_STACK_SIZE 5 - -struct ompi_convertor_t { - opal_object_t super; /**< basic superclass */ - uint32_t remoteArch; /**< the remote architecture */ - uint32_t flags; /**< the properties of this convertor */ - size_t local_size; - size_t remote_size; - const struct ompi_datatype_t* pDesc; /**< the datatype description associated with the convertor */ - const struct dt_type_desc* use_desc; /**< the version used by the convertor (normal or optimized) */ - opal_ddt_count_t count; /**< the total number of full datatype elements */ - unsigned char* pBaseBuf; /**< initial buffer as supplied by the user */ - dt_stack_t* pStack; /**< the local stack for the actual conversion */ - uint32_t stack_size; /**< size of the allocated stack */ - convertor_advance_fct_t fAdvance; /**< pointer to the pack/unpack functions */ - struct ompi_convertor_master_t* master; /* the master convertor */ - /* All others fields get modified for every call to pack/unpack functions */ - uint32_t stack_pos; /**< the actual position on the stack */ - size_t bConverted; /**< # of bytes already converted */ - uint32_t partial_length; /**< amount of data left over from the last unpack */ - uint32_t checksum; /**< checksum computed by pack/unpack operation */ - uint32_t csum_ui1; /**< partial checksum computed by pack/unpack operation */ - size_t csum_ui2; /**< partial checksum computed by pack/unpack operation */ - dt_stack_t static_stack[DT_STATIC_STACK_SIZE]; /**< local stack for small datatypes */ -}; -OMPI_DECLSPEC OBJ_CLASS_DECLARATION( ompi_convertor_t ); - -/* Base convertor for all external32 operations */ -OMPI_DECLSPEC extern ompi_convertor_t* ompi_mpi_external32_convertor; -OMPI_DECLSPEC extern ompi_convertor_t* ompi_mpi_local_convertor; -OMPI_DECLSPEC extern uint32_t ompi_mpi_local_arch; - -/* - * - */ -static inline uint32_t -ompi_convertor_get_checksum( ompi_convertor_t* convertor ) -{ - return convertor->checksum; -} - -/* - * - */ -OMPI_DECLSPEC int32_t -ompi_convertor_pack( ompi_convertor_t* pConv, - struct iovec* iov, - uint32_t* out_size, - size_t* max_data ); - -/* - * - */ -OMPI_DECLSPEC int32_t -ompi_convertor_unpack( ompi_convertor_t* pConv, - struct iovec* iov, - uint32_t* out_size, - size_t* max_data ); - -/* - * - */ -OMPI_DECLSPEC ompi_convertor_t* ompi_convertor_create( int32_t remote_arch, int32_t mode ); - -/** - * The cleanup function will put the convertor in exactly the same state as after a call - * to ompi_convertor_construct. Therefore, all PML can call OBJ_DESTRUCT on the request's - * convertors without having to call OBJ_CONSTRUCT everytime they grab a new one from the - * cache. The OBJ_CONSTRUCT on the convertor should be called only on the first creation - * of a request (not when extracted from the cache). - */ -static inline int ompi_convertor_cleanup( ompi_convertor_t* convertor ) -{ - if( OPAL_UNLIKELY(convertor->stack_size > DT_STATIC_STACK_SIZE) ) { - free( convertor->pStack ); - convertor->pStack = convertor->static_stack; - convertor->stack_size = DT_STATIC_STACK_SIZE; - } - convertor->pDesc = NULL; - convertor->stack_pos = 0; - convertor->flags = DT_FLAG_NO_GAPS | CONVERTOR_COMPLETED; - return OMPI_SUCCESS; -} - -/* - * Return: 0 if no packing is required for sending (the upper layer - * can use directly the pointer to the contiguous user - * buffer). - * 1 if data does need to be packed, i.e. heterogeneous peers - * (source arch != dest arch) or non contiguous memory - * layout. - */ -static inline int32_t -ompi_convertor_need_buffers( const ompi_convertor_t* pConvertor ) -{ -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - if (OPAL_UNLIKELY(0 == (pConvertor->flags & CONVERTOR_HOMOGENEOUS))) return 1; -#endif - if( pConvertor->flags & DT_FLAG_NO_GAPS ) return 0; - if( (pConvertor->count == 1) && (pConvertor->flags & DT_FLAG_CONTIGUOUS) ) return 0; - return 1; -} - -/* - * - */ -static inline void -ompi_convertor_get_packed_size( const ompi_convertor_t* pConv, - size_t* pSize ) -{ - *pSize = pConv->local_size; -} - -/* - * - */ -static inline void -ompi_convertor_get_unpacked_size( const ompi_convertor_t* pConv, - size_t* pSize ) -{ - *pSize = pConv->remote_size; -} - -/** - * Return the current absolute position of the next pack/unpack. This function is - * mostly useful for contiguous datatypes, when we need to get the pointer to the - * contiguous piece of memory. - */ -static inline void -ompi_convertor_get_current_pointer( const ompi_convertor_t* pConv, - void** position ) -{ - unsigned char* base = pConv->pBaseBuf + pConv->bConverted + pConv->pDesc->true_lb; - *position = (void*)base; -} - -/* - * - */ -OMPI_DECLSPEC int32_t -ompi_convertor_prepare_for_send( ompi_convertor_t* convertor, - const struct ompi_datatype_t* datatype, - int32_t count, - const void* pUserBuf); -static inline int32_t -ompi_convertor_copy_and_prepare_for_send( const ompi_convertor_t* pSrcConv, - const struct ompi_datatype_t* datatype, - int32_t count, - const void* pUserBuf, - int32_t flags, - ompi_convertor_t* convertor ) -{ - convertor->remoteArch = pSrcConv->remoteArch; - convertor->flags = pSrcConv->flags | flags; - convertor->master = pSrcConv->master; - - return ompi_convertor_prepare_for_send( convertor, datatype, count, pUserBuf ); -} - -/* - * - */ -OMPI_DECLSPEC int32_t -ompi_convertor_prepare_for_recv( ompi_convertor_t* convertor, - const struct ompi_datatype_t* datatype, - int32_t count, - const void* pUserBuf ); -static inline int32_t -ompi_convertor_copy_and_prepare_for_recv( const ompi_convertor_t* pSrcConv, - const struct ompi_datatype_t* datatype, - int32_t count, - const void* pUserBuf, - int32_t flags, - ompi_convertor_t* convertor ) -{ - convertor->remoteArch = pSrcConv->remoteArch; - convertor->flags = (pSrcConv->flags | flags); - convertor->master = pSrcConv->master; - - return ompi_convertor_prepare_for_recv( convertor, datatype, count, pUserBuf ); -} - -/* - * Give access to the raw memory layout based on the datatype. - */ -OMPI_DECLSPEC int32_t -ompi_convertor_raw( ompi_convertor_t* convertor, /* [IN/OUT] */ - struct iovec* iov, /* [IN/OUT] */ - uint32_t* iov_count, /* [IN/OUT] */ - size_t* length ); /* [OUT] */ - -/* - * Upper level does not need to call the _nocheck function directly. - */ -OMPI_DECLSPEC int32_t -ompi_convertor_set_position_nocheck( ompi_convertor_t* convertor, - size_t* position ); -static inline int32_t -ompi_convertor_set_position( ompi_convertor_t* convertor, - size_t* position ) -{ - /* - * Do not allow the convertor to go outside the data boundaries. This test include - * the check for datatype with size zero as well as for convertors with a count of zero. - */ - if( OPAL_UNLIKELY(convertor->local_size <= *position) ) { - convertor->flags |= CONVERTOR_COMPLETED; - convertor->bConverted = convertor->local_size; - *position = convertor->bConverted; - return OMPI_SUCCESS; - } - - /* - * If the convertor is already at the correct position we are happy. - */ - if( OPAL_LIKELY((*position) == convertor->bConverted) ) return OMPI_SUCCESS; - - /* Remove the completed flag if it's already set */ - convertor->flags &= ~CONVERTOR_COMPLETED; - - if( !(convertor->flags & CONVERTOR_WITH_CHECKSUM) && - (convertor->flags & DT_FLAG_NO_GAPS) && - (convertor->flags & (CONVERTOR_SEND | CONVERTOR_HOMOGENEOUS)) ) { - /* Contiguous and no checkpoint and no homogeneous unpack */ - convertor->bConverted = *position; - return OMPI_SUCCESS; - } - return ompi_convertor_set_position_nocheck( convertor, position ); -} - -/* - * - */ -static inline int32_t -ompi_convertor_personalize( ompi_convertor_t* convertor, uint32_t flags, - size_t* position ) -{ - convertor->flags |= flags; - - if( OPAL_UNLIKELY(NULL == position) ) - return OMPI_SUCCESS; - return ompi_convertor_set_position( convertor, position ); -} - -/* - * - */ -OMPI_DECLSPEC int -ompi_convertor_clone( const ompi_convertor_t* source, - ompi_convertor_t* destination, - int32_t copy_stack ); -static inline int -ompi_convertor_clone_with_position( const ompi_convertor_t* source, - ompi_convertor_t* destination, - int32_t copy_stack, - size_t* position ) -{ - (void)ompi_convertor_clone( source, destination, copy_stack ); - return ompi_convertor_set_position( destination, position ); -} - -/* - * - */ -OMPI_DECLSPEC void ompi_convertor_dump( ompi_convertor_t* convertor ); -OMPI_DECLSPEC void ompi_ddt_dump_stack( const dt_stack_t* pStack, int stack_pos, - const union dt_elem_desc* pDesc, const char* name ); - -/* - * - */ -OMPI_DECLSPEC int -ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, - size_t* position ); - -END_C_DECLS -#endif /* CONVERTOR_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/datatype/copy_functions.c b/ompi/datatype/copy_functions.c deleted file mode 100644 index 67e9ced2c0..0000000000 --- a/ompi/datatype/copy_functions.c +++ /dev/null @@ -1,286 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype_internal.h" -#include "ompi/datatype/datatype_checksum.h" -#include "ompi/datatype/convertor_internal.h" - -/* - * This function is used to copy data from one buffer to another. The assumption - * is that the number of bytes per element to copy at the source and destination - * are the same. - * count - number of instances of a given data-type to copy - * from - point to the source buffer - * to - pointer to the destination buffer - * from_len - length of source buffer (in bytes) - * to_len - length of destination buffer (in bytes) - * from_extent - extent of the source data type (in bytes) - * to_extent - extent of the destination data type (in bytes) - * - * Return value: Number of elements of type TYPE copied - */ -#define COPY_TYPE( TYPENAME, TYPE, COUNT ) \ -static int copy_##TYPENAME( ompi_convertor_t *pConvertor, uint32_t count, \ - char* from, size_t from_len, ptrdiff_t from_extent, \ - char* to, size_t to_len, ptrdiff_t to_extent, \ - ptrdiff_t *advance) \ -{ \ - uint32_t i; \ - size_t remote_TYPE_size = sizeof(TYPE) * (COUNT); /* TODO */ \ - size_t local_TYPE_size = (COUNT) * sizeof(TYPE); \ - \ - /* make sure the remote buffer is large enough to hold the data */ \ - if( (remote_TYPE_size * count) > from_len ) { \ - count = (uint32_t)(from_len / remote_TYPE_size); \ - if( (count * remote_TYPE_size) != from_len ) { \ - DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \ - from_len - (count * remote_TYPE_size) ); \ - } \ - DUMP( "correct: copy %s count %d from buffer %p with length %d to %p space %d\n", \ - #TYPE, count, from, from_len, to, to_len ); \ - } else \ - DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \ - #TYPE, count, from, from_len, to, to_len ); \ - \ - if( (from_extent == (ptrdiff_t)local_TYPE_size) && \ - (to_extent == (ptrdiff_t)remote_TYPE_size) ) { \ - /* copy of contigous data at both source and destination */ \ - MEMCPY( to, from, count * local_TYPE_size ); \ - } else { \ - /* source or destination are non-contigous */ \ - for( i = 0; i < count; i++ ) { \ - MEMCPY( to, from, local_TYPE_size ); \ - to += to_extent; \ - from += from_extent; \ - } \ - } \ - *advance = count * from_extent; \ - return count; \ -} - -/* - * This function is used to copy data from one buffer to another. The assumption - * is that the number of bytes per element to copy at the source and destination - * are the same. - * count - number of instances of a given data-type to copy - * from - point to the source buffer - * to - pointer to the destination buffer - * from_len - length of source buffer (in bytes) - * to_len - length of destination buffer (in bytes) - * from_extent - extent of the source data type (in bytes) - * to_extent - extent of the destination data type (in bytes) - * - * Return value: Number of elements of type TYPE copied - */ -#define COPY_CONTIGUOUS_BYTES( TYPENAME, COUNT ) \ -static int copy_##TYPENAME##_##COUNT( ompi_convertor_t *pConvertor, uint32_t count, \ - char* from, size_t from_len, ptrdiff_t from_extent, \ - char* to, size_t to_len, ptrdiff_t to_extent, \ - ptrdiff_t *advance ) \ -{ \ - uint32_t i; \ - size_t remote_TYPE_size = (size_t)(COUNT); /* TODO */ \ - size_t local_TYPE_size = (size_t)(COUNT); \ - \ - if( (remote_TYPE_size * count) > from_len ) { \ - count = (uint32_t)(from_len / remote_TYPE_size); \ - if( (count * remote_TYPE_size) != from_len ) { \ - DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \ - from_len - (count * remote_TYPE_size) ); \ - } \ - DUMP( "correct: copy %s count %d from buffer %p with length %d to %p space %d\n", \ - #TYPENAME, count, from, from_len, to, to_len ); \ - } else \ - DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \ - #TYPENAME, count, from, from_len, to, to_len ); \ - \ - if( (from_extent == (ptrdiff_t)local_TYPE_size) && \ - (to_extent == (ptrdiff_t)remote_TYPE_size) ) { \ - MEMCPY( to, from, count * local_TYPE_size ); \ - } else { \ - for( i = 0; i < count; i++ ) { \ - MEMCPY( to, from, local_TYPE_size ); \ - to += to_extent; \ - from += from_extent; \ - } \ - } \ - *advance = count * from_extent; \ - return count; \ -} - -/* set up copy functions for the basic C MPI data types */ -COPY_TYPE( char, char, 1 ) -COPY_TYPE( short, short, 1 ) -COPY_TYPE( int, int, 1 ) -COPY_TYPE( float, float, 1 ) -COPY_TYPE( long, long, 1 ) -COPY_TYPE( double, double, 1 ) -COPY_TYPE( long_long, long long, 1 ) -COPY_TYPE( long_double, long double, 1 ) -COPY_TYPE( complex_float, ompi_complex_float_t, 1 ) -COPY_TYPE( complex_double, ompi_complex_double_t, 1 ) -COPY_TYPE( complex_long_double, ompi_complex_long_double_t, 1 ) -COPY_TYPE( wchar, wchar_t, 1 ) -COPY_TYPE( 2int, int, 2 ) -COPY_TYPE( 2float, float, 2 ) -COPY_TYPE( 2double, double, 2 ) -COPY_TYPE( 2complex_float, ompi_complex_float_t, 2 ) -COPY_TYPE( 2complex_double, ompi_complex_double_t, 2 ) - -#if OMPI_SIZEOF_FORTRAN_LOGICAL == 1 || SIZEOF_BOOL == 1 -#define REQUIRE_COPY_BYTES_1 1 -#else -#define REQUIRE_COPY_BYTES_1 0 -#endif - -#if OMPI_SIZEOF_FORTRAN_LOGICAL == 2 || SIZEOF_BOOL == 2 -#define REQUIRE_COPY_BYTES_2 1 -#else -#define REQUIRE_COPY_BYTES_2 0 -#endif - -#if OMPI_SIZEOF_FORTRAN_LOGICAL == 4 || SIZEOF_BOOL == 4 -#define REQUIRE_COPY_BYTES_4 1 -#else -#define REQUIRE_COPY_BYTES_4 0 -#endif - -#if (SIZEOF_FLOAT + SIZEOF_INT) == 8 || (SIZEOF_LONG + SIZEOF_INT) == 8 || SIZEOF_BOOL == 8 -#define REQUIRE_COPY_BYTES_8 1 -#else -#define REQUIRE_COPY_BYTES_8 0 -#endif - -#if (SIZEOF_DOUBLE + SIZEOF_INT) == 12 || (SIZEOF_LONG + SIZEOF_INT) == 12 -#define REQUIRE_COPY_BYTES_12 1 -#else -#define REQUIRE_COPY_BYTES_12 0 -#endif - -#if (SIZEOF_LONG_DOUBLE + SIZEOF_INT) == 16 -#define REQUIRE_COPY_BYTES_16 1 -#else -#define REQUIRE_COPY_BYTES_16 0 -#endif - -#if (SIZEOF_LONG_DOUBLE + SIZEOF_INT) == 20 -#define REQUIRE_COPY_BYTES_20 1 -#else -#define REQUIRE_COPY_BYTES_20 0 -#endif - -#if REQUIRE_COPY_BYTES_1 -COPY_CONTIGUOUS_BYTES( bytes, 1 ) -#endif /* REQUIRE_COPY_BYTES_1 */ -#if REQUIRE_COPY_BYTES_2 -COPY_CONTIGUOUS_BYTES( bytes, 2 ) -#endif /* REQUIRE_COPY_BYTES_2 */ -#if REQUIRE_COPY_BYTES_4 -COPY_CONTIGUOUS_BYTES( bytes, 4 ) -#endif /* REQUIRE_COPY_BYTES_4 */ -#if REQUIRE_COPY_BYTES_8 -COPY_CONTIGUOUS_BYTES( bytes, 8 ) -#endif /* REQUIRE_COPY_BYTES_8 */ -#if REQUIRE_COPY_BYTES_12 -COPY_CONTIGUOUS_BYTES( bytes, 12 ) -#endif /* REQUIRE_COPY_BYTES_12 */ -#if REQUIRE_COPY_BYTES_16 -COPY_CONTIGUOUS_BYTES( bytes, 16 ) -#endif /* REQUIRE_COPY_BYTES_16 */ -#if REQUIRE_COPY_BYTES_20 -COPY_CONTIGUOUS_BYTES( bytes, 20 ) -#endif /* REQUIRE_COPY_BYTES_20 */ - -/* table of predefined copy functions - one for each MPI type */ -conversion_fct_t ompi_ddt_copy_functions[DT_MAX_PREDEFINED] = { - (conversion_fct_t)NULL, /* DT_LOOP */ - (conversion_fct_t)NULL, /* DT_END_LOOP */ - (conversion_fct_t)NULL, /* DT_LB */ - (conversion_fct_t)NULL, /* DT_UB */ - (conversion_fct_t)copy_char, /* DT_CHAR */ - (conversion_fct_t)copy_char, /* DT_CHARACTER */ - (conversion_fct_t)copy_char, /* DT_UNSIGNED_CHAR */ - (conversion_fct_t)copy_char, /* DT_SIGNED_CHAR */ - (conversion_fct_t)copy_char, /* DT_BYTE */ - (conversion_fct_t)copy_short, /* DT_SHORT */ - (conversion_fct_t)copy_short, /* DT_UNSIGNED_SHORT */ - (conversion_fct_t)copy_int, /* DT_INT */ - (conversion_fct_t)copy_int, /* DT_UNSIGNED_INT */ - (conversion_fct_t)copy_long, /* DT_LONG */ - (conversion_fct_t)copy_long, /* DT_UNSIGNED_LONG */ - (conversion_fct_t)copy_long_long, /* DT_LONG_LONG_INT */ - (conversion_fct_t)copy_long_long, /* DT_UNSIGNED_LONG_LONG */ - (conversion_fct_t)copy_float, /* DT_FLOAT */ - (conversion_fct_t)copy_double, /* DT_DOUBLE */ - (conversion_fct_t)copy_long_double, /* DT_LONG_DOUBLE */ - (conversion_fct_t)NULL, /* DT_PACKED */ - (conversion_fct_t)copy_wchar, /* DT_WCHAR */ -#if SIZEOF_BOOL == 1 - (conversion_fct_t)copy_bytes_1, /* DT_CXX_BOOL */ -#elif SIZEOF_BOOL == 4 - (conversion_fct_t)copy_bytes_4, /* DT_CXX_BOOL */ -#elif SIZEOF_BOOL == 8 - (conversion_fct_t)copy_bytes_8, /* DT_CXX_BOOL */ -#else -#error Complete me please -#endif -#if OMPI_SIZEOF_FORTRAN_LOGICAL == 1 - (conversion_fct_t)copy_bytes_1, /* DT_LOGIC */ -#elif OMPI_SIZEOF_FORTRAN_LOGICAL == 4 - (conversion_fct_t)copy_bytes_4, /* DT_LOGIC */ -#elif 1 /* always, some compiler complain if there is not value */ - NULL, /* DT_LOGIC */ -#endif - (conversion_fct_t)copy_int, /* DT_INTEGER */ - (conversion_fct_t)copy_float, /* DT_REAL */ - (conversion_fct_t)copy_double, /* DT_DBLPREC */ - (conversion_fct_t)copy_complex_float, /* DT_COMPLEX_FLOAT */ - (conversion_fct_t)copy_complex_double, /* DT_COMPLEX_DOUBLE */ - (conversion_fct_t)copy_complex_long_double, /* DT_COMPLEX_LONG_DOUBLE */ - (conversion_fct_t)copy_2int, /* DT_2INT */ - (conversion_fct_t)copy_2int, /* DT_2INTEGER */ - (conversion_fct_t)copy_2float, /* DT_2REAL */ - (conversion_fct_t)copy_2double, /* DT_2DBLPREC */ - (conversion_fct_t)copy_2complex_float, /* DT_2COMPLEX */ - (conversion_fct_t)copy_2complex_double, /* DT_2DOUBLE_COMPLEX */ -#if (SIZEOF_FLOAT + SIZEOF_INT) == 8 - (conversion_fct_t)copy_bytes_8, /* DT_FLOAT_INT */ -#else -#error Complete me please -#endif -#if (SIZEOF_DOUBLE + SIZEOF_INT) == 12 - (conversion_fct_t)copy_bytes_12, /* DT_DOUBLE_INT */ -#else -#error Complete me please -#endif -#if (SIZEOF_LONG_DOUBLE + SIZEOF_INT) == 12 - (conversion_fct_t)copy_bytes_12, /* DT_LONG_DOUBLE_INT */ -#elif (SIZEOF_LONG_DOUBLE + SIZEOF_INT) == 16 - (conversion_fct_t)copy_bytes_16, /* DT_LONG_DOUBLE_INT */ -#elif (SIZEOF_LONG_DOUBLE + SIZEOF_INT) == 20 - (conversion_fct_t)copy_bytes_20, /* DT_LONG_DOUBLE_INT */ -#else -#error Complete me please -#endif -#if (SIZEOF_LONG + SIZEOF_INT) == 8 - (conversion_fct_t)copy_bytes_8, /* DT_LONG_INT */ -#elif (SIZEOF_LONG + SIZEOF_INT) == 12 - (conversion_fct_t)copy_bytes_12, /* DT_LONG_INT */ -#else -#error Complete me please -#endif - (conversion_fct_t)NULL, /* DT_SHORT_INT */ - (conversion_fct_t)NULL, /* DT_UNAVAILABLE */ -}; diff --git a/ompi/datatype/copy_functions_heterogeneous.c b/ompi/datatype/copy_functions_heterogeneous.c deleted file mode 100644 index b1885ee514..0000000000 --- a/ompi/datatype/copy_functions_heterogeneous.c +++ /dev/null @@ -1,396 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "opal/util/arch.h" - -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype_internal.h" -#include "ompi/datatype/datatype_checksum.h" -#include "ompi/datatype/convertor_internal.h" - -static inline void -ompi_dt_swap_bytes(void *to_p, const void *from_p, const size_t size) -{ - size_t i, back_i; - uint8_t *to = (uint8_t*) to_p, *from = (uint8_t*) from_p; - back_i = size - 1; - for (i = 0 ; i < size ; i++, back_i--) { - to[back_i] = from[i]; - } -} - - -#define COPY_TYPE_HETEROGENEOUS( TYPENAME, TYPE ) \ -static int32_t \ -copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \ - const char* from, size_t from_len, ptrdiff_t from_extent, \ - char* to, size_t to_length, ptrdiff_t to_extent, \ - ptrdiff_t *advance) \ -{ \ - uint32_t i; \ - \ - datatype_check( #TYPE, sizeof(TYPE), sizeof(TYPE), &count, \ - from, from_len, from_extent, \ - to, to_length, to_extent); \ - \ - if ((pConvertor->remoteArch & OPAL_ARCH_ISBIGENDIAN) != \ - (ompi_mpi_local_arch & OPAL_ARCH_ISBIGENDIAN)) { \ - for( i = 0; i < count; i++ ) { \ - ompi_dt_swap_bytes(to, from, sizeof(TYPE)); \ - to += to_extent; \ - from += from_extent; \ - } \ - } else if ((ptrdiff_t)sizeof(TYPE) == to_extent && \ - (ptrdiff_t)sizeof(TYPE) == from_extent) { \ - MEMCPY( to, from, count * sizeof(TYPE) ); \ - } else { \ - /* source or destination are non-contigous */ \ - for( i = 0; i < count; i++ ) { \ - MEMCPY( to, from, sizeof(TYPE) ); \ - to += to_extent; \ - from += from_extent; \ - } \ - } \ - *advance = count * from_extent; \ - return count; \ -} - - -#define COPY_2TYPE_HETEROGENEOUS( TYPENAME, TYPE1, TYPE2 ) \ -static int32_t \ -copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \ - const char* from, uint32_t from_len, ptrdiff_t from_extent, \ - char* to, uint32_t to_length, ptrdiff_t to_extent, \ - ptrdiff_t *advance) \ -{ \ - uint32_t i; \ - \ - datatype_check( #TYPENAME, sizeof(TYPE1) + sizeof(TYPE2), \ - sizeof(TYPE1) + sizeof(TYPE2), &count, \ - from, from_len, from_extent, \ - to, to_length, to_extent); \ - \ - if ((pConvertor->remoteArch & OPAL_ARCH_ISBIGENDIAN) != \ - (ompi_mpi_local_arch & OPAL_ARCH_ISBIGENDIAN)) { \ - /* source and destination are different endianness */ \ - for( i = 0; i < count; i++ ) { \ - TYPE1* to_1, *from_1; \ - TYPE2* to_2, *from_2; \ - to_1 = (TYPE1*) to; from_1 = (TYPE1*) from; \ - ompi_dt_swap_bytes(to_1, from_1, sizeof(TYPE1)); \ - to_2 = (TYPE2*) (to_1 + 1); from_2 = (TYPE2*) (from_1 + 1); \ - ompi_dt_swap_bytes(to_2, from_2, sizeof(TYPE2)); \ - to += to_extent; \ - from += from_extent; \ - } \ - } else if ((ptrdiff_t)(sizeof(TYPE1) + sizeof(TYPE2)) == to_extent && \ - (ptrdiff_t)(sizeof(TYPE1) + sizeof(TYPE2)) == from_extent) { \ - /* source and destination are contigous */ \ - MEMCPY( to, from, count * (sizeof(TYPE1) + sizeof(TYPE2)) ); \ - } else { \ - /* source or destination are non-contigous */ \ - for( i = 0; i < count; i++ ) { \ - MEMCPY( to, from, sizeof(TYPE1) + sizeof(TYPE2) ); \ - to += to_extent; \ - from += from_extent; \ - } \ - } \ - *advance = count * from_extent; \ - return count; \ -} - - -#define COPY_COMPLEX_HETEROGENEOUS( TYPENAME, TYPE ) \ - COPY_2TYPE_HETEROGENEOUS(complex_##TYPENAME, TYPE, TYPE) - - -#define COPY_2COMPLEX_HETEROGENEOUS( TYPENAME, TYPE ) \ -static int32_t \ -copy_2complex_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \ - const char* from, uint32_t from_len, ptrdiff_t from_extent, \ - char* to, uint32_t to_length, ptrdiff_t to_extent, \ - ptrdiff_t *advance) \ -{ \ - uint32_t i; \ - \ - datatype_check( #TYPENAME, sizeof(TYPE) * 2, sizeof(TYPE) * 2, &count, \ - from, from_len, from_extent, \ - to, to_length, to_extent); \ - \ - if ((pConvertor->remoteArch & OPAL_ARCH_ISBIGENDIAN) != \ - (ompi_mpi_local_arch & OPAL_ARCH_ISBIGENDIAN)) { \ - /* source and destination are different endianness */ \ - for( i = 0; i < count; i++ ) { \ - TYPE *to_p = (TYPE*) to, *from_p = (TYPE*) from; \ - ompi_dt_swap_bytes(&(to_p->r), &(from_p->r), sizeof(to_p->r)); \ - ompi_dt_swap_bytes(&(to_p->i), &(from_p->i), sizeof(to_p->i)); \ - to_p++; from_p++; \ - ompi_dt_swap_bytes(&(to_p->r), &(from_p->r), sizeof(to_p->r)); \ - ompi_dt_swap_bytes(&(to_p->i), &(from_p->i), sizeof(to_p->i)); \ - to += to_extent; \ - from += from_extent; \ - } \ - } else if (sizeof(TYPE) * 2 == to_extent && \ - sizeof(TYPE) * 2 == from_extent) { \ - /* source and destination are contigous */ \ - MEMCPY( to, from, count * (sizeof(TYPE) * 2) ); \ - } else { \ - /* source or destination are non-contigous */ \ - for( i = 0; i < count; i++ ) { \ - MEMCPY( to, from, sizeof(TYPE) * 2 ); \ - to += to_extent; \ - from += from_extent; \ - } \ - } \ - *advance = count * from_extent; \ - return count; \ -} - - -static inline void -datatype_check(char *type, size_t local_size, size_t remote_size, uint32_t *count, - const char* from, size_t from_len, ptrdiff_t from_extent, - char* to, size_t to_len, ptrdiff_t to_extent) -{ - /* make sure the remote buffer is large enough to hold the data */ - if( (remote_size * *count) > from_len ) { - *count = (uint32_t)(from_len / remote_size); - if( (*count * remote_size) != from_len ) { - DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", - from_len - (*count * remote_size) ); - } - DUMP( "correct: copy %s count %d from buffer %p with length %d to %p space %d\n", - "char", *count, from, from_len, to, to_len ); - } else { - DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", - "char", *count, from, from_len, to, to_len ); - } -} - - -/* char has no endian issues, so don't really worry about it */ -static int32_t -copy_char_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, - const char* from, uint32_t from_len, ptrdiff_t from_extent, - char* to, uint32_t to_length, ptrdiff_t to_extent, - ptrdiff_t *advance) -{ - uint32_t i; - - datatype_check("char", sizeof(char), sizeof(char), &count, - from, from_len, from_extent, - to, to_length, to_extent); - - if( (from_extent == sizeof(char)) && - (to_extent == sizeof(char)) ) { - /* copy of contigous data at both source and destination */ - MEMCPY( to, from, count * sizeof(char) ); - } else { - /* source or destination are non-contigous */ - for( i = 0; i < count; i++ ) { - MEMCPY( to, from, sizeof(char) ); - to += to_extent; - from += from_extent; - } - } - *advance = count * from_extent; - return count; -} - - -#define CXX_BOOL_COPY_LOOP(TYPE) \ - for( i = 0; i < count; i++ ) { \ - bool *to_real = (bool*) to; \ - *to_real = *((TYPE*) from) == 0 ? false : true; \ - to += to_extent; \ - from += from_extent; \ - } -static int32_t -copy_cxx_bool_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, - const char* from, uint32_t from_len, ptrdiff_t from_extent, - char* to, uint32_t to_length, ptrdiff_t to_extent, - ptrdiff_t *advance) -{ - uint32_t i; - - /* fix up the from extent */ - if ((pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) != - (ompi_mpi_local_arch & OPAL_ARCH_BOOLISxx)) { - switch (pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) { - case OPAL_ARCH_BOOLIS8: - from_extent = 1; - break; - case OPAL_ARCH_BOOLIS16: - from_extent = 2; - break; - case OPAL_ARCH_BOOLIS32: - from_extent = 4; - break; - } - } - - datatype_check( "bool", sizeof(bool), sizeof(bool), &count, - from, from_len, from_extent, - to, to_length, to_extent); - - if ((to_extent != sizeof(bool) || from_extent != sizeof(bool)) || - ((pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) != - (ompi_mpi_local_arch & OPAL_ARCH_BOOLISxx))) { - switch (pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) { - case OPAL_ARCH_BOOLIS8: - CXX_BOOL_COPY_LOOP(int8_t); - break; - case OPAL_ARCH_BOOLIS16: - CXX_BOOL_COPY_LOOP(int16_t); - break; - case OPAL_ARCH_BOOLIS32: - CXX_BOOL_COPY_LOOP(int32_t); - break; - } - } else { - MEMCPY( to, from, count * sizeof(bool) ); - } - - *advance = count * from_extent; - return count; -} - -#define FORTRAN_LOGICAL_COPY_LOOP(TYPE) \ - for( i = 0; i < count; i++ ) { \ - ompi_fortran_logical_t *to_real = (ompi_fortran_logical_t*) to; \ - *to_real = *((TYPE*) from) == 0 ? 0 : OMPI_FORTRAN_VALUE_TRUE; \ - to += to_extent; \ - from += from_extent; \ - } -static int32_t -copy_fortran_logical_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, - const char* from, uint32_t from_len, ptrdiff_t from_extent, - char* to, uint32_t to_length, ptrdiff_t to_extent, - ptrdiff_t *advance) -{ - uint32_t i; - - /* fix up the from extent */ - if ((pConvertor->remoteArch & OPAL_ARCH_LOGICALISxx) != - (ompi_mpi_local_arch & OPAL_ARCH_LOGICALISxx)) { - switch (pConvertor->remoteArch & OPAL_ARCH_LOGICALISxx) { - case OPAL_ARCH_LOGICALIS8: - from_extent = 1; - break; - case OPAL_ARCH_LOGICALIS16: - from_extent = 2; - break; - case OPAL_ARCH_LOGICALIS32: - from_extent = 4; - break; - } - } - - datatype_check( "logical", sizeof(ompi_fortran_logical_t), - sizeof(ompi_fortran_logical_t), &count, - from, from_len, from_extent, - to, to_length, to_extent); - - if ((to_extent != sizeof(ompi_fortran_logical_t) || - from_extent != sizeof(ompi_fortran_logical_t)) || - ((pConvertor->remoteArch & OPAL_ARCH_LOGICALISxx) != - (ompi_mpi_local_arch & OPAL_ARCH_LOGICALISxx))) { - switch (pConvertor->remoteArch & OPAL_ARCH_LOGICALISxx) { - case OPAL_ARCH_LOGICALIS8: - FORTRAN_LOGICAL_COPY_LOOP(int8_t); - break; - case OPAL_ARCH_LOGICALIS16: - FORTRAN_LOGICAL_COPY_LOOP(int16_t); - break; - case OPAL_ARCH_LOGICALIS32: - FORTRAN_LOGICAL_COPY_LOOP(int32_t); - break; - } - } else { - MEMCPY( to, from, count * sizeof(ompi_fortran_logical_t) ); - } - - *advance = count * from_extent; - return count; -} - - -COPY_TYPE_HETEROGENEOUS(short, short) -COPY_TYPE_HETEROGENEOUS(int, int) -COPY_TYPE_HETEROGENEOUS(long, long) -COPY_TYPE_HETEROGENEOUS(long_long, long long) -COPY_TYPE_HETEROGENEOUS(float, float) -COPY_TYPE_HETEROGENEOUS(double, double) -COPY_TYPE_HETEROGENEOUS(long_double, long double) -COPY_COMPLEX_HETEROGENEOUS(float, float) -COPY_COMPLEX_HETEROGENEOUS(double, double) -COPY_COMPLEX_HETEROGENEOUS(long_double, long double) -COPY_2TYPE_HETEROGENEOUS(float_int, float, int) -COPY_2TYPE_HETEROGENEOUS(double_int, double, int) -COPY_2TYPE_HETEROGENEOUS(long_double_int, long double, int) -COPY_2TYPE_HETEROGENEOUS(long_int, long, int) -COPY_2TYPE_HETEROGENEOUS(2int, int, int) -COPY_2TYPE_HETEROGENEOUS(2float, float, float) -COPY_2TYPE_HETEROGENEOUS(2double, double, double) -COPY_TYPE_HETEROGENEOUS(wchar, wchar_t) -COPY_2COMPLEX_HETEROGENEOUS(float, ompi_complex_float_t) -COPY_2COMPLEX_HETEROGENEOUS(double, ompi_complex_double_t) - - -/* table of predefined copy functions - one for each MPI type */ -conversion_fct_t ompi_ddt_heterogeneous_copy_functions[DT_MAX_PREDEFINED] = { - NULL, /* DT_LOOP */ - NULL, /* DT_END_LOOP */ - NULL, /* DT_LB */ - NULL, /* DT_UB */ - (conversion_fct_t) copy_char_heterogeneous, /* DT_CHAR */ - (conversion_fct_t) copy_char_heterogeneous, /* DT_CHARACTER */ - (conversion_fct_t) copy_char_heterogeneous, /* DT_UNSIGNED_CHAR */ - (conversion_fct_t) copy_char_heterogeneous, /* DT_SIGNED_CHAR */ - (conversion_fct_t) copy_char_heterogeneous, /* DT_BYTE */ - (conversion_fct_t) copy_short_heterogeneous, /* DT_SHORT */ - (conversion_fct_t) copy_short_heterogeneous, /* DT_UNSIGNED_SHORT */ - (conversion_fct_t) copy_int_heterogeneous, /* DT_INT */ - (conversion_fct_t) copy_int_heterogeneous, /* DT_UNSIGNED_INT */ - (conversion_fct_t) copy_long_heterogeneous, /* DT_LONG */ - (conversion_fct_t) copy_long_heterogeneous, /* DT_UNSIGNED_LONG */ - (conversion_fct_t) copy_long_long_heterogeneous, /* DT_LONG_LONG_INT */ - (conversion_fct_t) copy_long_long_heterogeneous, /* DT_UNSIGNED_LONG_LONG */ - (conversion_fct_t) copy_float_heterogeneous, /* DT_FLOAT */ - (conversion_fct_t) copy_double_heterogeneous, /* DT_DOUBLE */ - (conversion_fct_t) copy_long_double_heterogeneous, /* DT_LONG_DOUBLE */ - NULL, /* DT_PACKED */ - (conversion_fct_t) copy_wchar_heterogeneous, /* DT_WCHAR */ - (conversion_fct_t) copy_cxx_bool_heterogeneous, /* DT_CXX_BOOL */ - (conversion_fct_t) copy_fortran_logical_heterogeneous, /* DT_LOGIC */ - (conversion_fct_t) copy_int_heterogeneous, /* DT_INTEGER */ - (conversion_fct_t) copy_float_heterogeneous, /* DT_REAL */ - (conversion_fct_t) copy_double_heterogeneous, /* DT_DBLPREC */ - (conversion_fct_t) copy_complex_float_heterogeneous, /* DT_COMPLEX_FLOAT */ - (conversion_fct_t) copy_complex_double_heterogeneous, /* DT_COMPLEX_DOUBLE */ - (conversion_fct_t) copy_complex_long_double_heterogeneous,/* DT_COMPLEX_LONG_DOUBLE */ - (conversion_fct_t) copy_2int_heterogeneous, /* DT_2INT */ - (conversion_fct_t) copy_2int_heterogeneous, /* DT_2INTEGER */ - (conversion_fct_t) copy_2float_heterogeneous, /* DT_2REAL */ - (conversion_fct_t) copy_2double_heterogeneous, /* DT_2DBLPREC */ - (conversion_fct_t) copy_2complex_float_heterogeneous, /* DT_2COMPLEX */ - (conversion_fct_t) copy_2complex_double_heterogeneous, /* DT_2DOUBLE_COMPLEX */ - (conversion_fct_t) copy_float_int_heterogeneous, /* DT_FLOAT_INT */ - (conversion_fct_t) copy_double_int_heterogeneous, /* DT_DOUBLE_INT */ - (conversion_fct_t) copy_long_double_int_heterogeneous, /* DT_LONG_DOUBLE_INT */ - (conversion_fct_t) copy_long_int_heterogeneous, /* DT_LONG_INT */ - NULL, /* DT_SHORT_INT */ - NULL, /* DT_UNAVAILABLE */ -}; diff --git a/ompi/datatype/datatype.h b/ompi/datatype/datatype.h deleted file mode 100644 index 1f6dd62adb..0000000000 --- a/ompi/datatype/datatype.h +++ /dev/null @@ -1,259 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2007 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * ompi_datatype_t interface for OMPI internal data type representation - * - * ompi_datatype_t is a class which represents contiguous or - * non-contiguous data together with constituent type-related - * information. - */ - -#ifndef DATATYPE_H_HAS_BEEN_INCLUDED -#define DATATYPE_H_HAS_BEEN_INCLUDED - -#include "ompi_config.h" -#include "opal/class/opal_object.h" -#include "opal/class/opal_pointer_array.h" -#include "mpi.h" - -BEGIN_C_DECLS - -struct opal_hash_table_t; - -extern struct opal_pointer_array_t ompi_datatype_f_to_c_table; - -/* if there are more basic datatypes than the number of bytes in the int type - * the bdt_used field of the data description struct should be changed to long. - */ -#define DT_MAX_PREDEFINED 0x2A - -/* flags for the datatypes. */ -#define DT_FLAG_DESTROYED 0x0001 /**< user destroyed but some other layers still have a reference */ -#define DT_FLAG_COMMITED 0x0002 /**< ready to be used for a send/recv operation */ -#define DT_FLAG_CONTIGUOUS 0x0004 /**< contiguous datatype */ -#define DT_FLAG_OVERLAP 0x0008 /**< datatype is unpropper for a recv operation */ -#define DT_FLAG_USER_LB 0x0010 /**< has a user defined LB */ -#define DT_FLAG_USER_UB 0x0020 /**< has a user defined UB */ -#define DT_FLAG_PREDEFINED 0x0040 /**< cannot be removed: initial and predefined datatypes */ -#define DT_FLAG_NO_GAPS 0x0080 /**< no gaps around the datatype */ -#define DT_FLAG_DATA 0x0100 /**< data or control structure */ -#define DT_FLAG_ONE_SIDED 0x0200 /**< datatype can be used for one sided operations */ -#define DT_FLAG_UNAVAILABLE 0x0400 /**< datatypes unavailable on the build (OS or compiler dependant) */ -#define DT_FLAG_VECTOR 0x0800 /**< valid only for loops. The loop contain only one element - **< without extent. It correspond to the vector type. */ -/* Keep trace of the type of the predefined datatypes */ -#define DT_FLAG_DATA_INT 0x1000 -#define DT_FLAG_DATA_FLOAT 0x2000 -#define DT_FLAG_DATA_COMPLEX 0x3000 -#define DT_FLAG_DATA_TYPE 0x3000 -/* In which language the datatype is intended for to be used */ -#define DT_FLAG_DATA_C 0x4000 -#define DT_FLAG_DATA_CPP 0x8000 -#define DT_FLAG_DATA_FORTRAN 0xC000 -#define DT_FLAG_DATA_LANGUAGE 0xC000 - -/* - * We should make the difference here between the predefined contiguous and non contiguous - * datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes. - */ -#define DT_FLAG_BASIC (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS | DT_FLAG_DATA | DT_FLAG_COMMITED) - -typedef union dt_elem_desc dt_elem_desc_t; - -/** - * The number of supported entries in the data-type definition and the - * associated type. - */ -#define MAX_DT_COMPONENT_COUNT UINT_MAX -typedef uint32_t opal_ddt_count_t; - -typedef struct dt_type_desc { - opal_ddt_count_t length; /* the maximum number of elements in the description array */ - opal_ddt_count_t used; /* the number of used elements in the description array */ - dt_elem_desc_t* desc; -} dt_type_desc_t; - -/* the data description. - */ -typedef struct ompi_datatype_t { - opal_object_t super; /**< basic superclass */ - uint16_t flags; /**< the flags */ - uint16_t id; /**< data id, normally the index in the data array. */ - size_t size; /**< total size in bytes of the memory used by the data if - the data is put on a contiguous buffer */ - ptrdiff_t true_lb; - ptrdiff_t true_ub; /**< the true ub of the data without user defined lb and ub */ - ptrdiff_t lb; /**< lower bound in memory */ - ptrdiff_t ub; /**< upper bound in memory */ - uint32_t align; /**< data should be aligned to */ - uint32_t nbElems; /**< total number of elements inside the datatype */ - uint64_t bdt_used; /**< which basic datatypes are used in the data description */ - - /* Attribute fields */ - struct opal_hash_table_t *d_keyhash; - int32_t d_f_to_c_index; - char name[MPI_MAX_OBJECT_NAME]; - dt_type_desc_t desc; /**< the data description */ - dt_type_desc_t opt_desc; /**< short description of the data used when conversion is useless - * or in the send case (without conversion) */ - void* args; /**< data description for the user */ - void* packed_description; /**< the packed description of the datatype */ - - /* basic elements count used to compute the size of the datatype for - * remote nodes */ - uint32_t btypes[DT_MAX_PREDEFINED]; -} ompi_datatype_t; - -OMPI_DECLSPEC OBJ_CLASS_DECLARATION( ompi_datatype_t ); - -/** - * Padded struct to maintain back compatibiltiy. - * See ompi/communicator/communicator.h comments with struct ompi_communicator_t - * for full explanation why we chose the following padding construct for predefines. - */ - -/* Using set constant for padding of the DATATYPE handles because the size of - * base structure is very close to being the same no matter the bitness. - */ -#define PREDEFINED_DATATYPE_PAD (512) - -struct ompi_predefined_datatype_t { - struct ompi_datatype_t dt; - char padding[PREDEFINED_DATATYPE_PAD - sizeof(ompi_datatype_t)]; -}; - -typedef struct ompi_predefined_datatype_t ompi_predefined_datatype_t; - - -int ompi_ddt_register_params(void); -OMPI_DECLSPEC int32_t ompi_ddt_init( void ); -OMPI_DECLSPEC int32_t ompi_ddt_finalize( void ); -ompi_datatype_t* ompi_ddt_create( int32_t expectedSize ); -OMPI_DECLSPEC int32_t ompi_ddt_commit( ompi_datatype_t** ); -OMPI_DECLSPEC int32_t ompi_ddt_destroy( ompi_datatype_t** ); -static inline int32_t ompi_ddt_is_committed( const ompi_datatype_t* type ) -{ return ((type->flags & DT_FLAG_COMMITED) == DT_FLAG_COMMITED); } -static inline int32_t ompi_ddt_is_overlapped( const ompi_datatype_t* type ) -{ return ((type->flags & DT_FLAG_OVERLAP) == DT_FLAG_OVERLAP); } -static inline int32_t ompi_ddt_is_acceptable_for_one_sided( const ompi_datatype_t* type __opal_attribute_unused__ ) -{ return true; } -static inline int32_t ompi_ddt_is_valid( const ompi_datatype_t* type ) -{ return !((type->flags & DT_FLAG_UNAVAILABLE) == DT_FLAG_UNAVAILABLE); } -static inline int32_t ompi_ddt_is_predefined( const ompi_datatype_t* type ) -{ return (type->flags & DT_FLAG_PREDEFINED); } - -OMPI_DECLSPEC void ompi_ddt_dump( const ompi_datatype_t* pData ); -/* data creation functions */ -OMPI_DECLSPEC int32_t ompi_ddt_duplicate( const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_ddt_create_contiguous( int count, const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_ddt_create_vector( int count, int bLength, int stride, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_ddt_create_hvector( int count, int bLength, MPI_Aint stride, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_ddt_create_indexed( int count, const int* pBlockLength, const int* pDisp, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_ddt_create_hindexed( int count, const int* pBlockLength, const MPI_Aint* pDisp, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_ddt_create_indexed_block( int count, int bLength, const int* pDisp, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_ddt_create_struct( int count, const int* pBlockLength, const MPI_Aint* pDisp, - ompi_datatype_t* const* pTypes, ompi_datatype_t** newType ); -OMPI_DECLSPEC int32_t ompi_ddt_create_resized( const ompi_datatype_t* oldType, MPI_Aint lb, MPI_Aint extent, ompi_datatype_t** newType ); - -OMPI_DECLSPEC int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, uint32_t count, - ptrdiff_t disp, ptrdiff_t extent ); - -static inline int32_t ompi_ddt_type_lb( const ompi_datatype_t* pData, ptrdiff_t* disp ) -{ *disp = pData->lb; return 0; } -static inline int32_t ompi_ddt_type_ub( const ompi_datatype_t* pData, ptrdiff_t* disp ) -{ *disp = pData->ub; return 0; } -static inline int32_t ompi_ddt_type_size ( const ompi_datatype_t* pData, size_t *size ) -{ *size = pData->size; return 0; } -static inline int32_t ompi_ddt_type_extent( const ompi_datatype_t* pData, ptrdiff_t* extent ) -{ *extent = pData->ub - pData->lb; return 0; } - -static inline int32_t ompi_ddt_get_extent( const ompi_datatype_t* pData, ptrdiff_t* lb, ptrdiff_t* extent) -{ *lb = pData->lb; *extent = pData->ub - pData->lb; return 0; } -static inline int32_t ompi_ddt_get_true_extent( const ompi_datatype_t* pData, ptrdiff_t* true_lb, ptrdiff_t* true_extent) -{ *true_lb = pData->true_lb; *true_extent = (pData->true_ub - pData->true_lb); return 0; } -/* - * This function return true (1) if the datatype representation depending on the count - * is contiguous in the memory. And false (0) otherwise. - */ -static inline int32_t ompi_ddt_is_contiguous_memory_layout( const ompi_datatype_t* datatype, int32_t count ) -{ - if( !(datatype->flags & DT_FLAG_CONTIGUOUS) ) return 0; - if( (count == 1) || (datatype->flags & DT_FLAG_NO_GAPS) ) return 1; - assert( (ptrdiff_t)datatype->size != (datatype->ub - datatype->lb) ); - return 0; -} - -OMPI_DECLSPEC int32_t ompi_ddt_get_element_count( const ompi_datatype_t* pData, size_t iSize ); -OMPI_DECLSPEC int32_t ompi_ddt_set_element_count( const ompi_datatype_t* pData, uint32_t count, size_t* length ); -OMPI_DECLSPEC int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* pData, int32_t count, - char* pDestBuf, char* pSrcBuf ); - -OMPI_DECLSPEC const ompi_datatype_t* ompi_ddt_match_size( int size, uint16_t datakind, uint16_t datalang ); - -/* - * - */ -OMPI_DECLSPEC int32_t ompi_ddt_sndrcv( void *sbuf, int32_t scount, const ompi_datatype_t* sdtype, void *rbuf, - int32_t rcount, const ompi_datatype_t* rdtype); - -/* - * - */ -OMPI_DECLSPEC int32_t ompi_ddt_get_args( const ompi_datatype_t* pData, int32_t which, - int32_t * ci, int32_t * i, - int32_t * ca, MPI_Aint* a, - int32_t * cd, ompi_datatype_t** d, int32_t * type); -OMPI_DECLSPEC int32_t ompi_ddt_set_args( ompi_datatype_t* pData, - int32_t ci, int32_t ** i, - int32_t ca, MPI_Aint* a, - int32_t cd, ompi_datatype_t** d,int32_t type); -OMPI_DECLSPEC int32_t ompi_ddt_copy_args( const ompi_datatype_t* source_data, - ompi_datatype_t* dest_data ); -OMPI_DECLSPEC int32_t ompi_ddt_release_args( ompi_datatype_t* pData ); - -/* - * - */ -OMPI_DECLSPEC size_t ompi_ddt_pack_description_length( const ompi_datatype_t* datatype ); - -/* - * - */ -OMPI_DECLSPEC int ompi_ddt_get_pack_description( ompi_datatype_t* datatype, - const void** packed_buffer ); - -/* - * - */ -struct ompi_proc_t; -OMPI_DECLSPEC ompi_datatype_t* -ompi_ddt_create_from_packed_description( void** packed_buffer, - struct ompi_proc_t* remote_processor ); - -END_C_DECLS -#endif /* DATATYPE_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/datatype/datatype_internal.h b/ompi/datatype/datatype_internal.h deleted file mode 100644 index 452d7a45c9..0000000000 --- a/ompi/datatype/datatype_internal.h +++ /dev/null @@ -1,305 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef DATATYPE_INTERNAL_H_HAS_BEEN_INCLUDED -#define DATATYPE_INTERNAL_H_HAS_BEEN_INCLUDED - -#include "ompi_config.h" - -#ifdef HAVE_STRING_H -#include -#endif /* HAVE_STRING_H */ -#include "opal/util/output.h" - -extern int ompi_ddt_dfd; - -#if defined(VERBOSE) -# define DDT_DUMP_STACK( PSTACK, STACK_POS, PDESC, NAME ) \ - ompi_ddt_dump_stack( (PSTACK), (STACK_POS), (PDESC), (NAME) ) -# if defined(ACCEPT_C99) -# define DUMP( ARGS... ) opal_output(ompi_ddt_dfd, __VA_ARGS__) -# else -# if defined(__GNUC__) && !defined(__STDC__) -# define DUMP(ARGS...) opal_output( ompi_ddt_dfd, ARGS) -# else -static inline void DUMP( char* fmt, ... ) -{ - va_list list; - - va_start( list, fmt ); - opal_output( ompi_ddt_dfd, fmt, list ); - va_end( list ); -} -# define DUMP printf -# endif /* __GNUC__ && !__STDC__ */ -# endif /* ACCEPT_C99 */ -#else -# define DDT_DUMP_STACK( PSTACK, STACK_POS, PDESC, NAME ) -# if defined(ACCEPT_C99) -# define DUMP(ARGS...) -# else -# if defined(__GNUC__) && !defined(__STDC__) -# define DUMP(ARGS...) -# else - static inline void DUMP( char* fmt __opal_attribute_unused__, ...) { -#if defined(__PGI) - /* Some compilers complain if we have ... and no - corresponding va_start() */ - va_list arglist; - va_start(arglist, fmt); - va_end(arglist); -#endif - } -# endif /* __GNUC__ && !__STDC__ */ -# endif /* ACCEPT_C99 */ -#endif /* VERBOSE */ - -/* There 3 types of predefined data types. - * - the basic one composed by just one basic datatype which are - * definitively contiguous - * - the derived ones where the same basic type is used multiple times. - * They should be most of the time contiguous. - * - and finally the derived one where multiple basic types are used. - * Depending on the architecture they can be contiguous or not. - * - * At this level we do not care from which language the datatype came from - * (C, C++ or FORTRAN), we only focus on their internal representation in - * the host memory. - */ -#define DT_LOOP 0x00 -#define DT_END_LOOP 0x01 -#define DT_LB 0x02 -#define DT_UB 0x03 -#define DT_CHAR 0x04 -#define DT_CHARACTER 0x05 -#define DT_UNSIGNED_CHAR 0x06 -#define DT_SIGNED_CHAR 0x07 -#define DT_BYTE 0x08 -#define DT_SHORT 0x09 -#define DT_UNSIGNED_SHORT 0x0A -#define DT_INT 0x0B -#define DT_UNSIGNED_INT 0x0C -#define DT_LONG 0x0D -#define DT_UNSIGNED_LONG 0x0E -#define DT_LONG_LONG_INT 0x0F -#define DT_UNSIGNED_LONG_LONG 0x10 -#define DT_FLOAT 0x11 -#define DT_DOUBLE 0x12 -#define DT_LONG_DOUBLE 0x13 -#define DT_PACKED 0x14 -#define DT_WCHAR 0x15 -#define DT_CXX_BOOL 0x16 -#define DT_LOGIC 0x17 -#define DT_INTEGER 0x18 -#define DT_REAL 0x19 -#define DT_DBLPREC 0x1A -/* - * This is not a datatype. It contain the number of basic datatypes. - */ -#define DT_MAX_BASIC 0x1B -/* - * Derived datatypes supposely contiguous - */ -#define DT_COMPLEX_FLOAT 0x1B -#define DT_COMPLEX_DOUBLE 0x1C -#define DT_COMPLEX_LONG_DOUBLE 0x1D -#define DT_2INT 0x1E -#define DT_2INTEGER 0x1F -#define DT_2REAL 0x20 -#define DT_2DBLPREC 0x21 -#define DT_2COMPLEX 0x22 -#define DT_2DOUBLE_COMPLEX 0x23 -/* - * Derived datatypes which will definitively be non contiguous on some architectures. - */ -#define DT_FLOAT_INT 0x24 -#define DT_DOUBLE_INT 0x25 -#define DT_LONG_DOUBLE_INT 0x26 -#define DT_LONG_INT 0x27 -#define DT_SHORT_INT 0x28 -#define DT_UNAVAILABLE 0x29 -/* If the number of basic datatype should change update - * DT_MAX_PREDEFINED in datatype.h - */ -#if DT_MAX_PREDEFINED <= DT_UNAVAILABLE -#error DT_MAX_PREDEFINED should be updated to the next value after the DT_UNAVAILABLE define -#endif /* safe check for max predefined datatypes. */ - -#define DT_INCREASE_STACK 8 - -BEGIN_C_DECLS - -struct ddt_elem_id_description { - uint16_t flags; /**< flags for the record */ - uint16_t type; /**< the basic data type id */ -}; -typedef struct ddt_elem_id_description ddt_elem_id_description; - -/* the basic element. A data description is composed - * by a set of basic elements. - */ -struct ddt_elem_desc { - ddt_elem_id_description common; /**< basic data description and flags */ - uint32_t count; /**< number of blocks */ - uint32_t blocklen; /**< number of elements on each block */ - ptrdiff_t extent; /**< extent of each block (in bytes) */ - ptrdiff_t disp; /**< displacement of the first block */ -}; -typedef struct ddt_elem_desc ddt_elem_desc_t; - -struct ddt_loop_desc { - ddt_elem_id_description common; /**< basic data description and flags */ - uint32_t loops; /**< number of elements */ - uint32_t items; /**< number of items in the loop */ - size_t unused; /**< not used right now */ - ptrdiff_t extent; /**< extent of the whole loop */ -}; -typedef struct ddt_loop_desc ddt_loop_desc_t; - -struct ddt_endloop_desc { - ddt_elem_id_description common; /**< basic data description and flags */ - uint32_t items; /**< number of elements */ - uint32_t unused; /**< not used right now */ - size_t size; /**< real size of the data in the loop */ - ptrdiff_t first_elem_disp; /**< the displacement of the first block in the loop */ -}; -typedef struct ddt_endloop_desc ddt_endloop_desc_t; - -union dt_elem_desc { - ddt_elem_desc_t elem; - ddt_loop_desc_t loop; - ddt_endloop_desc_t end_loop; -}; - -#define CREATE_LOOP_START( _place, _count, _items, _extent, _flags ) \ - do { \ - (_place)->loop.common.type = DT_LOOP; \ - (_place)->loop.common.flags = (_flags) & ~DT_FLAG_DATA; \ - (_place)->loop.loops = (_count); \ - (_place)->loop.items = (_items); \ - (_place)->loop.extent = (_extent); \ - (_place)->loop.unused = -1; \ - } while(0) - -#define CREATE_LOOP_END( _place, _items, _first_item_disp, _size, _flags ) \ - do { \ - (_place)->end_loop.common.type = DT_END_LOOP; \ - (_place)->end_loop.common.flags = (_flags) & ~DT_FLAG_DATA; \ - (_place)->end_loop.items = (_items); \ - (_place)->end_loop.first_elem_disp = (_first_item_disp); \ - (_place)->end_loop.size = (_size); /* the size inside the loop */ \ - (_place)->end_loop.unused = -1; \ - } while(0) - -#define CREATE_ELEM( _place, _type, _flags, _count, _disp, _extent ) \ - do { \ - (_place)->elem.common.flags = (_flags) | DT_FLAG_DATA_C | DT_FLAG_DATA; \ - (_place)->elem.common.type = (_type); \ - (_place)->elem.count = (_count); \ - (_place)->elem.disp = (_disp); \ - (_place)->elem.extent = (_extent); \ - (_place)->elem.blocklen = 1; \ - } while(0) - -typedef struct { - float r; - float i; -} ompi_complex_float_t; - -typedef struct { - double r; - double i; -} ompi_complex_double_t; - -typedef struct { - long double r; - long double i; -} ompi_complex_long_double_t; - -extern const ompi_datatype_t* ompi_ddt_basicDatatypes[DT_MAX_PREDEFINED]; - -#define BASIC_DDT_FROM_ELEM( ELEM ) (ompi_ddt_basicDatatypes[(ELEM).elem.common.type]) - -int32_t ompi_ddt_default_convertors_init( void ); -int32_t ompi_ddt_default_convertors_fini( void ); - -#define SAVE_STACK( PSTACK, INDEX, TYPE, COUNT, DISP) \ -do { \ - (PSTACK)->index = (INDEX); \ - (PSTACK)->type = (TYPE); \ - (PSTACK)->count = (COUNT); \ - (PSTACK)->disp = (DISP); \ -} while(0) - -#define PUSH_STACK( PSTACK, STACK_POS, INDEX, TYPE, COUNT, DISP) \ -do { \ - dt_stack_t* pTempStack = (PSTACK) + 1; \ - SAVE_STACK( pTempStack, (INDEX), (TYPE), (COUNT), (DISP) ); \ - (STACK_POS)++; \ - (PSTACK) = pTempStack; \ -} while(0) - -#if OPAL_ENABLE_DEBUG -OMPI_DECLSPEC int ompi_ddt_safeguard_pointer_debug_breakpoint( const void* actual_ptr, int length, - const void* initial_ptr, - const ompi_datatype_t* pData, - int count ); -#define OMPI_DDT_SAFEGUARD_POINTER( ACTPTR, LENGTH, INITPTR, PDATA, COUNT ) \ - { \ - unsigned char *__lower_bound = (INITPTR), *__upper_bound; \ - assert( ((LENGTH) != 0) && ((COUNT) != 0) ); \ - __lower_bound += (PDATA)->true_lb; \ - __upper_bound = (INITPTR) + (PDATA)->true_ub + \ - ((PDATA)->ub - (PDATA)->lb) * ((COUNT) - 1); \ - if( ((ACTPTR) < __lower_bound) || ((ACTPTR) >= __upper_bound) ) { \ - ompi_ddt_safeguard_pointer_debug_breakpoint( (ACTPTR), (LENGTH), (INITPTR), (PDATA), (COUNT) ); \ - opal_output( 0, "%s:%d\n\tPointer %p size %lu is outside [%p,%p] for\n\tbase ptr %p count %d and data \n", \ - __FILE__, __LINE__, (ACTPTR), (unsigned long)(LENGTH), __lower_bound, __upper_bound, \ - (INITPTR), (COUNT) ); \ - ompi_ddt_dump( (PDATA) ); \ - } \ - } - -#else -#define OMPI_DDT_SAFEGUARD_POINTER( ACTPTR, LENGTH, INITPTR, PDATA, COUNT ) -#endif /* OPAL_ENABLE_DEBUG */ - -static inline int GET_FIRST_NON_LOOP( const dt_elem_desc_t* _pElem ) -{ - int element_index = 0; - - /* We dont have to check for the end as we always put an END_LOOP - * at the end of all datatype descriptions. - */ - while( _pElem->elem.common.type == DT_LOOP ) { - ++_pElem; element_index++; - } - return element_index; -} - -#define UPDATE_INTERNAL_COUNTERS( DESCRIPTION, POSITION, ELEMENT, COUNTER ) \ - do { \ - (ELEMENT) = &((DESCRIPTION)[(POSITION)]); \ - (COUNTER) = (ELEMENT)->elem.count; \ - } while (0) - -OMPI_DECLSPEC int32_t ompi_ddt_print_args( const ompi_datatype_t* pData ); - -END_C_DECLS -#endif /* DATATYPE_INTERNAL_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/datatype/dt_create.c b/ompi/datatype/dt_create.c deleted file mode 100644 index 0074229b4c..0000000000 --- a/ompi/datatype/dt_create.c +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2007 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" -#include "limits.h" -#include "ompi/attribute/attribute.h" -#include "opal/class/opal_pointer_array.h" -#include "opal/prefetch.h" - -static void __get_free_dt_struct( ompi_datatype_t* pData ) -{ - int i; - - pData->size = 0; - pData->id = 0; - pData->nbElems = 0; - pData->bdt_used = 0; - for( i = 0; i < DT_MAX_PREDEFINED; i++ ) - pData->btypes[i] = 0; - pData->btypes[DT_LOOP] = 0; - - pData->opt_desc.desc = NULL; - pData->opt_desc.length = 0; - pData->opt_desc.used = 0; - pData->args = NULL; - pData->align = 1; - pData->flags = DT_FLAG_CONTIGUOUS; - pData->true_lb = LONG_MAX; - pData->true_ub = LONG_MIN; - pData->lb = LONG_MAX; - pData->ub = LONG_MIN; - pData->d_f_to_c_index = opal_pointer_array_add(&ompi_datatype_f_to_c_table, pData); - pData->d_keyhash = NULL; - pData->name[0] = '\0'; - pData->packed_description = NULL; -} - -static void __destroy_ddt_struct( ompi_datatype_t* datatype ) -{ - if( datatype->desc.desc != NULL ) { - free( datatype->desc.desc ); - datatype->desc.length = 0; - datatype->desc.used = 0; - } - if( datatype->opt_desc.desc != NULL ) { - if( datatype->opt_desc.desc != datatype->desc.desc ) - free( datatype->opt_desc.desc ); - datatype->opt_desc.length = 0; - datatype->opt_desc.used = 0; - datatype->opt_desc.desc = NULL; - } - /** - * As the default description and the optimized description can point to the - * same memory location we should keep the default location pointer until we - * know what we should do with the optimized description. - */ - datatype->desc.desc = NULL; - - if( NULL != datatype->args ) { - ompi_ddt_release_args( datatype ); - datatype->args = NULL; - } - if( NULL != datatype->packed_description ) { - free( datatype->packed_description ); - datatype->packed_description = NULL; - } - if( NULL != opal_pointer_array_get_item(&ompi_datatype_f_to_c_table, datatype->d_f_to_c_index) ){ - opal_pointer_array_set_item( &ompi_datatype_f_to_c_table, datatype->d_f_to_c_index, NULL ); - } - /* any pending attributes ? */ - if (NULL != datatype->d_keyhash) { - ompi_attr_delete_all( TYPE_ATTR, datatype, datatype->d_keyhash ); - OBJ_RELEASE( datatype->d_keyhash ); - } - /* make sure the name is set to empty */ - datatype->name[0] = '\0'; -} - -OBJ_CLASS_INSTANCE(ompi_datatype_t, opal_object_t, __get_free_dt_struct, __destroy_ddt_struct ); - -ompi_datatype_t* ompi_ddt_create( int32_t expectedSize ) -{ - ompi_datatype_t* datatype = (ompi_datatype_t*)OBJ_NEW(ompi_datatype_t); - - if( expectedSize == -1 ) expectedSize = DT_INCREASE_STACK; - datatype->desc.length = expectedSize + 1; /* one for the fake elem at the end */ - datatype->desc.used = 0; - datatype->desc.desc = (dt_elem_desc_t*)calloc(datatype->desc.length, sizeof(dt_elem_desc_t)); - memset( datatype->name, 0, MPI_MAX_OBJECT_NAME ); - return datatype; -} - -int32_t ompi_ddt_create_resized( const ompi_datatype_t* oldType, MPI_Aint lb, MPI_Aint extent, ompi_datatype_t** newType ) -{ - int ret = ompi_ddt_duplicate( oldType, newType ); - if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { - return ret; - } - (*newType)->lb = lb; - (*newType)->ub = lb + extent; - - (*newType)->flags &= ~DT_FLAG_NO_GAPS; - if( (extent == (ptrdiff_t)oldType->size) && (oldType->flags & DT_FLAG_CONTIGUOUS) ) { - (*newType)->flags |= DT_FLAG_NO_GAPS; - } - return OMPI_SUCCESS; -} diff --git a/ompi/datatype/dt_create_dup.c b/ompi/datatype/dt_create_dup.c deleted file mode 100644 index 1907172ec4..0000000000 --- a/ompi/datatype/dt_create_dup.c +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/constants.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" - -/* - * As the new type has the same commit state as the old one, I have to copy the fake - * DT_END_LOOP from the description (both normal and optimized). - */ -int32_t ompi_ddt_duplicate( const ompi_datatype_t* oldType, ompi_datatype_t** newType ) -{ - int32_t desc_length = oldType->desc.used + 1; /* +1 because of the fake DT_END_LOOP entry */ - ompi_datatype_t* pdt = ompi_ddt_create( desc_length ); - dt_elem_desc_t* temp = pdt->desc.desc; /* temporary copy of the desc pointer */ - int32_t old_index = pdt->d_f_to_c_index; - - memcpy( pdt, oldType, sizeof(ompi_datatype_t) ); - pdt->super.obj_reference_count = 1; - pdt->desc.desc = temp; - pdt->flags &= (~DT_FLAG_PREDEFINED); - /* ompi_ddt_create() creates a new f_to_c index that was saved - before we did the memcpy, above */ - pdt->d_f_to_c_index = old_index; - /* Set the keyhash to NULL -- copying attributes is *only* done at - the top level (specifically, MPI_TYPE_DUP). */ - pdt->d_keyhash = NULL; - - /** - * Allow duplication of MPI_UB and MPI_LB. - */ - if( 0 != oldType->desc.used ) { - memcpy( pdt->desc.desc, oldType->desc.desc, sizeof(dt_elem_desc_t) * desc_length ); - /* TODO: if the data was commited update the opt_desc field */ - if( 0 != oldType->opt_desc.used ) { - desc_length = pdt->opt_desc.used + 1; - pdt->opt_desc.desc = (dt_elem_desc_t*)malloc( desc_length * sizeof(dt_elem_desc_t) ); - /* - * Yes, the pdt->opt_desc.length is just the opt_desc.used of the old Type. - */ - pdt->opt_desc.length = oldType->opt_desc.used; - pdt->opt_desc.used = oldType->opt_desc.used; - memcpy( pdt->opt_desc.desc, oldType->opt_desc.desc, desc_length * sizeof(dt_elem_desc_t) ); - } - } - pdt->id = oldType->id; /* preserve the default id. This allow us to - * copy predefined types. */ - pdt->args = NULL; - *newType = pdt; - return OMPI_SUCCESS; -} - -int32_t ompi_ddt_create_contiguous( int count, const ompi_datatype_t* oldType, - ompi_datatype_t** newType ) -{ - ompi_datatype_t* pdt; - - if( 0 == count ) { - pdt = ompi_ddt_create( 0 ); - ompi_ddt_add( pdt, &ompi_mpi_datatype_null.dt, 0, 0, 0 ); - } else { - pdt = ompi_ddt_create( oldType->desc.used + 2 ); - ompi_ddt_add( pdt, oldType, count, 0, (oldType->ub - oldType->lb) ); - } - *newType = pdt; - return OMPI_SUCCESS; -} diff --git a/ompi/datatype/dt_create_indexed.c b/ompi/datatype/dt_create_indexed.c deleted file mode 100644 index b67e6116bd..0000000000 --- a/ompi/datatype/dt_create_indexed.c +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/constants.h" -#include "ompi/datatype/datatype.h" - -/* We try to merge together data that are contiguous */ -int32_t ompi_ddt_create_indexed( int count, const int* pBlockLength, const int* pDisp, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ) -{ - ompi_datatype_t* pdt; - int i, dLength, endat, disp; - ptrdiff_t extent = oldType->ub - oldType->lb; - - if( 0 == count ) { - *newType = ompi_ddt_create( 0 ); - ompi_ddt_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); - return OMPI_SUCCESS; - } - - disp = pDisp[0]; - dLength = pBlockLength[0]; - endat = disp + dLength; - if( 1 >= count ) { - pdt = ompi_ddt_create( oldType->desc.used + 2 ); - /* multiply by count to make it zero if count is zero */ - ompi_ddt_add( pdt, oldType, count * dLength, disp * extent, extent ); - } else { - pdt = ompi_ddt_create( count * (2 + oldType->desc.used) ); - for( i = 1; i < count; i++ ) { - if( endat == pDisp[i] ) { - /* contiguous with the previsious */ - dLength += pBlockLength[i]; - endat += pBlockLength[i]; - } else { - ompi_ddt_add( pdt, oldType, dLength, disp * extent, extent ); - disp = pDisp[i]; - dLength = pBlockLength[i]; - endat = disp + pBlockLength[i]; - } - } - ompi_ddt_add( pdt, oldType, dLength, disp * extent, extent ); - } - - *newType = pdt; - return OMPI_SUCCESS; -} - -int32_t ompi_ddt_create_hindexed( int count, const int* pBlockLength, const MPI_Aint* pDisp, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ) -{ - ompi_datatype_t* pdt; - int i, dLength; - ptrdiff_t extent = oldType->ub - oldType->lb; - ptrdiff_t disp, endat; - - if( 0 == count ) { - *newType = ompi_ddt_create( 0 ); - ompi_ddt_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); - return OMPI_SUCCESS; - } - - pdt = ompi_ddt_create( count * (2 + oldType->desc.used) ); - disp = pDisp[0]; - dLength = pBlockLength[0]; - endat = disp + dLength * extent; - if( 1 >= count ) { - pdt = ompi_ddt_create( oldType->desc.used + 2 ); - /* multiply by count to make it zero if count is zero */ - ompi_ddt_add( pdt, oldType, count * dLength, disp, extent ); - } else { - for( i = 1; i < count; i++ ) { - if( endat == pDisp[i] ) { - /* contiguous with the previsious */ - dLength += pBlockLength[i]; - endat += pBlockLength[i] * extent; - } else { - ompi_ddt_add( pdt, oldType, dLength, disp, extent ); - disp = pDisp[i]; - dLength = pBlockLength[i]; - endat = disp + pBlockLength[i] * extent; - } - } - ompi_ddt_add( pdt, oldType, dLength, disp, extent ); - } - *newType = pdt; - return OMPI_SUCCESS; -} - -int32_t ompi_ddt_create_indexed_block( int count, int bLength, const int* pDisp, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ) -{ - ompi_datatype_t* pdt; - int i, dLength, endat, disp; - ptrdiff_t extent = oldType->ub - oldType->lb; - - if( (count == 0) || (bLength == 0) ) { - *newType = ompi_ddt_create(1); - if( 0 == count ) - ompi_ddt_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0 ); - else - ompi_ddt_add( *newType, oldType, 0, pDisp[0] * extent, extent ); - return OMPI_SUCCESS; - } - pdt = ompi_ddt_create( count * (2 + oldType->desc.used) ); - disp = pDisp[0]; - dLength = bLength; - endat = disp + dLength; - for( i = 1; i < count; i++ ) { - if( endat == pDisp[i] ) { - /* contiguous with the previsious */ - dLength += bLength; - endat += bLength; - } else { - ompi_ddt_add( pdt, oldType, dLength, disp * extent, extent ); - disp = pDisp[i]; - dLength = bLength; - endat = disp + bLength; - } - } - ompi_ddt_add( pdt, oldType, dLength, disp * extent, extent ); - - *newType = pdt; - return OMPI_SUCCESS; -} diff --git a/ompi/datatype/dt_create_vector.c b/ompi/datatype/dt_create_vector.c deleted file mode 100644 index 5af0525598..0000000000 --- a/ompi/datatype/dt_create_vector.c +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. - - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/constants.h" -#include "ompi/datatype/datatype.h" - -/* Open questions ... - * - how to improuve the handling of these vectors (creating a temporary datatype - * can be ONLY a initial solution. - * - */ - -int32_t ompi_ddt_create_vector( int count, int bLength, int stride, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ) -{ - ptrdiff_t extent = oldType->ub - oldType->lb; - ompi_datatype_t *pTempData, *pData; - - if( 0 == count ) { - *newType = ompi_ddt_create( 0 ); - ompi_ddt_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); - return OMPI_SUCCESS; - } - - pData = ompi_ddt_create( oldType->desc.used + 2 ); - if( (bLength == stride) || (1 >= count) ) { /* the elements are contiguous */ - ompi_ddt_add( pData, oldType, count * bLength, 0, extent ); - } else { - if( 1 == bLength ) { - ompi_ddt_add( pData, oldType, count, 0, extent * stride ); - } else { - ompi_ddt_add( pData, oldType, bLength, 0, extent ); - pTempData = pData; - pData = ompi_ddt_create( oldType->desc.used + 2 + 2 ); - ompi_ddt_add( pData, pTempData, count, 0, extent * stride ); - OBJ_RELEASE( pTempData ); - } - } - *newType = pData; - return OMPI_SUCCESS; -} - -int32_t ompi_ddt_create_hvector( int count, int bLength, MPI_Aint stride, - const ompi_datatype_t* oldType, ompi_datatype_t** newType ) -{ - ptrdiff_t extent = oldType->ub - oldType->lb; - ompi_datatype_t *pTempData, *pData; - - if( 0 == count ) { - *newType = ompi_ddt_create( 0 ); - ompi_ddt_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); - return OMPI_SUCCESS; - } - - pTempData = ompi_ddt_create( oldType->desc.used + 2 ); - if( ((extent * bLength) == stride) || (1 >= count) ) { /* contiguous */ - pData = pTempData; - ompi_ddt_add( pData, oldType, count * bLength, 0, extent ); - } else { - if( 1 == bLength ) { - pData = pTempData; - ompi_ddt_add( pData, oldType, count, 0, stride ); - } else { - ompi_ddt_add( pTempData, oldType, bLength, 0, extent ); - pData = ompi_ddt_create( oldType->desc.used + 2 + 2 ); - ompi_ddt_add( pData, pTempData, count, 0, stride ); - OBJ_RELEASE( pTempData ); - } - } - *newType = pData; - return OMPI_SUCCESS; -} diff --git a/ompi/datatype/dt_module.c b/ompi/datatype/dt_module.c deleted file mode 100644 index 0b5a92450b..0000000000 --- a/ompi/datatype/dt_module.c +++ /dev/null @@ -1,1007 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" -#include "ompi/datatype/convertor_internal.h" -#include - -#if OPAL_ENABLE_DEBUG -#include "opal/mca/base/mca_base_param.h" -int ompi_unpack_debug = 0; -int ompi_pack_debug = 0; -int ompi_copy_debug = 0; -int ompi_position_debug = 0; -#endif /* OPAL_ENABLE_DEBUG */ - -extern size_t ompi_datatype_memcpy_block_size; - -/* by default the debuging is turned off */ -int ompi_ddt_dfd = -1; - -/* other fields starting after bdt_used (index of DT_LOOP should be ONE) */ -#define ZERO_DDT_ARRAY { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0 } -#define EMPTY_DATA(NAME) NULL, 0, "MPI_" # NAME, {0, 0, NULL}, {0, 0, NULL}, NULL, NULL, ZERO_DDT_ARRAY -#define BASEOBJ_DATA OPAL_OBJ_STATIC_INIT(ompi_datatype_t) - -/* Using this macro implies that at this point not all informations needed - * to fill up the datatype are known. We fill them with zeros and then later - * when the datatype engine will be initialized we complete with the - * correct information. This macro should be used for all composed types. - */ -#define INIT_BASIC_TYPE( TYPE, NAME ) \ - { BASEOBJ_DATA, DT_FLAG_PREDEFINED, TYPE, 0/*size*/, \ - 0/*true_lb*/, 0/*true_ub*/, 0/*lb*/, 0/*ub*/, 0 /* align */, 1, \ - (((uint64_t)1)<<(TYPE)), EMPTY_DATA(NAME) } - -#define INIT_BASIC_DATA( TYPE, ALIGN, NAME, FLAGS ) \ - { BASEOBJ_DATA, DT_FLAG_BASIC | (FLAGS), DT_##NAME, sizeof(TYPE), 0, \ - sizeof(TYPE), 0, sizeof(TYPE), (ALIGN), \ - 1, (((uint64_t)1)<<(DT_##NAME)), EMPTY_DATA(NAME) } - -#define INIT_BASIC_DATA_WITH_NAME( TYPE, ALIGN, INTERNAL_NAME, NAME, FLAGS ) \ - { BASEOBJ_DATA, DT_FLAG_BASIC | (FLAGS),DT_##INTERNAL_NAME, sizeof(TYPE), \ - 0, sizeof(TYPE), 0, sizeof(TYPE), (ALIGN), \ - 1, (((uint64_t)1)<<(DT_##INTERNAL_NAME)), EMPTY_DATA(NAME) } - -#define INIT_UNAVAILABLE_DATA( NAME ) \ - { BASEOBJ_DATA, DT_FLAG_UNAVAILABLE | DT_FLAG_PREDEFINED, DT_UNAVAILABLE, 0,\ - 0, 0, 0, 0, 0, 1, 0, EMPTY_DATA( "UNAVAILABLE_" # NAME ) } - -/* The upper bound and the true UB are set to the size of the datatype. - * If it's not the case then they should be modified in the initialization - * function. - */ -#if OMPI_WANT_F77_BINDINGS -#define INIT_BASIC_FORTRAN_TYPE( TYPE, NAME, SIZE, ALIGN, FLAGS ) \ - { BASEOBJ_DATA, DT_FLAG_BASIC | DT_FLAG_DATA_FORTRAN | (FLAGS), \ - (TYPE), SIZE, 0/*true_lb*/, SIZE/*true_ub*/, 0/*lb*/, SIZE/*ub*/, \ - (ALIGN), 1, (((uint64_t)1)<<(TYPE)), EMPTY_DATA(NAME) } -#else -#define INIT_BASIC_FORTRAN_TYPE( TYPE, NAME, SIZE, ALIGN, FLAGS ) \ - INIT_BASIC_TYPE( TYPE, NAME ) -#endif /* OMPI_WANT_F77_BINDINGS */ - -/** - * This is the number of predefined datatypes. It is different than the MAX_PREDEFINED - * as it include all the optional datatypes (such as MPI_INTEGER?, MPI_REAL?). - */ -int32_t ompi_ddt_number_of_predefined_data = 0; - -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_datatype_null = { - { BASEOBJ_DATA, DT_FLAG_PREDEFINED, 0, 0, 0, 0, - 0, 0, 0, 1, ((long long)0), EMPTY_DATA(DATATYPE_NULL) }}; - -OMPI_DECLSPEC ompi_datatype_t ompi_mpi_loop = INIT_BASIC_TYPE( DT_LOOP, LOOP ); -OMPI_DECLSPEC ompi_datatype_t ompi_mpi_end_loop = INIT_BASIC_TYPE( DT_END_LOOP, END_LOOP ); -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_ub = { INIT_BASIC_TYPE( DT_UB, UB) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_lb = { INIT_BASIC_TYPE( DT_LB, LB) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_char = { INIT_BASIC_DATA( char, OPAL_ALIGNMENT_CHAR, CHAR, DT_FLAG_DATA_C ) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_character = { INIT_BASIC_DATA( char, OPAL_ALIGNMENT_CHAR, CHARACTER, DT_FLAG_DATA_FORTRAN) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_unsigned_char = { INIT_BASIC_DATA( unsigned char, OPAL_ALIGNMENT_CHAR, UNSIGNED_CHAR, DT_FLAG_DATA_C) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_signed_char = { INIT_BASIC_DATA( signed char, OPAL_ALIGNMENT_CHAR, SIGNED_CHAR, DT_FLAG_DATA_C | DT_FLAG_DATA_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_byte = { INIT_BASIC_DATA( unsigned char, OPAL_ALIGNMENT_CHAR, BYTE, DT_FLAG_DATA_C | DT_FLAG_DATA_INT ) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_short = { INIT_BASIC_DATA( short, OPAL_ALIGNMENT_SHORT, SHORT, DT_FLAG_DATA_C | DT_FLAG_DATA_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_unsigned_short = { INIT_BASIC_DATA( unsigned short, OPAL_ALIGNMENT_SHORT, UNSIGNED_SHORT, DT_FLAG_DATA_C | DT_FLAG_DATA_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_int = { INIT_BASIC_DATA( int, OPAL_ALIGNMENT_INT, INT, DT_FLAG_DATA_C | DT_FLAG_DATA_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_unsigned = { INIT_BASIC_DATA_WITH_NAME( unsigned int, OPAL_ALIGNMENT_INT, UNSIGNED_INT, UNSIGNED, DT_FLAG_DATA_C | DT_FLAG_DATA_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_long = { INIT_BASIC_DATA( long, OPAL_ALIGNMENT_LONG, LONG, DT_FLAG_DATA_C | DT_FLAG_DATA_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_unsigned_long = { INIT_BASIC_DATA( unsigned long, OPAL_ALIGNMENT_LONG, UNSIGNED_LONG, DT_FLAG_DATA_C | DT_FLAG_DATA_INT) }; -#if HAVE_LONG_LONG -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_long_long_int = { INIT_BASIC_DATA_WITH_NAME( long long, OPAL_ALIGNMENT_LONG_LONG, LONG_LONG_INT, LONG_LONG, DT_FLAG_DATA_C | DT_FLAG_DATA_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_unsigned_long_long = { INIT_BASIC_DATA( unsigned long long, OPAL_ALIGNMENT_LONG_LONG, UNSIGNED_LONG_LONG, DT_FLAG_DATA_C | DT_FLAG_DATA_INT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_long_long_int = { INIT_UNAVAILABLE_DATA( LONG_LONG_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_unsigned_long_long = { INIT_UNAVAILABLE_DATA( UNIGNED_LONG_LONG) }; -#endif /* HAVE_LONG_LONG */ -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_float = { INIT_BASIC_DATA( float, OMPI_ALIGNMENT_FLOAT, FLOAT, DT_FLAG_DATA_C | DT_FLAG_DATA_FLOAT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_double = { INIT_BASIC_DATA( double, OMPI_ALIGNMENT_DOUBLE, DOUBLE, DT_FLAG_DATA_C | DT_FLAG_DATA_FLOAT) }; -#if HAVE_LONG_DOUBLE -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_long_double = { INIT_BASIC_DATA( long double, OPAL_ALIGNMENT_LONG_DOUBLE, LONG_DOUBLE, DT_FLAG_DATA_C | DT_FLAG_DATA_FLOAT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_long_double = { INIT_UNAVAILABLE_DATA( LONG_DOUBLE) }; -#endif /* HAVE_LONG_DOUBLE */ -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_packed = { INIT_BASIC_DATA( char, OPAL_ALIGNMENT_CHAR, PACKED, 0) }; -#if OMPI_ALIGNMENT_WCHAR != 0 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_wchar = { INIT_BASIC_DATA( wchar_t, OMPI_ALIGNMENT_WCHAR, WCHAR, DT_FLAG_DATA_C) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_wchar = { INIT_UNAVAILABLE_DATA( WCHAR) }; -#endif /* OMPI_ALIGNMENT_WCHAR */ - -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_cxx_bool = { INIT_BASIC_DATA( bool, OMPI_ALIGNMENT_CXX_BOOL, CXX_BOOL, DT_FLAG_DATA_CPP) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_logic = { INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGIC, OMPI_SIZEOF_FORTRAN_LOGICAL, OMPI_ALIGNMENT_FORTRAN_LOGICAL, 0) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer = { INIT_BASIC_FORTRAN_TYPE( DT_INTEGER, INTEGER, OMPI_SIZEOF_FORTRAN_INTEGER, OMPI_ALIGNMENT_FORTRAN_INTEGER, DT_FLAG_DATA_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_real = { INIT_BASIC_FORTRAN_TYPE( DT_REAL, REAL, OMPI_SIZEOF_FORTRAN_REAL, OMPI_ALIGNMENT_FORTRAN_REAL, DT_FLAG_DATA_FLOAT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_dblprec = { INIT_BASIC_FORTRAN_TYPE( DT_DBLPREC, DOUBLE_PRECISION, OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION, OMPI_ALIGNMENT_FORTRAN_DOUBLE_PRECISION, DT_FLAG_DATA_FLOAT) }; - -#if HAVE_LONG_DOUBLE -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_ldblcplex = { INIT_BASIC_DATA( ompi_complex_long_double_t, OPAL_ALIGNMENT_LONG_DOUBLE, COMPLEX_LONG_DOUBLE, DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_COMPLEX) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_ldblcplex = { INIT_UNAVAILABLE_DATA( COMPLEX_LONG_DOUBLE) }; -#endif /* HAVE_LONG_DOUBLE */ - -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_cplex = { INIT_BASIC_DATA( ompi_complex_float_t, OMPI_ALIGNMENT_FLOAT, COMPLEX_FLOAT, DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_COMPLEX) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_dblcplex = { INIT_BASIC_DATA( ompi_complex_double_t, OMPI_ALIGNMENT_DOUBLE, COMPLEX_DOUBLE, DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_COMPLEX) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_float_int = { INIT_BASIC_TYPE( DT_FLOAT_INT, FLOAT_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_double_int = { INIT_BASIC_TYPE( DT_DOUBLE_INT, DOUBLE_INT) }; -#if HAVE_LONG_DOUBLE -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_longdbl_int = { INIT_BASIC_TYPE( DT_LONG_DOUBLE_INT, LONG_DOUBLE_INT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_longdbl_int = { INIT_UNAVAILABLE_DATA( LONG_DOUBLE_INT) }; -#endif /* HAVE_LONG_DOUBLE */ -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_long_int = { INIT_BASIC_TYPE( DT_LONG_INT, LONG_INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_short_int = { INIT_BASIC_TYPE( DT_SHORT_INT, SHORT_INT) }; - -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_2int = { INIT_BASIC_TYPE( DT_2INT, 2INT) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_2real = { INIT_BASIC_TYPE( DT_2REAL, 2REAL) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_2dblprec = { INIT_BASIC_TYPE( DT_2DBLPREC, 2DBLPREC) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_2integer = { INIT_BASIC_TYPE( DT_2INTEGER, 2INTEGER) }; - -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_cxx_cplex = { INIT_BASIC_DATA( ompi_complex_float_t, OMPI_ALIGNMENT_FLOAT, COMPLEX_FLOAT, DT_FLAG_DATA_CPP | DT_FLAG_DATA_COMPLEX) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_cxx_dblcplex = { INIT_BASIC_DATA( ompi_complex_double_t, OMPI_ALIGNMENT_DOUBLE, COMPLEX_DOUBLE, DT_FLAG_DATA_CPP | DT_FLAG_DATA_COMPLEX) }; -#if HAVE_LONG_DOUBLE -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_cxx_ldblcplex = { INIT_BASIC_DATA( ompi_complex_long_double_t, OPAL_ALIGNMENT_LONG_DOUBLE, COMPLEX_LONG_DOUBLE, DT_FLAG_DATA_CPP | DT_FLAG_DATA_COMPLEX) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_cxx_ldblcplex = { INIT_UNAVAILABLE_DATA( COMPLEX_LONG_DOUBLE) }; -#endif /* HAVE_LONG_DOUBLE */ - -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_2cplex = { INIT_BASIC_TYPE( DT_2COMPLEX, 2COMPLEX) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_2dblcplex = { INIT_BASIC_TYPE( DT_2DOUBLE_COMPLEX, 2DOUBLE_COMPLEX) }; -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_unavailable = { INIT_UNAVAILABLE_DATA( UNAVAILABLE) }; - -#if OMPI_HAVE_FORTRAN_LOGICAL1 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_logical1 = { INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGICAL1, OMPI_SIZEOF_FORTRAN_LOGICAL1, OMPI_ALIGNMENT_FORTRAN_LOGICAL1, 0) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_logical1 = { INIT_UNAVAILABLE_DATA( LOGICAL1) }; -#endif /* OMPI_HAVE_FORTRAN_LOGICAL1 */ -#if OMPI_HAVE_FORTRAN_LOGICAL2 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_logical2 = { INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGICAL2, OMPI_SIZEOF_FORTRAN_LOGICAL2, OMPI_ALIGNMENT_FORTRAN_LOGICAL2, 0) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_logical2 = { INIT_UNAVAILABLE_DATA( LOGICAL2) }; -#endif /* OMPI_HAVE_FORTRAN_LOGICAL2 */ -#if OMPI_HAVE_FORTRAN_LOGICAL4 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_logical4 = { INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGICAL4, OMPI_SIZEOF_FORTRAN_LOGICAL4, OMPI_ALIGNMENT_FORTRAN_LOGICAL4, 0) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_logical4 = { INIT_UNAVAILABLE_DATA( LOGICAL4) }; -#endif /* OMPI_HAVE_FORTRAN_LOGICAL4 */ -#if OMPI_HAVE_FORTRAN_LOGICAL8 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_logical8 = { INIT_BASIC_FORTRAN_TYPE( DT_LOGIC, LOGICAL8, OMPI_SIZEOF_FORTRAN_LOGICAL8, OMPI_ALIGNMENT_FORTRAN_LOGICAL8, 0) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_logical8 = { INIT_UNAVAILABLE_DATA( LOGICAL8) }; -#endif /* OMPI_HAVE_FORTRAN_LOGICAL8 */ - -#if OMPI_HAVE_FORTRAN_REAL2 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_real2 = { INIT_BASIC_FORTRAN_TYPE( DT_FLOAT, REAL2, OMPI_SIZEOF_FORTRAN_REAL2, OMPI_ALIGNMENT_FORTRAN_REAL2, DT_FLAG_DATA_FLOAT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_real2 = { INIT_UNAVAILABLE_DATA( REAL2) }; -#endif -#if OMPI_HAVE_FORTRAN_REAL4 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_real4 = { INIT_BASIC_FORTRAN_TYPE( DT_FLOAT, REAL4, OMPI_SIZEOF_FORTRAN_REAL4, OMPI_ALIGNMENT_FORTRAN_REAL4, DT_FLAG_DATA_FLOAT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_real4 = { INIT_UNAVAILABLE_DATA( REAL4) }; -#endif -#if OMPI_HAVE_FORTRAN_REAL8 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_real8 = { INIT_BASIC_FORTRAN_TYPE( DT_DOUBLE, REAL8, OMPI_SIZEOF_FORTRAN_REAL8, OMPI_ALIGNMENT_FORTRAN_REAL8, DT_FLAG_DATA_FLOAT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_real8 = { INIT_UNAVAILABLE_DATA( REAL8) }; -#endif -#if OMPI_HAVE_FORTRAN_REAL16 && OMPI_REAL16_MATCHES_C -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_real16 = { INIT_BASIC_FORTRAN_TYPE( DT_LONG_DOUBLE, REAL16, OMPI_SIZEOF_FORTRAN_REAL16, OMPI_ALIGNMENT_FORTRAN_REAL16, DT_FLAG_DATA_FLOAT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_real16 = { INIT_UNAVAILABLE_DATA( REAL16) }; -#endif - -#if OMPI_HAVE_FORTRAN_INTEGER1 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer1 = { INIT_BASIC_FORTRAN_TYPE( DT_CHAR, INTEGER1, OMPI_SIZEOF_FORTRAN_INTEGER1, OMPI_ALIGNMENT_FORTRAN_INTEGER1, DT_FLAG_DATA_INT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer1 = { INIT_UNAVAILABLE_DATA( INTEGER1) }; -#endif -#if OMPI_HAVE_FORTRAN_INTEGER2 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer2 = { INIT_BASIC_FORTRAN_TYPE( DT_SHORT, INTEGER2, OMPI_SIZEOF_FORTRAN_INTEGER2, OMPI_ALIGNMENT_FORTRAN_INTEGER2, DT_FLAG_DATA_INT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer2 = { INIT_UNAVAILABLE_DATA( INTEGER2) }; -#endif -#if OMPI_HAVE_FORTRAN_INTEGER4 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer4 = { INIT_BASIC_FORTRAN_TYPE( DT_INT, INTEGER4, OMPI_SIZEOF_FORTRAN_INTEGER4, OMPI_ALIGNMENT_FORTRAN_INTEGER4, DT_FLAG_DATA_INT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer4 = { INIT_UNAVAILABLE_DATA( INTEGER4) }; -#endif -#if OMPI_HAVE_FORTRAN_INTEGER8 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer8 = { INIT_BASIC_FORTRAN_TYPE( DT_LONG_LONG_INT, INTEGER8, OMPI_SIZEOF_FORTRAN_INTEGER8, OMPI_ALIGNMENT_FORTRAN_INTEGER8, DT_FLAG_DATA_INT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer8 = { INIT_UNAVAILABLE_DATA( INTEGER8) }; -#endif -#if OMPI_HAVE_FORTRAN_INTEGER16 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer16 = { INIT_BASIC_FORTRAN_TYPE( DT_LONG_LONG_INT, INTEGER16, OMPI_SIZEOF_FORTRAN_INTEGER16, OMPI_ALIGNMENT_FORTRAN_INTEGER16, DT_FLAG_DATA_INT) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_integer16 = { INIT_UNAVAILABLE_DATA( INTEGER16) }; -#endif - -#if OMPI_HAVE_FORTRAN_REAL4 && OMPI_HAVE_FORTRAN_COMPLEX8 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_complex8 = { INIT_BASIC_FORTRAN_TYPE( DT_COMPLEX_FLOAT, COMPLEX8, OMPI_SIZEOF_FORTRAN_COMPLEX, OMPI_ALIGNMENT_FORTRAN_REAL, DT_FLAG_DATA_COMPLEX) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_complex8 = { INIT_UNAVAILABLE_DATA( COMPLEX8) }; -#endif -#if OMPI_HAVE_FORTRAN_REAL8 && OMPI_HAVE_FORTRAN_COMPLEX16 -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_complex16 = { INIT_BASIC_FORTRAN_TYPE( DT_COMPLEX_DOUBLE, COMPLEX16, OMPI_SIZEOF_FORTRAN_COMPLEX16, OMPI_ALIGNMENT_FORTRAN_COMPLEX16, DT_FLAG_DATA_COMPLEX) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_complex16 = { INIT_UNAVAILABLE_DATA( COMPLEX16) }; -#endif -#if OMPI_HAVE_FORTRAN_REAL16 && OMPI_HAVE_FORTRAN_COMPLEX32 && OMPI_REAL16_MATCHES_C -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_complex32 = { INIT_BASIC_FORTRAN_TYPE( DT_COMPLEX_LONG_DOUBLE, COMPLEX32, OMPI_SIZEOF_FORTRAN_COMPLEX32, OMPI_ALIGNMENT_FORTRAN_COMPLEX32, DT_FLAG_DATA_COMPLEX) }; -#else -OMPI_DECLSPEC ompi_predefined_datatype_t ompi_mpi_complex32 = { INIT_UNAVAILABLE_DATA( COMPLEX32) }; -#endif - -/* - * NOTE: The order of this array *MUST* match what is listed in - * datatype_internal.h - */ -const ompi_datatype_t* ompi_ddt_basicDatatypes[DT_MAX_PREDEFINED] = { - &ompi_mpi_loop, - &ompi_mpi_end_loop, - &ompi_mpi_lb.dt, - &ompi_mpi_ub.dt, - &ompi_mpi_char.dt, - &ompi_mpi_character.dt, - &ompi_mpi_unsigned_char.dt, - &ompi_mpi_signed_char.dt, - &ompi_mpi_byte.dt, - &ompi_mpi_short.dt, - &ompi_mpi_unsigned_short.dt, - &ompi_mpi_int.dt, - &ompi_mpi_unsigned.dt, - &ompi_mpi_long.dt, - &ompi_mpi_unsigned_long.dt, - &ompi_mpi_long_long_int.dt, - &ompi_mpi_unsigned_long_long.dt, - &ompi_mpi_float.dt, - &ompi_mpi_double.dt, - &ompi_mpi_long_double.dt, - &ompi_mpi_packed.dt, - &ompi_mpi_wchar.dt, - &ompi_mpi_cxx_bool.dt, - &ompi_mpi_logic.dt, - &ompi_mpi_integer.dt, - &ompi_mpi_real.dt, - &ompi_mpi_dblprec.dt, - &ompi_mpi_cplex.dt, - &ompi_mpi_dblcplex.dt, - &ompi_mpi_ldblcplex.dt, - &ompi_mpi_2int.dt, - &ompi_mpi_2integer.dt, - &ompi_mpi_2real.dt, - &ompi_mpi_2dblprec.dt, - &ompi_mpi_2cplex.dt, - &ompi_mpi_2dblcplex.dt, - &ompi_mpi_float_int.dt, - &ompi_mpi_double_int.dt, - &ompi_mpi_longdbl_int.dt, - &ompi_mpi_long_int.dt, - &ompi_mpi_short_int.dt, - &ompi_mpi_unavailable.dt -}; - -opal_pointer_array_t ompi_datatype_f_to_c_table; - -size_t ompi_ddt_local_sizes[DT_MAX_PREDEFINED]; - -#define COPY_DATA_DESC( PDST, PSRC ) \ - do { \ - (PDST)->flags = (PSRC)->flags; \ - (PDST)->id = (PSRC)->id; \ - (PDST)->size = (PSRC)->size; \ - (PDST)->true_lb = (PSRC)->true_lb; \ - (PDST)->true_ub = (PSRC)->true_ub; \ - (PDST)->lb = (PSRC)->lb; \ - (PDST)->ub = (PSRC)->ub; \ - (PDST)->align = (PSRC)->align; \ - (PDST)->nbElems = (PSRC)->nbElems; \ - (PDST)->bdt_used = (PSRC)->bdt_used; \ - if( NULL != (PDST)->desc.desc ) \ - free( (PDST)->desc.desc ); \ - /* Don't re-assing the (PDST)->desc because we need the pointer \ - * value in the following if statement. In the case of \ - * predefined datatypes both descriptors point to the same \ - * memory and if we free the memory twice bad things happen.*/ \ - if( (NULL != (PDST)->opt_desc.desc) && \ - ((PDST)->opt_desc.desc != (PDST)->desc.desc) ) \ - free( (PDST)->opt_desc.desc ); \ - (PDST)->desc = (PSRC)->desc; \ - (PDST)->opt_desc = (PSRC)->opt_desc; \ - (PDST)->packed_description = (PSRC)->packed_description; \ - (PSRC)->packed_description = NULL; \ - memcpy( (PDST)->btypes, (PSRC)->btypes, \ - DT_MAX_PREDEFINED * sizeof(uint32_t) ); \ - } while(0) - -#define DECLARE_MPI2_COMPOSED_STRUCT_DDT( PDATA, MPIDDT, MPIDDTNAME, type1, type2, MPIType1, MPIType2, FLAGS) \ - do { \ - struct { type1 v1; type2 v2; } s[2]; \ - ompi_datatype_t* types[2]; \ - ompi_datatype_t* ptype; \ - int bLength[2] = {1, 1}; \ - MPI_Aint base, displ[2]; \ - \ - types[0] = (ompi_datatype_t*)ompi_ddt_basicDatatypes[MPIType1]; \ - types[1] = (ompi_datatype_t*)ompi_ddt_basicDatatypes[MPIType2]; \ - base = (ptrdiff_t)(&(s[0])); \ - displ[0] = (ptrdiff_t)(&(s[0].v1)); \ - displ[0] -= base; \ - displ[1] = (ptrdiff_t)(&(s[0].v2)); \ - displ[1] -= base; \ - \ - ompi_ddt_create_struct( 2, bLength, displ, types, &ptype ); \ - displ[0] = (ptrdiff_t)(&(s[1])); \ - displ[0] -= base; \ - if( displ[0] != (displ[1] + (ptrdiff_t)sizeof(type2)) ) \ - ptype->ub = displ[0]; /* force a new extent for the datatype */ \ - ptype->flags |= (FLAGS); \ - ptype->id = MPIDDT; \ - ompi_ddt_commit( &ptype ); \ - COPY_DATA_DESC( PDATA, ptype ); \ - (PDATA)->flags |= DT_FLAG_PREDEFINED; \ - ptype->desc.desc = NULL; \ - ptype->opt_desc.desc = NULL; \ - OBJ_RELEASE( ptype ); \ - strncpy( (PDATA)->name, MPIDDTNAME, MPI_MAX_OBJECT_NAME ); \ - } while(0) - -#define DECLARE_MPI2_COMPOSED_BLOCK_DDT( PDATA, MPIDDT, MPIDDTNAME, MPIType, FLAGS ) \ - do { \ - ompi_datatype_t *ptype; \ - ompi_ddt_create_contiguous( 2, ompi_ddt_basicDatatypes[MPIType], &ptype ); \ - ptype->flags |= (FLAGS); \ - ptype->id = (MPIDDT); \ - ompi_ddt_commit( &ptype ); \ - COPY_DATA_DESC( (PDATA), ptype ); \ - (PDATA)->flags |= DT_FLAG_PREDEFINED; \ - ptype->desc.desc = NULL; \ - ptype->opt_desc.desc = NULL; \ - OBJ_RELEASE( ptype ); \ - strncpy( (PDATA)->name, (MPIDDTNAME), MPI_MAX_OBJECT_NAME ); \ - } while(0) - -#define DECLARE_MPI_SYNONYM_DDT( PDATA, MPIDDTNAME, PORIGDDT) \ - do { \ - /* just memcpy as it's easier this way */ \ - memcpy( (PDATA), (PORIGDDT), sizeof(ompi_datatype_t) ); \ - strncpy( (PDATA)->name, MPIDDTNAME, MPI_MAX_OBJECT_NAME ); \ - /* forget the language flag */ \ - (PDATA)->flags &= ~DT_FLAG_DATA_LANGUAGE; \ - } while(0) - -int ompi_ddt_register_params(void) -{ -#if OPAL_ENABLE_DEBUG - mca_base_param_reg_int_name( "mpi", "ddt_unpack_debug", - "Whether to output debugging information in the ddt unpack functions (nonzero = enabled)", - false, false, - ompi_unpack_debug, &ompi_unpack_debug ); - mca_base_param_reg_int_name( "mpi", "ddt_pack_debug", - "Whether to output debugging information in the ddt pack functions (nonzero = enabled)", - false, false, - ompi_pack_debug, &ompi_pack_debug ); - mca_base_param_reg_int_name( "mpi", "ddt_position_debug", - "Non zero lead to output generated by the datatype position functions", - false, false, 0, &ompi_position_debug ); - - mca_base_param_reg_int_name( "mpi", "ddt_copy_debug", - "Whether to output debugging information in the ddt copy functions (nonzero = enabled)", - false, false, - ompi_copy_debug, &ompi_copy_debug ); -#endif /* OPAL_ENABLE_DEBUG */ - return OMPI_SUCCESS; -} - -int32_t ompi_ddt_init( void ) -{ - int32_t i; - - for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) { - ompi_datatype_t* datatype = (ompi_datatype_t*)ompi_ddt_basicDatatypes[i]; - - datatype->desc.desc = (dt_elem_desc_t*)malloc(2*sizeof(dt_elem_desc_t)); - datatype->desc.desc[0].elem.common.flags = DT_FLAG_PREDEFINED | DT_FLAG_DATA | DT_FLAG_CONTIGUOUS; - datatype->desc.desc[0].elem.common.type = i; - datatype->desc.desc[0].elem.count = 1; - datatype->desc.desc[0].elem.disp = 0; - datatype->desc.desc[0].elem.extent = datatype->size; - - datatype->desc.desc[1].end_loop.common.flags = 0; - datatype->desc.desc[1].end_loop.common.type = DT_END_LOOP; - datatype->desc.desc[1].end_loop.items = 1; - datatype->desc.desc[1].end_loop.first_elem_disp = datatype->desc.desc[0].elem.disp; - datatype->desc.desc[1].end_loop.size = datatype->size; - - datatype->desc.length = 1; - datatype->desc.used = 1; - /* By default the optimized description is the same as the default - * description for predefined datatypes. - */ - datatype->opt_desc = datatype->desc; - - datatype->btypes[i] = 1; - /* Check if the data contain gaps */ - if( (datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size ) { - datatype->desc.desc[0].elem.common.flags |= DT_FLAG_NO_GAPS; - } - } - - /* Create the f2c translation table */ - OBJ_CONSTRUCT(&ompi_datatype_f_to_c_table, opal_pointer_array_t); - if( OPAL_SUCCESS != opal_pointer_array_init(&ompi_datatype_f_to_c_table, - 0, OMPI_FORTRAN_HANDLE_MAX, 64)) { - return OMPI_ERROR; - } - /* All temporary datatypes created on the following statement will get registered - * on the f2c table. But as they get destroyed they will (hopefully) get unregistered - * so later when we start registering the real datatypes they will get the index - * in mpif.h - */ - - /* the 2 complex datatypes (float and double) */ - DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_cplex.dt, DT_COMPLEX_FLOAT, "MPI_COMPLEX", - float, float, DT_FLOAT, DT_FLOAT, - DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT ); - DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_dblcplex.dt, DT_COMPLEX_DOUBLE, "MPI_DOUBLE_COMPLEX", - double, double, DT_DOUBLE, DT_DOUBLE, - DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT ); -#if HAVE_LONG_DOUBLE - DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_ldblcplex.dt, DT_COMPLEX_LONG_DOUBLE, "MPI_LONG_DOUBLE_COMPLEX", - long double, long double, DT_LONG_DOUBLE, DT_LONG_DOUBLE, - DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT ); -#endif /* HAVE_LONG_DOUBLE */ - - /* Now the predefined MPI2 datatypes (they should last forever!) */ - DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_float_int.dt, DT_FLOAT_INT, "MPI_FLOAT_INT", - float, int, DT_FLOAT, DT_INT, DT_FLAG_DATA_C ); - DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_double_int.dt, DT_DOUBLE_INT, "MPI_DOUBLE_INT", - double, int, DT_DOUBLE, DT_INT, DT_FLAG_DATA_C ); - DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_long_int.dt, DT_LONG_INT, "MPI_LONG_INT", - long, int, DT_LONG, DT_INT, DT_FLAG_DATA_C | DT_FLAG_DATA_INT ); - DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_short_int.dt, DT_SHORT_INT, "MPI_SHORT_INT", - short, int, DT_SHORT, DT_INT, DT_FLAG_DATA_C | DT_FLAG_DATA_INT ); - DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_longdbl_int.dt, DT_LONG_DOUBLE_INT, "MPI_LONG_DOUBLE_INT", - long double, int, DT_LONG_DOUBLE, DT_INT, DT_FLAG_DATA_C ); - - DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2int.dt, DT_2INT, "MPI_2INT", DT_INT, - DT_FLAG_DATA_C | DT_FLAG_DATA_INT ); - DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2integer.dt, DT_2INTEGER, "MPI_2INTEGER", DT_INT, - DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_INT); - DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2real.dt, DT_2REAL, "MPI_2REAL", DT_FLOAT, - DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT ); - DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2dblprec.dt, DT_2DBLPREC, "MPI_2DOUBLE_PRECISION", DT_DOUBLE, - DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT ); - DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2cplex.dt, DT_2COMPLEX, "MPI_2COMPLEX", DT_COMPLEX_FLOAT, - DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT); - DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2dblcplex.dt, DT_2DOUBLE_COMPLEX, "MPI_2DOUBLE_COMPLEX", - DT_COMPLEX_DOUBLE, DT_FLAG_DATA_FORTRAN | DT_FLAG_DATA_FLOAT ); - - for( i = 0; i < DT_MAX_PREDEFINED; ++i ) { - ompi_ddt_local_sizes[i] = ompi_ddt_basicDatatypes[i]->size; - } - - /* Copy the desc pointer from the ub - datatype->lb) == (ptrdiff_t)datatype->size ) { - datatype->flags |= DT_FLAG_NO_GAPS; - } else { - datatype->flags &= ~DT_FLAG_NO_GAPS; - } - } - - ompi_ddt_default_convertors_init(); - return OMPI_SUCCESS; -} - -int32_t ompi_ddt_finalize( void ) -{ - int i; - - /* As the synonyms are just copies of the internal data we should not free them. - * Anyway they are over the limit of DT_MAX_PREDEFINED so they will never get freed. - */ - - /* As they are statically allocated they cannot be released. But we - * can call OBJ_DESTRUCT, just to free all internally allocated ressources. - */ - for( i = 0; i < DT_MAX_PREDEFINED; i++ ) { - OBJ_DESTRUCT( ompi_ddt_basicDatatypes[i] ); - } - - /* Get rid of the Fortran2C translation table */ - OBJ_DESTRUCT(&ompi_datatype_f_to_c_table); - -#if defined(VERBOSE) - if( ompi_ddt_dfd != -1 ) - opal_output_close( ompi_ddt_dfd ); - ompi_ddt_dfd = -1; -#endif /* VERBOSE */ - - /* release the local convertors (external32 and local) */ - ompi_ddt_default_convertors_fini(); - - /* clear all master convertors */ - ompi_convertor_destroy_masters(); - - return OMPI_SUCCESS; -} - -#if OPAL_ENABLE_DEBUG -/* - * Set a breakpoint to this function in your favorite debugger - * to make it stop on all pack and unpack errors. - */ -int ompi_ddt_safeguard_pointer_debug_breakpoint( const void* actual_ptr, int length, - const void* initial_ptr, - const ompi_datatype_t* pData, - int count ) -{ - return 0; -} -#endif /* OPAL_ENABLE_DEBUG */ - -/******************************************************** - * Data dumping functions - ********************************************************/ - -static int _dump_data_flags( unsigned short usflags, char* ptr, size_t length ) -{ - int index = 0; - - if( length < 22 ) return 0; - index = snprintf( ptr, 22, "-----------[---][---]" ); /* set everything to - */ - if( usflags & DT_FLAG_DESTROYED ) ptr[0] = 'd'; - if( usflags & DT_FLAG_COMMITED ) ptr[1] = 'c'; - if( usflags & DT_FLAG_CONTIGUOUS ) ptr[2] = 'C'; - if( usflags & DT_FLAG_OVERLAP ) ptr[3] = 'o'; - if( usflags & DT_FLAG_USER_LB ) ptr[4] = 'l'; - if( usflags & DT_FLAG_USER_UB ) ptr[5] = 'u'; - if( usflags & DT_FLAG_PREDEFINED ) ptr[6] = 'P'; - if( !(usflags & DT_FLAG_NO_GAPS) ) ptr[7] = 'G'; - if( usflags & DT_FLAG_DATA ) ptr[8] = 'D'; - if( (usflags & DT_FLAG_BASIC) == DT_FLAG_BASIC ) ptr[9] = 'B'; - /* Which kind of datatype is that */ - switch( usflags & DT_FLAG_DATA_LANGUAGE ) { - case DT_FLAG_DATA_C: - ptr[12] = ' '; ptr[13] = 'C'; ptr[14] = ' '; break; - case DT_FLAG_DATA_CPP: - ptr[12] = 'C'; ptr[13] = 'P'; ptr[14] = 'P'; break; - case DT_FLAG_DATA_FORTRAN: - ptr[12] = 'F'; ptr[13] = '7'; ptr[14] = '7'; break; - default: - if( usflags & DT_FLAG_PREDEFINED ) { - ptr[12] = 'E'; ptr[13] = 'R'; ptr[14] = 'R'; break; - } - } - switch( usflags & DT_FLAG_DATA_TYPE ) { - case DT_FLAG_DATA_INT: - ptr[17] = 'I'; ptr[18] = 'N'; ptr[19] = 'T'; break; - case DT_FLAG_DATA_FLOAT: - ptr[17] = 'F'; ptr[18] = 'L'; ptr[19] = 'T'; break; - case DT_FLAG_DATA_COMPLEX: - ptr[17] = 'C'; ptr[18] = 'P'; ptr[19] = 'L'; break; - default: - if( usflags & DT_FLAG_PREDEFINED ) { - ptr[17] = 'E'; ptr[18] = 'R'; ptr[19] = 'R'; break; - } - } - return index; -} - -static int __dump_data_desc( dt_elem_desc_t* pDesc, int nbElems, char* ptr, size_t length ) -{ - int i; - int32_t index = 0; - - for( i = 0; i < nbElems; i++ ) { - index += _dump_data_flags( pDesc->elem.common.flags, ptr + index, length ); - if( length <= (size_t)index ) break; - index += snprintf( ptr + index, length - index, "%15s ", ompi_ddt_basicDatatypes[pDesc->elem.common.type]->name ); - if( length <= (size_t)index ) break; - if( DT_LOOP == pDesc->elem.common.type ) - index += snprintf( ptr + index, length - index, "%d times the next %d elements extent %d\n", - (int)pDesc->loop.loops, (int)pDesc->loop.items, - (int)pDesc->loop.extent ); - else if( DT_END_LOOP == pDesc->elem.common.type ) - index += snprintf( ptr + index, length - index, "prev %d elements first elem displacement %ld size of data %d\n", - (int)pDesc->end_loop.items, (long)pDesc->end_loop.first_elem_disp, - (int)pDesc->end_loop.size ); - else - index += snprintf( ptr + index, length - index, "count %d disp 0x%lx (%ld) extent %d (size %ld)\n", - (int)pDesc->elem.count, (long)pDesc->elem.disp, (long)pDesc->elem.disp, - (int)pDesc->elem.extent, (long)(pDesc->elem.count * ompi_ddt_basicDatatypes[pDesc->elem.common.type]->size) ); - pDesc++; - - if( length <= (size_t)index ) break; - } - return index; -} - -static inline int __dt_contain_basic_datatypes( const ompi_datatype_t* pData, char* ptr, size_t length ) -{ - int i; - int32_t index = 0; - uint64_t mask = 1; - - if( pData->flags & DT_FLAG_USER_LB ) index += snprintf( ptr, length - index, "lb " ); - if( pData->flags & DT_FLAG_USER_UB ) index += snprintf( ptr + index, length - index, "ub " ); - for( i = 0; i < DT_MAX_PREDEFINED; i++ ) { - if( pData->bdt_used & mask ) - index += snprintf( ptr + index, length - index, "%s ", ompi_ddt_basicDatatypes[i]->name ); - mask <<= 1; - if( length <= (size_t)index ) break; - } - return index; -} - -void ompi_ddt_dump( const ompi_datatype_t* pData ) -{ - size_t length; - int index = 0; - char* buffer; - - length = pData->opt_desc.used + pData->desc.used; - length = length * 100 + 500; - buffer = (char*)malloc( length ); - index += snprintf( buffer, length - index, "Datatype %p[%s] size %ld align %d id %d length %d used %d\n" - "true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n" - "nbElems %d loops %d flags %X (", - (void*)pData, pData->name, (long)pData->size, (int)pData->align, pData->id, (int)pData->desc.length, (int)pData->desc.used, - (long)pData->true_lb, (long)pData->true_ub, (long)(pData->true_ub - pData->true_lb), - (long)pData->lb, (long)pData->ub, (long)(pData->ub - pData->lb), - (int)pData->nbElems, (int)pData->btypes[DT_LOOP], (int)pData->flags ); - /* dump the flags */ - if( pData->flags == DT_FLAG_PREDEFINED ) - index += snprintf( buffer + index, length - index, "predefined " ); - else { - if( pData->flags & DT_FLAG_DESTROYED ) index += snprintf( buffer + index, length - index, "destroyed " ); - if( pData->flags & DT_FLAG_COMMITED ) index += snprintf( buffer + index, length - index, "commited " ); - if( pData->flags & DT_FLAG_CONTIGUOUS) index += snprintf( buffer + index, length - index, "contiguous " ); - } - index += snprintf( buffer + index, length - index, ")" ); - index += _dump_data_flags( pData->flags, buffer + index, length - index ); - { - index += snprintf( buffer + index, length - index, "\n contain " ); - index += __dt_contain_basic_datatypes( pData, buffer + index, length - index ); - index += snprintf( buffer + index, length - index, "\n" ); - } - if( (pData->opt_desc.desc != pData->desc.desc) && (NULL != pData->opt_desc.desc) ) { - /* If the data is already committed print everything including the last - * fake DT_END_LOOP entry. - */ - index += __dump_data_desc( pData->desc.desc, pData->desc.used + 1, buffer + index, length - index ); - index += snprintf( buffer + index, length - index, "Optimized description \n" ); - index += __dump_data_desc( pData->opt_desc.desc, pData->opt_desc.used + 1, buffer + index, length - index ); - } else { - index += __dump_data_desc( pData->desc.desc, pData->desc.used, buffer + index, length - index ); - index += snprintf( buffer + index, length - index, "No optimized description\n" ); - } - buffer[index] = '\0'; /* make sure we end the string with 0 */ - opal_output( 0, "%s\n", buffer ); - - ompi_ddt_print_args( pData ); - - free(buffer); -} diff --git a/ompi/datatype/dt_sndrcv.c b/ompi/datatype/dt_sndrcv.c deleted file mode 100644 index 1b29c30d66..0000000000 --- a/ompi/datatype/dt_sndrcv.c +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" - -/* - * ompi_dtsndrcv - * - * Function: - copy MPI message from buffer into another - * - send/recv done if cannot optimize - * Accepts: - send buffer - * - send count - * - send datatype - * - receive buffer - * - receive count - * - receive datatype - * - tag - * - communicator - * Returns: - MPI_SUCCESS or error code - */ -int32_t ompi_ddt_sndrcv( void *sbuf, int32_t scount, const ompi_datatype_t* sdtype, - void *rbuf, int32_t rcount, const ompi_datatype_t* rdtype) -{ - ompi_convertor_t send_convertor, recv_convertor; - struct iovec iov; - int length, completed; - uint32_t iov_count; - size_t max_data; - - /* First check if we really have something to do */ - if (0 == rcount) { - return ((0 == scount) ? MPI_SUCCESS : MPI_ERR_TRUNCATE); - } - - /* If same datatypes used, just copy. */ - if (sdtype == rdtype) { - int32_t count = ( scount < rcount ? scount : rcount ); - ompi_ddt_copy_content_same_ddt(rdtype, count, (char*)rbuf, (char*)sbuf); - return ((scount > rcount) ? MPI_ERR_TRUNCATE : MPI_SUCCESS); - } - - /* If receive packed. */ - if (rdtype == MPI_PACKED) { - OBJ_CONSTRUCT( &send_convertor, ompi_convertor_t ); - ompi_convertor_copy_and_prepare_for_send( ompi_mpi_local_convertor, - sdtype, scount, sbuf, 0, - &send_convertor ); - - iov_count = 1; - iov.iov_base = (IOVBASE_TYPE*)rbuf; - iov.iov_len = scount * sdtype->size; - if( (int32_t)iov.iov_len > rcount ) iov.iov_len = rcount; - - ompi_convertor_pack( &send_convertor, &iov, &iov_count, &max_data ); - OBJ_DESTRUCT( &send_convertor ); - return ((max_data < (size_t)rcount) ? MPI_ERR_TRUNCATE : MPI_SUCCESS); - } - - /* If send packed. */ - if (sdtype == MPI_PACKED) { - OBJ_CONSTRUCT( &recv_convertor, ompi_convertor_t ); - ompi_convertor_copy_and_prepare_for_recv( ompi_mpi_local_convertor, - rdtype, rcount, rbuf, 0, - &recv_convertor ); - - iov_count = 1; - iov.iov_base = (IOVBASE_TYPE*)sbuf; - iov.iov_len = rcount * rdtype->size; - if( (int32_t)iov.iov_len > scount ) iov.iov_len = scount; - - ompi_convertor_unpack( &recv_convertor, &iov, &iov_count, &max_data ); - OBJ_DESTRUCT( &recv_convertor ); - return (((size_t)scount > max_data) ? MPI_ERR_TRUNCATE : MPI_SUCCESS); - } - - iov.iov_len = length = 64 * 1024; - iov.iov_base = (IOVBASE_TYPE*)malloc( length * sizeof(char) ); - - OBJ_CONSTRUCT( &send_convertor, ompi_convertor_t ); - ompi_convertor_copy_and_prepare_for_send( ompi_mpi_local_convertor, - sdtype, scount, sbuf, 0, - &send_convertor ); - OBJ_CONSTRUCT( &recv_convertor, ompi_convertor_t ); - ompi_convertor_copy_and_prepare_for_recv( ompi_mpi_local_convertor, - rdtype, rcount, rbuf, 0, - &recv_convertor ); - - completed = 0; - while( !completed ) { - iov.iov_len = length; - iov_count = 1; - max_data = length; - completed |= ompi_convertor_pack( &send_convertor, &iov, &iov_count, &max_data ); - completed |= ompi_convertor_unpack( &recv_convertor, &iov, &iov_count, &max_data ); - } - free( iov.iov_base ); - OBJ_DESTRUCT( &send_convertor ); - OBJ_DESTRUCT( &recv_convertor ); - - return ( (scount * sdtype->size) <= (rcount * rdtype->size) ? MPI_SUCCESS : MPI_ERR_TRUNCATE ); -} - diff --git a/ompi/datatype/ompi_convertor.h b/ompi/datatype/ompi_convertor.h new file mode 100644 index 0000000000..2d88f25b97 --- /dev/null +++ b/ompi/datatype/ompi_convertor.h @@ -0,0 +1,89 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef OMPI_CONVERTOR_H +#define OMPI_CONVERTOR_H + +#include "ompi_config.h" + +#include + +#include "opal/datatype/opal_convertor.h" +#include "ompi/datatype/ompi_datatype.h" + +/* + * XXX TODO To be deleted again. + * Very small interface to have code, which depends on ompi_convertor_prepare... interface + * to work, still... + * + * However, still any header #include "opal/datatype/opal_convertor.h" will need + * to be renamed to #include "ompi/datatype/ompi_convertor.h" + */ +#warning "This header file should only be included as a convenience. Please use the opal_convert.h header, functions and macros" + +#define ompi_convertor_t opal_convertor_t + +static inline int32_t ompi_convertor_prepare_for_send( opal_convertor_t* convertor, + const ompi_datatype_t* datatype, + int32_t count, + const void* pUserBuf) +{ + return opal_convertor_prepare_for_send( convertor, + &(datatype->super), + count, + pUserBuf); +} + +static inline int32_t ompi_convertor_copy_and_prepare_for_send( const opal_convertor_t* pSrcConv, + const ompi_datatype_t* datatype, + int32_t count, + const void* pUserBuf, + int32_t flags, + opal_convertor_t* convertor ) +{ + return opal_convertor_copy_and_prepare_for_send( pSrcConv, + &(datatype->super), + count, + pUserBuf, + flags, + convertor ); +} + + +static inline int32_t ompi_convertor_prepare_for_recv( opal_convertor_t* convertor, + const ompi_datatype_t* datatype, + int32_t count, + const void* pUserBuf ) +{ + return opal_convertor_prepare_for_recv( convertor, + &(datatype->super), + count, + pUserBuf ); +} + +static inline int32_t ompi_convertor_copy_and_prepare_for_recv( const opal_convertor_t* pSrcConv, + const ompi_datatype_t* datatype, + int32_t count, + const void* pUserBuf, + int32_t flags, + opal_convertor_t* convertor ) +{ + return opal_convertor_copy_and_prepare_for_recv( pSrcConv, + &(datatype->super), + count, + pUserBuf, + flags, + convertor ); +} + +#endif /* OMPI_CONVERTOR_H */ \ No newline at end of file diff --git a/ompi/datatype/ompi_datatype.h b/ompi/datatype/ompi_datatype.h new file mode 100644 index 0000000000..105c00fe28 --- /dev/null +++ b/ompi/datatype/ompi_datatype.h @@ -0,0 +1,354 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** + * ompi_datatype_t interface for OMPI internal data type representation + * + * ompi_datatype_t is a class which represents contiguous or + * non-contiguous data together with constituent type-related + * information. + */ + +#ifndef OMPI_DATATYPE_H_HAS_BEEN_INCLUDED +#define OMPI_DATATYPE_H_HAS_BEEN_INCLUDED + +#include "ompi_config.h" + +#include +#ifdef HAVE_STDINT_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "ompi/constants.h" +#include "opal/class/opal_pointer_array.h" +#include "opal/class/opal_hash_table.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype.h" +#include "mpi.h" + +BEGIN_C_DECLS + +/* These flags are on top of the flags in opal_datatype.h */ +/* Is the datatype predefined as MPI type (not necessarily as OPAL type, e.g. struct/block types) */ +#define OMPI_DATATYPE_FLAG_PREDEFINED 0x0200 +/* Is the datatype suitable for one sided operations */ +#define OMPI_DATATYPE_FLAG_ONE_SIDED 0x0400 +/* Keep trace of the type of the predefined datatypes */ +#define OMPI_DATATYPE_FLAG_DATA_INT 0x1000 +#define OMPI_DATATYPE_FLAG_DATA_FLOAT 0x2000 +#define OMPI_DATATYPE_FLAG_DATA_COMPLEX 0x3000 +#define OMPI_DATATYPE_FLAG_DATA_TYPE 0x3000 +/* In which language the datatype is intended for to be used */ +#define OMPI_DATATYPE_FLAG_DATA_C 0x4000 +#define OMPI_DATATYPE_FLAG_DATA_CPP 0x8000 +#define OMPI_DATATYPE_FLAG_DATA_FORTRAN 0xC000 +#define OMPI_DATATYPE_FLAG_DATA_LANGUAGE 0xC000 + +#define OMPI_DATATYPE_MAX_PREDEFINED 45 + +#if OMPI_DATATYPE_MAX_PREDEFINED > OPAL_DATATYPE_MAX_SUPPORTED +#error Need to increase the number of supported dataypes by OPAL (value OPAL_DATATYPE_MAX_SUPPORTED). +#endif + + +/* the data description. + */ +struct ompi_datatype_t { + opal_datatype_t super; /**< Base opal_datatype_t superclass */ + /* --- cacheline 5 boundary (320 bytes) was 32 bytes ago --- */ + + int32_t id; /**< OMPI-layers unique id of the type */ + int32_t d_f_to_c_index; /**< Fortran index for this datatype */ + struct opal_hash_table_t *d_keyhash; /**< Attribute fields */ + + void* args; /**< Data description for the user */ + void* packed_description; /**< Packed description of the datatype */ + /* --- cacheline 6 boundary (384 bytes) --- */ + char name[MPI_MAX_OBJECT_NAME];/**< Externally visible name */ + /* --- cacheline 7 boundary (448 bytes) --- */ + + /* size: 448, cachelines: 7, members: 7 */ +}; + +typedef struct ompi_datatype_t ompi_datatype_t; + +OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_datatype_t); + +/** + * Padded struct to maintain back compatibiltiy. + * See opal/communicator/communicator.h comments with struct opal_communicator_t + * for full explanation why we chose the following padding construct for predefines. + */ + +/* Using set constant for padding of the DATATYPE handles because the size of + * base structure is very close to being the same no matter the bitness. + */ +#define PREDEFINED_DATATYPE_PAD (512) + +struct ompi_predefined_datatype_t { + struct ompi_datatype_t dt; + char padding[PREDEFINED_DATATYPE_PAD - sizeof(opal_datatype_t)]; +}; + +typedef struct ompi_predefined_datatype_t ompi_predefined_datatype_t; + +/* + * The list of predefined datatypes is specified in ompi/include/mpi.h.in + */ + +/* Base convertor for all external32 operations */ +OMPI_DECLSPEC extern opal_convertor_t* ompi_mpi_external32_convertor; +OMPI_DECLSPEC extern opal_convertor_t* ompi_mpi_local_convertor; +extern struct opal_pointer_array_t ompi_datatype_f_to_c_table; + +OMPI_DECLSPEC int32_t ompi_datatype_init( void ); +OMPI_DECLSPEC int32_t ompi_datatype_finalize( void ); + +OMPI_DECLSPEC int32_t ompi_datatype_default_convertors_init( void ); +OMPI_DECLSPEC int32_t ompi_datatype_default_convertors_fini( void ); + +OMPI_DECLSPEC void ompi_datatype_dump (const ompi_datatype_t* pData); +OMPI_DECLSPEC ompi_datatype_t* ompi_datatype_create( int32_t expectedSize ); + +static inline int32_t +ompi_datatype_is_committed( const ompi_datatype_t* type ) +{ + return opal_datatype_is_committed(&type->super); +} + +static inline int32_t +ompi_datatype_is_overlapped( const ompi_datatype_t* type ) +{ + return opal_datatype_is_overlapped(&type->super); +} + +static inline int32_t +ompi_datatype_is_acceptable_for_one_sided( const ompi_datatype_t* type ) +{ + return (type->super.flags & OMPI_DATATYPE_FLAG_ONE_SIDED); +} + +static inline int32_t +ompi_datatype_is_valid( const ompi_datatype_t* type ) +{ + return opal_datatype_is_valid(&type->super); +} + +static inline int32_t +ompi_datatype_is_predefined( const ompi_datatype_t* type ) +{ + return (type->super.flags & OMPI_DATATYPE_FLAG_PREDEFINED); +} + +static inline int32_t +ompi_datatype_is_contiguous_memory_layout( const ompi_datatype_t* type, int32_t count ) +{ + return opal_datatype_is_contiguous_memory_layout(&type->super, count); +} + +static inline int32_t +ompi_datatype_commit( ompi_datatype_t ** type ) +{ + ompi_datatype_t * pData = *type; + + opal_datatype_commit ( &pData->super ); + + return OMPI_SUCCESS; +} + + +static inline int32_t +ompi_datatype_destroy( ompi_datatype_t** type) +{ + ompi_datatype_t* pData = *type; + + if( ompi_datatype_is_predefined(pData) && (pData->super.super.obj_reference_count <= 1) ) + return OMPI_ERROR; + + OBJ_RELEASE( pData ); + *type = NULL; + return OMPI_SUCCESS; +} + + +/* + * Datatype creation functions + */ +static inline int32_t +ompi_datatype_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, uint32_t count, + OPAL_PTRDIFF_TYPE disp, OPAL_PTRDIFF_TYPE extent ) +{ + return opal_datatype_add( &pdtBase->super, &pdtAdd->super, count, disp, extent ); +} + + +static inline int32_t +ompi_datatype_duplicate( const ompi_datatype_t* oldType, ompi_datatype_t** newType ) +{ + ompi_datatype_t * new_ompi_datatype = ompi_datatype_create( oldType->super.desc.used + 2 ); + + *newType = new_ompi_datatype; + if( NULL == new_ompi_datatype ) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + opal_datatype_clone ( &oldType->super, &new_ompi_datatype->super); + + /* Set the keyhash to NULL -- copying attributes is *only* done at + the top level (specifically, MPI_TYPE_DUP). */ + new_ompi_datatype->d_keyhash = NULL; + new_ompi_datatype->args = NULL; + strncpy (new_ompi_datatype->name, oldType->name, MPI_MAX_OBJECT_NAME); + + return OMPI_SUCCESS; +} + +OMPI_DECLSPEC int32_t ompi_datatype_create_contiguous( int count, const ompi_datatype_t* oldType, ompi_datatype_t** newType ); +OMPI_DECLSPEC int32_t ompi_datatype_create_vector( int count, int bLength, int stride, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ); +OMPI_DECLSPEC int32_t ompi_datatype_create_hvector( int count, int bLength, OPAL_PTRDIFF_TYPE stride, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ); +OMPI_DECLSPEC int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ); +OMPI_DECLSPEC int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ); +OMPI_DECLSPEC int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* pDisp, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ); +OMPI_DECLSPEC int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, + ompi_datatype_t* const* pTypes, ompi_datatype_t** newType ); +static inline int32_t +ompi_datatype_create_resized( const ompi_datatype_t* oldType, OPAL_PTRDIFF_TYPE lb, OPAL_PTRDIFF_TYPE extent, ompi_datatype_t** newType ) +{ + ompi_datatype_t * type; + ompi_datatype_duplicate( oldType, &type ); + if ( NULL == type) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + opal_datatype_resize ( &type->super, lb, extent ); + *newType = type; + return OMPI_SUCCESS; +} + +static inline int32_t +ompi_datatype_type_lb( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* disp ) +{ + return opal_datatype_type_lb(&type->super, disp); +} + +static inline int32_t +ompi_datatype_type_ub( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* disp ) +{ + return opal_datatype_type_ub( &type->super, disp); +} + +static inline int32_t +ompi_datatype_type_size ( const ompi_datatype_t* type, size_t *size ) +{ + return opal_datatype_type_size( &type->super, size); +} + +static inline int32_t +ompi_datatype_type_extent( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* extent ) +{ + return opal_datatype_type_extent( &type->super, extent); +} + +static inline int32_t +ompi_datatype_get_extent( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* lb, OPAL_PTRDIFF_TYPE* extent) +{ + return opal_datatype_get_extent( &type->super, lb, extent); +} + +static inline int32_t +ompi_datatype_get_true_extent( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* true_lb, OPAL_PTRDIFF_TYPE* true_extent) +{ + return opal_datatype_get_true_extent( &type->super, true_lb, true_extent); +} + +static inline int32_t +ompi_datatype_get_element_count( const ompi_datatype_t* type, size_t iSize ) +{ + return opal_datatype_get_element_count( &type->super, iSize ); +} + +static inline int32_t +ompi_datatype_set_element_count( const ompi_datatype_t* type, uint32_t count, size_t* length ) +{ + return opal_datatype_set_element_count( &type->super, count, length ); +} + +static inline int32_t +ompi_datatype_copy_content_same_ddt( const ompi_datatype_t* type, int32_t count, + char* pDestBuf, char* pSrcBuf ) +{ + return opal_datatype_copy_content_same_ddt( &type->super, count, pDestBuf, pSrcBuf ); +} + +OMPI_DECLSPEC const ompi_datatype_t* ompi_datatype_match_size( int size, uint16_t datakind, uint16_t datalang ); + +/* + * + */ +OMPI_DECLSPEC int32_t ompi_datatype_sndrcv( void *sbuf, int32_t scount, const ompi_datatype_t* sdtype, + void *rbuf, int32_t rcount, const ompi_datatype_t* rdtype); + +/* + * + */ +OMPI_DECLSPEC int32_t ompi_datatype_get_args( const ompi_datatype_t* pData, int32_t which, + int32_t * ci, int32_t * i, + int32_t * ca, OPAL_PTRDIFF_TYPE* a, + int32_t * cd, ompi_datatype_t** d, int32_t * type); +OMPI_DECLSPEC int32_t ompi_datatype_set_args( ompi_datatype_t* pData, + int32_t ci, int32_t ** i, + int32_t ca, OPAL_PTRDIFF_TYPE* a, + int32_t cd, ompi_datatype_t** d,int32_t type); +OMPI_DECLSPEC int32_t ompi_datatype_copy_args( const ompi_datatype_t* source_data, + ompi_datatype_t* dest_data ); +OMPI_DECLSPEC int32_t ompi_datatype_release_args( ompi_datatype_t* pData ); + +/* + * + */ +OMPI_DECLSPEC size_t ompi_datatype_pack_description_length( const ompi_datatype_t* datatype ); + +/* + * + */ +OMPI_DECLSPEC int ompi_datatype_get_pack_description( ompi_datatype_t* datatype, + const void** packed_buffer ); + +/* + * + */ +struct ompi_proc_t; +OMPI_DECLSPEC ompi_datatype_t* ompi_datatype_create_from_packed_description( void** packed_buffer, + struct ompi_proc_t* remote_processor ); + +OMPI_DECLSPEC int32_t ompi_datatype_print_args( const ompi_datatype_t* pData ); + +#if OPAL_ENABLE_DEBUG +/* + * Set a breakpoint to this function in your favorite debugger + * to make it stop on all pack and unpack errors. + */ +OMPI_DECLSPEC int ompi_datatype_safeguard_pointer_debug_breakpoint( const void* actual_ptr, int length, + const void* initial_ptr, + const ompi_datatype_t* pData, + int count ); +#endif /* OPAL_ENABLE_DEBUG */ + +END_C_DECLS +#endif /* OMPI_DATATYPE_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/datatype/dt_args.c b/ompi/datatype/ompi_datatype_args.c similarity index 67% rename from ompi/datatype/dt_args.c rename to ompi/datatype/ompi_datatype_args.c index 11ef0f4a7f..44610ff173 100644 --- a/ompi/datatype/dt_args.c +++ b/ompi/datatype/ompi_datatype_args.c @@ -3,13 +3,14 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -18,37 +19,39 @@ */ #include "ompi_config.h" -#include "opal/util/arch.h" -#include "opal/align.h" -#include "ompi/constants.h" +#include #include "mpi.h" +#include "opal/align.h" #include "opal/types.h" - -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" +#include "opal/util/arch.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "ompi/constants.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" #include "ompi/proc/proc.h" static inline int -__ompi_ddt_pack_description( ompi_datatype_t* datatype, - void** packed_buffer, int* next_index ); +__ompi_datatype_pack_description( ompi_datatype_t* datatype, + void** packed_buffer, int* next_index ); static ompi_datatype_t* -__ompi_ddt_create_from_args( int32_t* i, MPI_Aint* a, - MPI_Datatype* d, int32_t type ); +__ompi_datatype_create_from_args( int32_t* i, OPAL_PTRDIFF_TYPE * a, + ompi_datatype_t** d, int32_t type ); typedef struct __dt_args { - int ref_count; - int create_type; - size_t total_pack_size; - int ci; - int ca; - int cd; - int* i; - MPI_Aint* a; - MPI_Datatype* d; -} ompi_ddt_args_t; + int ref_count; + int create_type; + size_t total_pack_size; + int ci; + int ca; + int cd; + int* i; + OPAL_PTRDIFF_TYPE* a; + ompi_datatype_t** d; +} ompi_datatype_args_t; /** * Some architectures really don't like having unaligned @@ -59,64 +62,65 @@ typedef struct __dt_args { * copy the buffer into an aligned buffer first. */ #if OPAL_ALIGN_WORD_SIZE_INTEGERS -#define OMPI_DDT_ALIGN_INT(VALUE, TYPE) \ - (VALUE) = OPAL_ALIGN((VALUE), sizeof(MPI_Aint), TYPE) -#define OMPI_DDT_ALIGN_PTR(PTR, TYPE) \ - (PTR) = OPAL_ALIGN_PTR((PTR), sizeof(MPI_Aint), TYPE) +#define OMPI_DATATYPE_ALIGN_INT(VALUE, TYPE) \ + (VALUE) = OPAL_ALIGN((VALUE), sizeof(OPAL_PTRDIFF_TYPE), TYPE) +#define OMPI_DATATYPE_ALIGN_PTR(PTR, TYPE) \ + (PTR) = OPAL_ALIGN_PTR((PTR), sizeof(OPAL_PTRDIFF_TYPE), TYPE) #else -#define OMPI_DDT_ALIGN_INT(VALUE, TYPE) -#define OMPI_DDT_ALIGN_PTR(PTR, TYPE) +#define OMPI_DATATYPE_ALIGN_INT(VALUE, TYPE) +#define OMPI_DATATYPE_ALIGN_PTR(PTR, TYPE) #endif /* OPAL_ALIGN_WORD_SIZE_INTEGERS */ /** * Some architecture require that 64 bits pointers (to pointers) has to - * be 64 bits aligned. As in the ompi_ddt_args_t structure we have 2 such + * be 64 bits aligned. As in the ompi_datatype_args_t structure we have 2 such * pointers and one to an array of ints, if we start by setting the 64 * bits aligned one we will not have any trouble. Problem arise on * SPARC 64. */ -#define ALLOC_ARGS(PDATA, IC, AC, DC) \ +#define ALLOC_ARGS(PDATA, IC, AC, DC) \ do { \ - int length = sizeof(ompi_ddt_args_t) + (IC) * sizeof(int) + \ - (AC) * sizeof(MPI_Aint) + (DC) * sizeof(MPI_Datatype); \ - char* buf = (char*)malloc( length ); \ - ompi_ddt_args_t* pArgs = (ompi_ddt_args_t*)buf; \ + int length = sizeof(ompi_datatype_args_t) + (IC) * sizeof(int) + \ + (AC) * sizeof(OPAL_PTRDIFF_TYPE) + (DC) * sizeof(MPI_Datatype); \ + char* buf = (char*)malloc( length ); \ + ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)buf; \ pArgs->ci = (IC); \ pArgs->ca = (AC); \ pArgs->cd = (DC); \ - buf += sizeof(ompi_ddt_args_t); \ - if( pArgs->ca == 0 ) pArgs->a = NULL; \ - else { \ - pArgs->a = (MPI_Aint*)buf; \ - buf += pArgs->ca * sizeof(MPI_Aint); \ - } \ - if( pArgs->cd == 0 ) pArgs->d = NULL; \ + buf += sizeof(ompi_datatype_args_t); \ + if( pArgs->ca == 0 ) pArgs->a = NULL; \ else { \ - pArgs->d = (MPI_Datatype*)buf; \ + pArgs->a = (OPAL_PTRDIFF_TYPE*)buf; \ + buf += pArgs->ca * sizeof(OPAL_PTRDIFF_TYPE); \ + } \ + if( pArgs->cd == 0 ) pArgs->d = NULL; \ + else { \ + pArgs->d = (ompi_datatype_t**)buf; \ buf += pArgs->cd * sizeof(MPI_Datatype); \ } \ - if( pArgs->ci == 0 ) pArgs->i = NULL; \ + if( pArgs->ci == 0 ) pArgs->i = NULL; \ else pArgs->i = (int*)buf; \ pArgs->ref_count = 1; \ pArgs->total_pack_size = (4 + (IC)) * sizeof(int) + \ - (AC) * sizeof(MPI_Aint) + (DC) * sizeof(int); \ - OMPI_DDT_ALIGN_INT( pArgs->total_pack_size, int ); \ - (PDATA)->args = (void*)pArgs; \ + (AC) * sizeof(OPAL_PTRDIFF_TYPE) + (DC) * sizeof(int); \ + OMPI_DATATYPE_ALIGN_INT( pArgs->total_pack_size, int ); \ + (PDATA)->args = (void*)pArgs; \ (PDATA)->packed_description = NULL; \ } while(0) -int32_t ompi_ddt_set_args( ompi_datatype_t* pData, - int32_t ci, int32_t** i, - int32_t ca, MPI_Aint* a, - int32_t cd, MPI_Datatype* d, int32_t type) + +int32_t ompi_datatype_set_args( ompi_datatype_t* pData, + int32_t ci, int32_t** i, + int32_t ca, OPAL_PTRDIFF_TYPE* a, + int32_t cd, ompi_datatype_t** d, int32_t type) { int pos; - ompi_ddt_args_t* pArgs; + ompi_datatype_args_t* pArgs; assert( NULL == pData->args ); ALLOC_ARGS( pData, ci, ca, cd ); - pArgs = (ompi_ddt_args_t*)pData->args; + pArgs = (ompi_datatype_args_t*)pData->args; pArgs->create_type = type; switch(type){ @@ -216,13 +220,13 @@ int32_t ompi_ddt_set_args( ompi_datatype_t* pData, break; } - /* copy the array of MPI_Aint */ + /* copy the array of MPI_Aint, aka OPAL_PTRDIFF_TYPE */ if( pArgs->a != NULL ) - memcpy( pArgs->a, a, ca * sizeof(MPI_Aint) ); + memcpy( pArgs->a, a, ca * sizeof(OPAL_PTRDIFF_TYPE) ); for( pos = 0; pos < cd; pos++ ) { pArgs->d[pos] = d[pos]; - if( !(d[pos]->flags & DT_FLAG_PREDEFINED) ) { + if( !(ompi_datatype_is_predefined(d[pos])) ) { /* We handle a user defined datatype. We should make sure that the * user will not have the oportunity to destroy it before all derived * datatypes are destroyed. As we keep pointers to every datatype @@ -231,27 +235,31 @@ int32_t ompi_ddt_set_args( ompi_datatype_t* pData, * However, there is no easy way to free them in this case ... */ OBJ_RETAIN( d[pos] ); - pArgs->total_pack_size += ((ompi_ddt_args_t*)d[pos]->args)->total_pack_size; + pArgs->total_pack_size += ((ompi_datatype_args_t*)d[pos]->args)->total_pack_size; #if OPAL_ALIGN_WORD_SIZE_INTEGERS - /* as total_pack_size is always aligned to MPI_Aint size their sum + /* + * as total_pack_size is always aligned to + * MPI_Aint (aka OPAL_PTRDIFF_TYPE) size their sum * will be aligned to ... */ assert( pArgs->total_pack_size == - OPAL_ALIGN(pArgs->total_pack_size, sizeof(MPI_Aint), int) ); + OPAL_ALIGN(pArgs->total_pack_size, sizeof(OPAL_PTRDIFF_TYPE), int) ); #endif /* OPAL_ALIGN_WORD_SIZE_INTEGERS */ } } - return MPI_SUCCESS; + + return OMPI_SUCCESS; } -int32_t ompi_ddt_print_args( const ompi_datatype_t* pData ) + +int32_t ompi_datatype_print_args( const ompi_datatype_t* pData ) { int32_t i; - ompi_ddt_args_t* pArgs = (ompi_ddt_args_t*)pData->args; + ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)pData->args; - if( pData->flags & DT_FLAG_PREDEFINED ) { + if( ompi_datatype_is_predefined(pData) ) { /* nothing to do for predefined data-types */ - return(MPI_SUCCESS); + return OMPI_SUCCESS; } if( pArgs == NULL ) return MPI_ERR_INTERN; @@ -285,12 +293,12 @@ int32_t ompi_ddt_print_args( const ompi_datatype_t* pData ) continue; } if( count <= 1 ) { - if( old->flags & DT_FLAG_PREDEFINED ) + if( ompi_datatype_is_predefined(old) ) printf( "%s ", old->name ); else printf( "%p ", (void*)old ); } else { - if( old->flags & DT_FLAG_PREDEFINED ) + if( ompi_datatype_is_predefined(old) ) printf( "(%d * %s) ", count, old->name ); else printf( "(%d * %p) ", count, (void*)old ); @@ -299,30 +307,31 @@ int32_t ompi_ddt_print_args( const ompi_datatype_t* pData ) old = temp; } if( count <= 1 ) { - if( old->flags & DT_FLAG_PREDEFINED ) + if( ompi_datatype_is_predefined(old) ) printf( "%s ", old->name ); else printf( "%p ", (void*)old ); } else { - if( old->flags & DT_FLAG_PREDEFINED ) + if( ompi_datatype_is_predefined(old) ) printf( "(%d * %s) ", count, old->name ); else printf( "(%d * %p) ", count, (void*)old ); } printf( "\n" ); } - return MPI_SUCCESS; + return OMPI_SUCCESS; } -int32_t ompi_ddt_get_args( const ompi_datatype_t* pData, int32_t which, - int32_t* ci, int32_t* i, - int32_t* ca, MPI_Aint* a, - int32_t* cd, MPI_Datatype* d, int32_t* type) + +int32_t ompi_datatype_get_args( const ompi_datatype_t* pData, int32_t which, + int32_t* ci, int32_t* i, + int32_t* ca, OPAL_PTRDIFF_TYPE* a, + int32_t* cd, ompi_datatype_t** d, int32_t* type) { - ompi_ddt_args_t* pArgs = (ompi_ddt_args_t*)pData->args; + ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)pData->args; if( NULL == pArgs ) { /* only for predefined datatypes */ - if( pData->flags & DT_FLAG_PREDEFINED ) { + if( ompi_datatype_is_predefined(pData) ) { switch(which){ case 0: *ci = 0; @@ -333,7 +342,7 @@ int32_t ompi_ddt_get_args( const ompi_datatype_t* pData, int32_t which, default: return MPI_ERR_INTERN; } - return(MPI_SUCCESS); + return OMPI_SUCCESS; } return MPI_ERR_INTERN; } @@ -346,25 +355,30 @@ int32_t ompi_ddt_get_args( const ompi_datatype_t* pData, int32_t which, *type = pArgs->create_type; break; case 1: /* GET THE ARGUMENTS */ - if(*ci < pArgs->ci || *ca < pArgs->ca || *cd < pArgs->cd) + if(*ci < pArgs->ci || *ca < pArgs->ca || *cd < pArgs->cd) { return MPI_ERR_ARG; - if( (NULL != i) && (NULL != pArgs->i) ) + } + if( (NULL != i) && (NULL != pArgs->i) ) { memcpy( i, pArgs->i, pArgs->ci * sizeof(int) ); - if( (NULL != a) && (NULL != pArgs->a) ) - memcpy( a, pArgs->a, pArgs->ca * sizeof(MPI_Aint) ); - if( (NULL != d) && (NULL != pArgs->d) ) + } + if( (NULL != a) && (NULL != pArgs->a) ) { + memcpy( a, pArgs->a, pArgs->ca * sizeof(OPAL_PTRDIFF_TYPE) ); + } + if( (NULL != d) && (NULL != pArgs->d) ) { memcpy( d, pArgs->d, pArgs->cd * sizeof(MPI_Datatype) ); + } break; default: return MPI_ERR_INTERN; } - return MPI_SUCCESS; + return OMPI_SUCCESS; } -int32_t ompi_ddt_copy_args( const ompi_datatype_t* source_data, - ompi_datatype_t* dest_data ) + +int32_t ompi_datatype_copy_args( const ompi_datatype_t* source_data, + ompi_datatype_t* dest_data ) { - ompi_ddt_args_t* pArgs = (ompi_ddt_args_t*)source_data->args; + ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)source_data->args; /* If required then increase the reference count of the arguments. This avoid us * to make one more copy for a read only piece of memory. @@ -372,18 +386,19 @@ int32_t ompi_ddt_copy_args( const ompi_datatype_t* source_data, assert( NULL != source_data->args ); pArgs->ref_count++; dest_data->args = pArgs; - return MPI_SUCCESS; + return OMPI_SUCCESS; } + /* In the dt_add function we increase the reference count for all datatypes * (except for the predefined ones) that get added to another datatype. This * insure that they cannot get released until all the references to them * get removed. */ -int32_t ompi_ddt_release_args( ompi_datatype_t* pData ) +int32_t ompi_datatype_release_args( ompi_datatype_t* pData ) { int i; - ompi_ddt_args_t* pArgs = (ompi_ddt_args_t*)pData->args; + ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)pData->args; assert( 0 < pArgs->ref_count ); pArgs->ref_count--; @@ -392,7 +407,7 @@ int32_t ompi_ddt_release_args( ompi_datatype_t* pData ) * args. We will release them only when the last datatype will dissapear. */ for( i = 0; i < pArgs->cd; i++ ) { - if( !(pArgs->d[i]->flags & DT_FLAG_PREDEFINED) ) { + if( !(ompi_datatype_is_predefined(pArgs->d[i])) ) { OBJ_RELEASE( pArgs->d[i] ); } } @@ -403,31 +418,33 @@ int32_t ompi_ddt_release_args( ompi_datatype_t* pData ) return OMPI_SUCCESS; } -size_t ompi_ddt_pack_description_length( const ompi_datatype_t* datatype ) + +size_t ompi_datatype_pack_description_length( const ompi_datatype_t* datatype ) { - if( datatype->flags & DT_FLAG_PREDEFINED ) { + if( ompi_datatype_is_predefined(datatype) ) { return sizeof(int) * 2; } - assert( NULL != (ompi_ddt_args_t*)datatype->args ); - return ((ompi_ddt_args_t*)datatype->args)->total_pack_size; + assert( NULL != (ompi_datatype_args_t*)datatype->args ); + return ((ompi_datatype_args_t*)datatype->args)->total_pack_size; } -static inline int __ompi_ddt_pack_description( ompi_datatype_t* datatype, - void** packed_buffer, int* next_index ) + +static inline int __ompi_datatype_pack_description( ompi_datatype_t* datatype, + void** packed_buffer, int* next_index ) { int i, *position = (int*)*packed_buffer; - ompi_ddt_args_t* args = (ompi_ddt_args_t*)datatype->args; + ompi_datatype_args_t* args = (ompi_datatype_args_t*)datatype->args; char* next_packed = (char*)*packed_buffer; - if( datatype->flags & DT_FLAG_PREDEFINED ) { + if( ompi_datatype_is_predefined(datatype) ) { position[0] = MPI_COMBINER_DUP; - position[1] = datatype->id; + position[1] = datatype->id; /* On the OMPI - layer, copy the ompi_datatype.id */ return OMPI_SUCCESS; } /* For duplicated datatype we don't have to store all the information */ if( MPI_COMBINER_DUP == args->create_type ) { position[0] = args->create_type; - position[1] = args->d[0]->id; + position[1] = args->d[0]->id; /* On the OMPI - layer, copy the ompi_datatype.id */ return OMPI_SUCCESS; } position[0] = args->create_type; @@ -446,8 +463,8 @@ static inline int __ompi_ddt_pack_description( ompi_datatype_t* datatype, * finally the array of counts. */ if( 0 < args->ca ) { - memcpy( next_packed, args->a, sizeof(MPI_Aint) * args->ca ); - next_packed += sizeof(MPI_Aint) * args->ca; + memcpy( next_packed, args->a, sizeof(OPAL_PTRDIFF_TYPE) * args->ca ); + next_packed += sizeof(OPAL_PTRDIFF_TYPE) * args->ca; } position = (int*)next_packed; next_packed += sizeof(int) * args->cd; @@ -459,50 +476,51 @@ static inline int __ompi_ddt_pack_description( ompi_datatype_t* datatype, /* copy the rest of the data */ for( i = 0; i < args->cd; i++ ) { ompi_datatype_t* temp_data = args->d[i]; - if( temp_data->flags & DT_FLAG_PREDEFINED ) { - position[i] = temp_data->id; + if( ompi_datatype_is_predefined(temp_data) ) { + position[i] = temp_data->id; /* On the OMPI - layer, copy the ompi_datatype.id */ } else { position[i] = *next_index; (*next_index)++; - __ompi_ddt_pack_description( temp_data, - (void**)&next_packed, - next_index ); + __ompi_datatype_pack_description( temp_data, + (void**)&next_packed, + next_index ); } } *packed_buffer = next_packed; return OMPI_SUCCESS; } - -int ompi_ddt_get_pack_description( ompi_datatype_t* datatype, - const void** packed_buffer ) + + +int ompi_datatype_get_pack_description( ompi_datatype_t* datatype, + const void** packed_buffer ) { - ompi_ddt_args_t* args = (ompi_ddt_args_t*)datatype->args; - int next_index = DT_MAX_PREDEFINED; + ompi_datatype_args_t* args = (ompi_datatype_args_t*)datatype->args; + int next_index = OMPI_DATATYPE_MAX_PREDEFINED; void* recursive_buffer; if( NULL == datatype->packed_description ) { - if( datatype->flags & DT_FLAG_PREDEFINED ) { - datatype->packed_description = malloc( 2 * sizeof(int) ); + if( ompi_datatype_is_predefined(datatype) ) { + datatype->packed_description = malloc(2 * sizeof(int)); } else if( NULL == args ) { return OMPI_ERROR; } else { datatype->packed_description = malloc( args->total_pack_size ); } recursive_buffer = datatype->packed_description; - __ompi_ddt_pack_description( datatype, &recursive_buffer, &next_index ); + __ompi_datatype_pack_description( datatype, &recursive_buffer, &next_index ); } *packed_buffer = (const void*)datatype->packed_description; return OMPI_SUCCESS; } -static ompi_datatype_t* -__ompi_ddt_create_from_packed_description( void** packed_buffer, - const struct ompi_proc_t* remote_processor ) + +static ompi_datatype_t* __ompi_datatype_create_from_packed_description( void** packed_buffer, + const struct ompi_proc_t* remote_processor ) { int* position; ompi_datatype_t* datatype = NULL; ompi_datatype_t** array_of_datatype; - MPI_Aint* array_of_disp; + OPAL_PTRDIFF_TYPE* array_of_disp; int* array_of_length; int number_of_length, number_of_disp, number_of_datatype, data_id; int create_type, i; @@ -518,8 +536,8 @@ __ompi_ddt_create_from_packed_description( void** packed_buffer, #endif next_buffer = (char*)*packed_buffer; - /* The pointer should always be aligned on MPI_Aint */ - OMPI_DDT_ALIGN_PTR(next_buffer, char*); + /* The pointer should always be aligned on MPI_Aint, aka OPAL_PTRDIFF_TYPE */ + OMPI_DATATYPE_ALIGN_PTR(next_buffer, char*); position = (int*)next_buffer; create_type = position[0]; @@ -536,9 +554,9 @@ __ompi_ddt_create_from_packed_description( void** packed_buffer, data_id = opal_swap_bytes4(data_id); } #endif - assert( data_id < DT_MAX_PREDEFINED ); + assert( data_id < OMPI_DATATYPE_MAX_PREDEFINED ); *packed_buffer = position + 2; - return (ompi_datatype_t*)ompi_ddt_basicDatatypes[data_id]; + return (ompi_datatype_t*)ompi_datatype_basicDatatypes[data_id]; } number_of_length = position[1]; @@ -555,8 +573,8 @@ __ompi_ddt_create_from_packed_description( void** packed_buffer, number_of_datatype ); next_buffer += (4 * sizeof(int)); /* move after the header */ - array_of_disp = (MPI_Aint*)next_buffer; - next_buffer += number_of_disp * sizeof(MPI_Aint); + array_of_disp = (OPAL_PTRDIFF_TYPE*)next_buffer; + next_buffer += number_of_disp * sizeof(OPAL_PTRDIFF_TYPE); /* the other datatypes */ position = (int*)next_buffer; next_buffer += number_of_datatype * sizeof(int); @@ -571,19 +589,19 @@ __ompi_ddt_create_from_packed_description( void** packed_buffer, data_id = opal_swap_bytes4(data_id); } #endif - if( data_id < DT_MAX_PREDEFINED ) { - array_of_datatype[i] = (ompi_datatype_t*)ompi_ddt_basicDatatypes[data_id]; + if( data_id < OMPI_DATATYPE_MAX_PREDEFINED ) { + array_of_datatype[i] = (ompi_datatype_t*)ompi_datatype_basicDatatypes[data_id]; continue; } array_of_datatype[i] = - __ompi_ddt_create_from_packed_description( (void**)&next_buffer, + __ompi_datatype_create_from_packed_description( (void**)&next_buffer, remote_processor ); if( NULL == array_of_datatype[i] ) { /* don't cleanup more than required. We can now modify these * values as we already know we have failed to rebuild the * datatype. */ - array_of_datatype[i] = (ompi_datatype_t*)ompi_ddt_basicDatatypes[DT_BYTE]; + array_of_datatype[i] = (ompi_datatype_t*)ompi_datatype_basicDatatypes[OPAL_DATATYPE_INT1]; /*XXX TODO */ number_of_datatype = i; goto cleanup_and_exit; } @@ -592,7 +610,7 @@ __ompi_ddt_create_from_packed_description( void** packed_buffer, #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT if (need_swap) { for (i = 0 ; i < number_of_length ; ++i) { - array_of_length[i] = opal_swap_bytes4(array_of_length[i]); + array_of_length[i] = opal_swap_bytes4(array_of_length[i]); } for (i = 0 ; i < number_of_disp ; ++i) { #if SIZEOF_PTRDIFF_T == 4 @@ -605,12 +623,12 @@ __ompi_ddt_create_from_packed_description( void** packed_buffer, } } #endif - datatype = __ompi_ddt_create_from_args( array_of_length, array_of_disp, + datatype = __ompi_datatype_create_from_args( array_of_length, array_of_disp, array_of_datatype, create_type ); *packed_buffer = next_buffer; cleanup_and_exit: for( i = 0; i < number_of_datatype; i++ ) { - if( !(array_of_datatype[i]->flags & DT_FLAG_PREDEFINED) ) { + if( !(ompi_datatype_is_predefined(array_of_datatype[i])) ) { OBJ_RELEASE(array_of_datatype[i]); } } @@ -618,9 +636,9 @@ __ompi_ddt_create_from_packed_description( void** packed_buffer, return datatype; } -static ompi_datatype_t* -__ompi_ddt_create_from_args( int32_t* i, MPI_Aint* a, - MPI_Datatype* d, int32_t type ) + +static ompi_datatype_t* __ompi_datatype_create_from_args( int32_t* i, MPI_Aint* a, + ompi_datatype_t** d, int32_t type ) { ompi_datatype_t* datatype = NULL; @@ -630,34 +648,34 @@ __ompi_ddt_create_from_args( int32_t* i, MPI_Aint* a, break; /******************************************************************/ case MPI_COMBINER_CONTIGUOUS: - ompi_ddt_create_contiguous( i[0], d[0], &datatype ); + ompi_datatype_create_contiguous( i[0], d[0], &datatype ); break; /******************************************************************/ case MPI_COMBINER_VECTOR: - ompi_ddt_create_vector( i[0], i[1], i[2], d[0], &datatype ); + ompi_datatype_create_vector( i[0], i[1], i[2], d[0], &datatype ); break; /******************************************************************/ case MPI_COMBINER_HVECTOR_INTEGER: case MPI_COMBINER_HVECTOR: - ompi_ddt_create_hvector( i[0], i[1], a[0], d[0], &datatype ); + ompi_datatype_create_hvector( i[0], i[1], a[0], d[0], &datatype ); break; /******************************************************************/ case MPI_COMBINER_INDEXED: /* TO CHECK */ - ompi_ddt_create_indexed( i[0], &(i[1]), &(i[1+i[0]]), d[0], &datatype ); + ompi_datatype_create_indexed( i[0], &(i[1]), &(i[1+i[0]]), d[0], &datatype ); break; /******************************************************************/ case MPI_COMBINER_HINDEXED_INTEGER: case MPI_COMBINER_HINDEXED: - ompi_ddt_create_hindexed( i[0], &(i[1]), a, d[0], &datatype ); + ompi_datatype_create_hindexed( i[0], &(i[1]), a, d[0], &datatype ); break; /******************************************************************/ case MPI_COMBINER_INDEXED_BLOCK: - ompi_ddt_create_indexed_block( i[0], i[1], &(i[2]), d[0], &datatype ); + ompi_datatype_create_indexed_block( i[0], i[1], &(i[2]), d[0], &datatype ); break; /******************************************************************/ case MPI_COMBINER_STRUCT_INTEGER: case MPI_COMBINER_STRUCT: - ompi_ddt_create_struct( i[0], &(i[1]), a, d, &datatype ); + ompi_datatype_create_struct( i[0], &(i[1]), a, d, &datatype ); break; /******************************************************************/ case MPI_COMBINER_SUBARRAY: @@ -678,7 +696,7 @@ __ompi_ddt_create_from_args( int32_t* i, MPI_Aint* a, pArgs->i[0] = i[0][0]; pArgs->i[1] = i[1][0]; pArgs->i[2] = i[2][0]; - + memcpy( pArgs->i + pos, i[3], i[2][0] * sizeof(int) ); pos += i[2][0]; memcpy( pArgs->i + pos, i[4], i[2][0] * sizeof(int) ); @@ -712,20 +730,19 @@ __ompi_ddt_create_from_args( int32_t* i, MPI_Aint* a, return datatype; } -ompi_datatype_t* -ompi_ddt_create_from_packed_description( void** packed_buffer, - struct ompi_proc_t* remote_processor ) + +ompi_datatype_t* ompi_datatype_create_from_packed_description( void** packed_buffer, + struct ompi_proc_t* remote_processor ) { ompi_datatype_t* datatype; - datatype = __ompi_ddt_create_from_packed_description( packed_buffer, + datatype = __ompi_datatype_create_from_packed_description( packed_buffer, remote_processor ); /* Keep the pointer aligned to MPI_Aint */ - OMPI_DDT_ALIGN_PTR(*packed_buffer, void*); + OMPI_DATATYPE_ALIGN_PTR(*packed_buffer, void*); if( NULL == datatype ) { return NULL; } - ompi_ddt_commit( &datatype ); + ompi_datatype_commit( &datatype ); return datatype; } - diff --git a/ompi/datatype/ompi_datatype_create.c b/ompi/datatype/ompi_datatype_create.c new file mode 100644 index 0000000000..e8fc2d0ec5 --- /dev/null +++ b/ompi/datatype/ompi_datatype_create.c @@ -0,0 +1,78 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include +#ifdef HAVE_STRING_H +#include +#endif + +#include "ompi/constants.h" +#include "opal/class/opal_pointer_array.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/attribute/attribute.h" + + +static void __ompi_datatype_allocate( ompi_datatype_t* datatype ) +{ + datatype->super.flags |= OMPI_DATATYPE_FLAG_ONE_SIDED; + datatype->args = NULL; + datatype->d_f_to_c_index = opal_pointer_array_add(&ompi_datatype_f_to_c_table, datatype); + /* Later generated datatypes will have their id according to the Fortran ID, as ALL types are registered */ + datatype->id = datatype->d_f_to_c_index; + datatype->d_keyhash = NULL; + datatype->name[0] = '\0'; + datatype->packed_description = NULL; +} + +static void __ompi_datatype_release(ompi_datatype_t * datatype) +{ + if( NULL != datatype->args ) { + ompi_datatype_release_args( datatype ); + datatype->args = NULL; + } + if( NULL != datatype->packed_description ) { + free( datatype->packed_description ); + datatype->packed_description = NULL; + } + if( NULL != opal_pointer_array_get_item(&ompi_datatype_f_to_c_table, datatype->d_f_to_c_index) ){ + opal_pointer_array_set_item( &ompi_datatype_f_to_c_table, datatype->d_f_to_c_index, NULL ); + } + /* any pending attributes ? */ + if (NULL != datatype->d_keyhash) { + ompi_attr_delete_all( TYPE_ATTR, datatype, datatype->d_keyhash ); + OBJ_RELEASE( datatype->d_keyhash ); + } + /* make sure the name is set to empty */ + datatype->name[0] = '\0'; +} + +OBJ_CLASS_INSTANCE(ompi_datatype_t, opal_datatype_t, __ompi_datatype_allocate, __ompi_datatype_release); + +ompi_datatype_t * ompi_datatype_create( int32_t expectedSize ) +{ + int ret; + ompi_datatype_t * datatype = (ompi_datatype_t*)OBJ_NEW(ompi_datatype_t); + + ret = opal_datatype_create_desc ( &(datatype->super), expectedSize); + if (OPAL_SUCCESS != ret) + return NULL; + + return datatype; +} diff --git a/ompi/datatype/ompi_datatype_create_contiguous.c b/ompi/datatype/ompi_datatype_create_contiguous.c new file mode 100644 index 0000000000..70ae21a89e --- /dev/null +++ b/ompi/datatype/ompi_datatype_create_contiguous.c @@ -0,0 +1,42 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "ompi/constants.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" +#include "mpi.h" + +int32_t ompi_datatype_create_contiguous( int count, const ompi_datatype_t* oldType, + ompi_datatype_t** newType ) +{ + ompi_datatype_t* pdt; + + if( 0 == count ) { + pdt = ompi_datatype_create( 0 ); + ompi_datatype_add( pdt, &ompi_mpi_datatype_null.dt, 0, 0, 0 ); + } else { + pdt = ompi_datatype_create( oldType->super.desc.used + 2 ); + opal_datatype_add( &(pdt->super), &(oldType->super), count, 0, (oldType->super.ub - oldType->super.lb) ); + } + *newType = pdt; + return OMPI_SUCCESS; +} diff --git a/ompi/datatype/ompi_datatype_create_indexed.c b/ompi/datatype/ompi_datatype_create_indexed.c new file mode 100644 index 0000000000..acdb2b2eab --- /dev/null +++ b/ompi/datatype/ompi_datatype_create_indexed.c @@ -0,0 +1,158 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include + +#include "ompi/constants.h" +#include "ompi/datatype/ompi_datatype.h" + + +/* We try to merge together data that are contiguous */ +int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ) +{ + ompi_datatype_t* pdt; + int i, dLength, endat, disp; + OPAL_PTRDIFF_TYPE extent; + + if( 0 == count ) { + *newType = ompi_datatype_create( 0 ); + ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); + return OMPI_SUCCESS; + } + + disp = pDisp[0]; + dLength = pBlockLength[0]; + endat = disp + dLength; + ompi_datatype_type_extent( oldType, &extent ); + if( 1 >= count ) { + pdt = ompi_datatype_create( oldType->super.desc.used + 2 ); + /* multiply by count to make it zero if count is zero */ + ompi_datatype_add( pdt, oldType, count * dLength, disp * extent, extent ); + } else { + pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); + for( i = 1; i < count; i++ ) { + if( endat == pDisp[i] ) { + /* contiguous with the previsious */ + dLength += pBlockLength[i]; + endat += pBlockLength[i]; + } else { + ompi_datatype_add( pdt, oldType, dLength, disp * extent, extent ); + disp = pDisp[i]; + dLength = pBlockLength[i]; + endat = disp + pBlockLength[i]; + } + } + ompi_datatype_add( pdt, oldType, dLength, disp * extent, extent ); + } + + *newType = pdt; + return OMPI_SUCCESS; +} + + +int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ) +{ + ompi_datatype_t* pdt; + int i, dLength; + OPAL_PTRDIFF_TYPE extent, disp, endat; + + if( 0 == count ) { + *newType = ompi_datatype_create( 0 ); + ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); + return OMPI_SUCCESS; + } + + ompi_datatype_type_extent( oldType, &extent ); + pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); + disp = pDisp[0]; + dLength = pBlockLength[0]; + endat = disp + dLength * extent; + + if( 1 >= count ) { + pdt = ompi_datatype_create( oldType->super.desc.used + 2 ); + /* multiply by count to make it zero if count is zero */ + ompi_datatype_add( pdt, oldType, count * dLength, disp, extent ); + } else { + for( i = 1; i < count; i++ ) { + if( endat == pDisp[i] ) { + /* contiguous with the previsious */ + dLength += pBlockLength[i]; + endat += pBlockLength[i] * extent; + } else { + ompi_datatype_add( pdt, oldType, dLength, disp, extent ); + disp = pDisp[i]; + dLength = pBlockLength[i]; + endat = disp + pBlockLength[i] * extent; + } + } + ompi_datatype_add( pdt, oldType, dLength, disp, extent ); + } + /* + * A datatype based on bytes displacements is not suitable for + * one sided communications. + */ + pdt->super.flags &= ~OMPI_DATATYPE_FLAG_ONE_SIDED; + *newType = pdt; + return OMPI_SUCCESS; +} + + +int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* pDisp, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ) +{ + ompi_datatype_t* pdt; + int i, dLength, endat, disp; + OPAL_PTRDIFF_TYPE extent; + + ompi_datatype_type_extent( oldType, &extent ); + if( (count == 0) || (bLength == 0) ) { + *newType = ompi_datatype_create(1); + if( 0 == count ) + ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0 ); + else + ompi_datatype_add( *newType, oldType, 0, pDisp[0] * extent, extent ); + return OMPI_SUCCESS; + } + pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); + disp = pDisp[0]; + dLength = bLength; + endat = disp + dLength; + for( i = 1; i < count; i++ ) { + if( endat == pDisp[i] ) { + /* contiguous with the previsious */ + dLength += bLength; + endat += bLength; + } else { + ompi_datatype_add( pdt, oldType, dLength, disp * extent, extent ); + disp = pDisp[i]; + dLength = bLength; + endat = disp + bLength; + } + } + ompi_datatype_add( pdt, oldType, dLength, disp * extent, extent ); + + *newType = pdt; + return OMPI_SUCCESS; +} diff --git a/ompi/datatype/dt_create_struct.c b/ompi/datatype/ompi_datatype_create_struct.c similarity index 64% rename from ompi/datatype/dt_create_struct.c rename to ompi/datatype/ompi_datatype_create_struct.c index 241d714360..0c15babc7b 100644 --- a/ompi/datatype/dt_create_struct.c +++ b/ompi/datatype/ompi_datatype_create_struct.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -11,6 +11,7 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,20 +20,23 @@ */ #include "ompi_config.h" -#include "ompi/constants.h" -#include "ompi/datatype/datatype.h" -int32_t ompi_ddt_create_struct( int count, const int* pBlockLength, const MPI_Aint* pDisp, - ompi_datatype_t* const * pTypes, ompi_datatype_t** newType ) +#include + +#include "ompi/constants.h" +#include "ompi/datatype/ompi_datatype.h" + +int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, + ompi_datatype_t* const * pTypes, ompi_datatype_t** newType ) { int i; - ptrdiff_t disp = 0, endto, lastExtent, lastDisp; + OPAL_PTRDIFF_TYPE disp = 0, endto, lastExtent, lastDisp; int lastBlock; ompi_datatype_t *pdt, *lastType; if( 0 == count ) { - *newType = ompi_ddt_create( 0 ); - ompi_ddt_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); + *newType = ompi_datatype_create( 0 ); + ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); return OMPI_SUCCESS; } @@ -41,7 +45,7 @@ int32_t ompi_ddt_create_struct( int count, const int* pBlockLength, const MPI_Ai */ lastType = (ompi_datatype_t*)pTypes[0]; lastBlock = pBlockLength[0]; - lastExtent = lastType->ub - lastType->lb; + lastExtent = lastType->super.ub - lastType->super.lb; lastDisp = pDisp[0]; endto = pDisp[0] + lastExtent * lastBlock; @@ -50,25 +54,25 @@ int32_t ompi_ddt_create_struct( int count, const int* pBlockLength, const MPI_Ai lastBlock += pBlockLength[i]; endto = lastDisp + lastBlock * lastExtent; } else { - disp += lastType->desc.used; + disp += lastType->super.desc.used; if( lastBlock > 1 ) disp += 2; lastType = (ompi_datatype_t*)pTypes[i]; - lastExtent = lastType->ub - lastType->lb; + lastExtent = lastType->super.ub - lastType->super.lb; lastBlock = pBlockLength[i]; lastDisp = pDisp[i]; endto = lastDisp + lastExtent * lastBlock; } } - disp += lastType->desc.used; + disp += lastType->super.desc.used; if( lastBlock != 1 ) disp += 2; lastType = (ompi_datatype_t*)pTypes[0]; lastBlock = pBlockLength[0]; - lastExtent = lastType->ub - lastType->lb; + lastExtent = lastType->super.ub - lastType->super.lb; lastDisp = pDisp[0]; endto = pDisp[0] + lastExtent * lastBlock; - pdt = ompi_ddt_create( (int32_t)disp ); + pdt = ompi_datatype_create( (int32_t)disp ); /* Do again the same loop but now add the elements */ for( i = 1; i < count; i++ ) { @@ -76,16 +80,21 @@ int32_t ompi_ddt_create_struct( int count, const int* pBlockLength, const MPI_Ai lastBlock += pBlockLength[i]; endto = lastDisp + lastBlock * lastExtent; } else { - ompi_ddt_add( pdt, lastType, lastBlock, lastDisp, lastExtent ); + ompi_datatype_add( pdt, lastType, lastBlock, lastDisp, lastExtent ); lastType = (ompi_datatype_t*)pTypes[i]; - lastExtent = lastType->ub - lastType->lb; + lastExtent = lastType->super.ub - lastType->super.lb; lastBlock = pBlockLength[i]; lastDisp = pDisp[i]; endto = lastDisp + lastExtent * lastBlock; } } - ompi_ddt_add( pdt, lastType, lastBlock, lastDisp, lastExtent ); + ompi_datatype_add( pdt, lastType, lastBlock, lastDisp, lastExtent ); - *newType = pdt; + /* + * A datatype based on bytes displacements is not suitable for + * one sided communications. + */ + pdt->super.flags &= ~OMPI_DATATYPE_FLAG_ONE_SIDED; + *newType = pdt; return OMPI_SUCCESS; } diff --git a/ompi/datatype/ompi_datatype_create_vector.c b/ompi/datatype/ompi_datatype_create_vector.c new file mode 100644 index 0000000000..f39d63aa2c --- /dev/null +++ b/ompi/datatype/ompi_datatype_create_vector.c @@ -0,0 +1,101 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include + +#include "ompi/constants.h" +#include "ompi/datatype/ompi_datatype.h" + +/* Open questions ... + * - how to improuve the handling of these vectors (creating a temporary datatype + * can be ONLY a initial solution. + * + */ + +int32_t ompi_datatype_create_vector( int count, int bLength, int stride, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ) +{ + ompi_datatype_t *pTempData, *pData; + OPAL_PTRDIFF_TYPE extent = oldType->super.ub - oldType->super.lb; + + + if( 0 == count ) { + *newType = ompi_datatype_create( 0 ); + ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); + return OMPI_SUCCESS; + } + + pData = ompi_datatype_create( oldType->super.desc.used + 2 ); + if( (bLength == stride) || (1 >= count) ) { /* the elements are contiguous */ + ompi_datatype_add( pData, oldType, count * bLength, 0, extent ); + } else { + if( 1 == bLength ) { + ompi_datatype_add( pData, oldType, count, 0, extent * stride ); + } else { + ompi_datatype_add( pData, oldType, bLength, 0, extent ); + pTempData = pData; + pData = ompi_datatype_create( oldType->super.desc.used + 2 + 2 ); + ompi_datatype_add( pData, pTempData, count, 0, extent * stride ); + OBJ_RELEASE( pTempData ); + } + } + *newType = pData; + return OMPI_SUCCESS; +} + + +int32_t ompi_datatype_create_hvector( int count, int bLength, OPAL_PTRDIFF_TYPE stride, + const ompi_datatype_t* oldType, ompi_datatype_t** newType ) +{ + ompi_datatype_t *pTempData, *pData; + OPAL_PTRDIFF_TYPE extent = oldType->super.ub - oldType->super.lb; + + if( 0 == count ) { + *newType = ompi_datatype_create( 0 ); + ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); + return OMPI_SUCCESS; + } + + pTempData = ompi_datatype_create( oldType->super.desc.used + 2 ); + if( ((extent * bLength) == stride) || (1 >= count) ) { /* contiguous */ + pData = pTempData; + ompi_datatype_add( pData, oldType, count * bLength, 0, extent ); + } else { + if( 1 == bLength ) { + pData = pTempData; + ompi_datatype_add( pData, oldType, count, 0, stride ); + } else { + ompi_datatype_add( pTempData, oldType, bLength, 0, extent ); + pData = ompi_datatype_create( oldType->super.desc.used + 2 + 2 ); + ompi_datatype_add( pData, pTempData, count, 0, stride ); + OBJ_RELEASE( pTempData ); + } + } + /* + * A datatype based on bytes displacements is not suitable for + * one sided communications. + */ + pData->super.flags &= ~OMPI_DATATYPE_FLAG_ONE_SIDED; + *newType = pData; + return OMPI_SUCCESS; +} diff --git a/ompi/datatype/dt_external32.c b/ompi/datatype/ompi_datatype_external32.c similarity index 70% rename from ompi/datatype/dt_external32.c rename to ompi/datatype/ompi_datatype_external32.c index 637c7070dc..098e7925aa 100644 --- a/ompi/datatype/dt_external32.c +++ b/ompi/datatype/ompi_datatype_external32.c @@ -3,13 +3,14 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,9 +20,11 @@ #include "ompi_config.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype_internal.h" +#include "ompi/constants.h" + +#include "opal/datatype/opal_convertor.h" #include "opal/util/arch.h" +#include "ompi/datatype/ompi_datatype.h" /* From the MPI standard. external32 use the following types: * Type Length @@ -67,29 +70,27 @@ * consider the data stored in external32 as being packed. */ -uint32_t ompi_ddt_external32_arch_id = OPAL_ARCH_LDEXPSIZEIS15 | OPAL_ARCH_LDMANTDIGIS113 | - OPAL_ARCH_LONGDOUBLEIS128 | OPAL_ARCH_ISBIGENDIAN | - OPAL_ARCH_HEADERMASK | OPAL_ARCH_HEADERMASK2 | - OPAL_ARCH_BOOLIS8 | OPAL_ARCH_LOGICALIS8; +uint32_t ompi_datatype_external32_arch_id = OPAL_ARCH_LDEXPSIZEIS15 | OPAL_ARCH_LDMANTDIGIS113 | + OPAL_ARCH_LONGDOUBLEIS128 | OPAL_ARCH_ISBIGENDIAN | + OPAL_ARCH_HEADERMASK | OPAL_ARCH_HEADERMASK2 | + OPAL_ARCH_BOOLIS8 | OPAL_ARCH_LOGICALIS8; -ompi_convertor_t* ompi_mpi_external32_convertor = NULL; -ompi_convertor_t* ompi_mpi_local_convertor = NULL; -uint32_t ompi_mpi_local_arch = 0xFFFFFFFF; +opal_convertor_t* ompi_mpi_external32_convertor = NULL; +opal_convertor_t* ompi_mpi_local_convertor = NULL; -int32_t ompi_ddt_default_convertors_init( void ) +int32_t ompi_datatype_default_convertors_init( void ) { - opal_arch_compute_local_id( &ompi_mpi_local_arch ); - /* create the extern32 convertor */ - ompi_mpi_external32_convertor = ompi_convertor_create( ompi_ddt_external32_arch_id, 0 ); + ompi_mpi_external32_convertor = opal_convertor_create( ompi_datatype_external32_arch_id, 0 ); /* create the local convertor */ - ompi_mpi_local_convertor = ompi_convertor_create( ompi_mpi_local_arch, 0 ); + ompi_mpi_local_convertor = opal_convertor_create( opal_local_arch, 0 ); return OMPI_SUCCESS; } -int32_t ompi_ddt_default_convertors_fini( void ) + +int32_t ompi_datatype_default_convertors_fini( void ) { OBJ_RELEASE( ompi_mpi_external32_convertor ); OBJ_RELEASE( ompi_mpi_local_convertor ); diff --git a/ompi/datatype/ompi_datatype_internal.h b/ompi/datatype/ompi_datatype_internal.h new file mode 100644 index 0000000000..e5e1ae5429 --- /dev/null +++ b/ompi/datatype/ompi_datatype_internal.h @@ -0,0 +1,497 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** + * ompi_datatype_t interface for OMPI internal data type representation + * + * ompi_datatype_t is a class which represents contiguous or + * non-contiguous data together with constituent type-related + * information. + */ + +#ifndef OMPI_DATATYPE_INTERNAL_H +#define OMPI_DATATYPE_INTERNAL_H + +#include "opal/datatype/opal_datatype_internal.h" + +/* + * This is the OMPI-layered numbering of ALL supported MPI types + * (derived from the old DT_ names). + * NOTE: These numbers have to match the d_f_to_c_index. + */ +#define OMPI_DATATYPE_MPI_NULL 0x00 +#define OMPI_DATATYPE_MPI_LB 0x00 +#define OMPI_DATATYPE_MPI_UB 0x01 +#define OMPI_DATATYPE_MPI_CHAR 0x02 +#define OMPI_DATATYPE_MPI_SIGNED_CHAR 0x03 /* Changed order */ +#define OMPI_DATATYPE_MPI_UNSIGNED_CHAR 0x04 /* Changed order */ +#define OMPI_DATATYPE_MPI_BYTE 0x05 +#define OMPI_DATATYPE_MPI_SHORT 0x06 +#define OMPI_DATATYPE_MPI_UNSIGNED_SHORT 0x07 +#define OMPI_DATATYPE_MPI_INT 0x08 +#define OMPI_DATATYPE_MPI_UNSIGNED_INT 0x09 +#define OMPI_DATATYPE_MPI_LONG 0x0A +#define OMPI_DATATYPE_MPI_UNSIGNED_LONG 0x0B +#define OMPI_DATATYPE_MPI_LONG_LONG 0x0C /* Was LONG_LONG_INT */ +#define OMPI_DATATYPE_MPI_UNSIGNED_LONG_LONG 0x0D +#define OMPI_DATATYPE_MPI_FLOAT 0x0E +#define OMPI_DATATYPE_MPI_DOUBLE 0x0F +#define OMPI_DATATYPE_MPI_LONG_DOUBLE 0x10 +#define OMPI_DATATYPE_MPI_WCHAR 0x11 +#define OMPI_DATATYPE_MPI_PACKED 0x12 + +#define OMPI_DATATYPE_MPI_BOOL 0x13 /* Was CXX_BOOL */ + +#define OMPI_DATATYPE_MPI_LOGICAL 0x14 +#define OMPI_DATATYPE_MPI_CHARACTER 0x15 /* Changed */ +#define OMPI_DATATYPE_MPI_INTEGER 0x16 +#define OMPI_DATATYPE_MPI_REAL 0x17 +#define OMPI_DATATYPE_MPI_DOUBLE_PRECISION 0x18 /* Was DBLPREC */ + +/* + * Derived datatypes supposely contiguous + */ +#define OMPI_DATATYPE_MPI_COMPLEX 0x19 /* Was COMPLEX_FLOAT */ +#define OMPI_DATATYPE_MPI_DOUBLE_COMPLEX 0x1A /* Was COMPLEX_DOUBLE */ +#define OMPI_DATATYPE_MPI_LONG_DOUBLE_COMPLEX 0x1B /* Was COMPLEX_LONG_DOUBLE */ +#define OMPI_DATATYPE_MPI_2INT 0x1C +#define OMPI_DATATYPE_MPI_2INTEGER 0x1D +#define OMPI_DATATYPE_MPI_2REAL 0x1E +#define OMPI_DATATYPE_MPI_2DBLPREC 0x1F +#define OMPI_DATATYPE_MPI_2COMPLEX 0x20 +#define OMPI_DATATYPE_MPI_2DOUBLE_COMPLEX 0x21 +/* + * Derived datatypes which will definitively be non contiguous on some architectures. + */ +#define OMPI_DATATYPE_MPI_FLOAT_INT 0x22 +#define OMPI_DATATYPE_MPI_DOUBLE_INT 0x23 +#define OMPI_DATATYPE_MPI_LONG_DOUBLE_INT 0x24 +#define OMPI_DATATYPE_MPI_LONG_INT 0x25 +#define OMPI_DATATYPE_MPI_SHORT_INT 0x26 +#define OMPI_DATATYPE_MPI_UNAVAILABLE 0x27 + +#define OMPI_DATATYPE_MPI_MAX_PREDEFINED 0x28 + +/* + * Optional Fortran datatypes, previously no fixed id + */ +#define OMPI_DATATYPE_MPI_LOGICAL1 0x28 +#define OMPI_DATATYPE_MPI_LOGICAL2 0x29 +#define OMPI_DATATYPE_MPI_LOGICAL4 0x30 +#define OMPI_DATATYPE_MPI_LOGICAL8 0x31 +#define OMPI_DATATYPE_MPI_INTEGER1 0x32 +#define OMPI_DATATYPE_MPI_INTEGER2 0x33 +#define OMPI_DATATYPE_MPI_INTEGER4 0x34 +#define OMPI_DATATYPE_MPI_INTEGER8 0x35 +#define OMPI_DATATYPE_MPI_INTEGER16 0x36 +#define OMPI_DATATYPE_MPI_REAL2 0x37 +#define OMPI_DATATYPE_MPI_REAL4 0x38 +#define OMPI_DATATYPE_MPI_REAL8 0x39 +#define OMPI_DATATYPE_MPI_REAL16 0x40 +#define OMPI_DATATYPE_MPI_COMPLEX8 0x41 +#define OMPI_DATATYPE_MPI_COMPLEX16 0x42 +#define OMPI_DATATYPE_MPI_COMPLEX32 0x43 + + +typedef struct { + float r; + float i; +} ompi_complex_float_t; + +typedef struct { + double r; + double i; +} ompi_complex_double_t; + +typedef struct { + long double r; + long double i; +} ompi_complex_long_double_t; + + +extern union dt_elem_desc ompi_datatype_predefined_elem_desc[2 * OMPI_DATATYPE_MPI_MAX_PREDEFINED]; +extern const ompi_datatype_t* ompi_datatype_basicDatatypes[OMPI_DATATYPE_MPI_MAX_PREDEFINED]; + +/* There 3 types of predefined data types. + * - the basic one composed by just one basic datatype which are + * definitively contiguous + * - the derived ones where the same basic type is used multiple times. + * They should be most of the time contiguous. + * - and finally the derived one where multiple basic types are used. + * Depending on the architecture they can be contiguous or not. + * + * At this level we do not care from which language the datatype came from + * (C, C++ or FORTRAN), we only focus on their internal representation in + * the host memory. + */ + +#define OMPI_DATATYPE_EMPTY_DATA(NAME) \ + OMPI_DATATYPE_MPI_ ## NAME /*id*/, \ + 0 /*d_f_to_c_index*/, \ + NULL /*d_keyhash*/, \ + NULL /*args*/, \ + NULL /*packed_description*/, \ + "MPI_" # NAME /*name*/ + +#define OMPI_DATATYPE_INITIALIZER_NULL(FLAGS) \ + OPAL_DATATYPE_INITIALIZER_NULL(OMPI_DATATYPE_FLAG_PREDEFINED | FLAGS) + +#define OMPI_DATATYPE_INITIALIZER_UNAVAILABLE(FLAGS) \ + OPAL_DATATYPE_INITIALIZER_UNAVAILABLE(FLAGS) + +#define OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE( TYPE, NAME, FLAGS ) \ + { /*ompi_predefined_datatype_t*/ \ + { /* ompi_datatype_t */ \ + OMPI_DATATYPE_INITIALIZER_ ## TYPE (OMPI_DATATYPE_FLAG_PREDEFINED | \ + OMPI_DATATYPE_FLAG_ONE_SIDED | \ + (FLAGS)) /*super*/, \ + OMPI_DATATYPE_EMPTY_DATA(NAME) /*id,d_f_to_c_index,d_keyhash,args,packed_description,name*/ \ + }, \ + {0, } /* padding */ \ + } +/* + * Two macros for convenience + */ +#define OMPI_DATATYPE_INIT_PREDEFINED( NAME, FLAGS ) \ + OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE( NAME, NAME, FLAGS ) +#define OMPI_DATATYPE_INIT_UNAVAILABLE( NAME, FLAGS ) \ + OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE( UNAVAILABLE, NAME, FLAGS ) + +/* + * Initilization for these types is deferred until runtime. + * + * Using this macro implies that at this point not all informations needed + * to fill up the datatype are known. We fill them with zeros and then later + * when the datatype engine will be initialized we complete with the + * correct information. This macro should be used for all composed types. + */ +#define OMPI_DATATYPE_INIT_DEFER(NAME, FLAGS) \ + OMPI_DATATYPE_INIT_UNAVAILABLE(NAME, FLAGS) + + +#if OMPI_WANT_F77_BINDINGS +/* + * For Fortran, we need to pass information, such as ALIGNMENT and SIZE as well + * Therefore, for initialization at compile-time, pass this data as well. + * + * However, there is no underlying OPAL-TYPE, therefore we just pass NAME, SIZE, + * ALIGN and the FLAGS. Additionally, ONLY for Fortran we need the + * ompi_datatype_predefined_elem_desc for the additional types. + */ +#define OMPI_DATATYPE_INIT_DESC_PREDEFINED(TYPE, SIZE) \ + { \ + 1 /*length*/, 1 /*used*/, \ + &(ompi_datatype_predefined_elem_desc[2 * OPAL_DATATYPE_ ## TYPE ## SIZE]) /*desc*/ \ + } + +/* + * Fortran types are based on the underlying OPAL types: They share the ID -- however, + * the alignment is overwritten. + */ +#define OMPI_DATATYPE_INITIALIZER_FORTRAN( TYPE, NAME, SIZE, ALIGN, FLAGS ) \ + { \ + OPAL_OBJ_STATIC_INIT(opal_datatype_t), \ + OPAL_DATATYPE_FLAG_BASIC | \ + OMPI_DATATYPE_FLAG_PREDEFINED | \ + OMPI_DATATYPE_FLAG_ONE_SIDED | \ + OMPI_DATATYPE_FLAG_DATA_FORTRAN | (FLAGS) /*flag*/, \ + OPAL_DATATYPE_ ## TYPE ## SIZE /*id*/, \ + (((uint32_t)1)<<(OPAL_DATATYPE_ ## TYPE ## SIZE)) /*bdt_used*/, \ + SIZE /*size*/, \ + 0 /*true_lb*/, SIZE /*true_ub*/, 0 /*lb*/, SIZE /*ub*/, \ + (ALIGN) /*align*/, \ + 1 /*nbElems*/, \ + OPAL_DATATYPE_INIT_NAME(TYPE ## SIZE) /*name*/, \ + OMPI_DATATYPE_INIT_DESC_PREDEFINED(TYPE, SIZE) /*desc*/, \ + OMPI_DATATYPE_INIT_DESC_PREDEFINED(TYPE, SIZE) /*opt_desc*/, \ + OPAL_DATATYPE_INIT_BTYPES_ARRAY_ ## TYPE ## SIZE /*btypes*/ \ + } + +#define OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN( TYPE, NAME, SIZE, ALIGN, FLAGS ) \ + { /*ompi_predefined_datatype_t*/ \ + { /*ompi_datatype_t*/ \ + OMPI_DATATYPE_INITIALIZER_FORTRAN( TYPE, NAME, SIZE, ALIGN, FLAGS) /*super*/, \ + OMPI_DATATYPE_EMPTY_DATA(NAME) /*id,d_f_to_c_index,d_keyhash,args,packed_description,name*/ \ + }, \ + {0, } /* padding */ \ + } +#else +#define OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN( TYPE, NAME, SIZE, ALIGN, FLAGS ) \ + OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE( UNAVAILABLE, NAME, FLAGS ) +#endif + + +/* + * OMPI-Versions of Initializer mapped onto OPAL-Types + */ + +#define OMPI_DATATYPE_INITIALIZER_LB OPAL_DATATYPE_INITIALIZER_LB +#define OMPI_DATATYPE_LB OPAL_DATATYPE_LB + +#define OMPI_DATATYPE_INITIALIZER_UB OPAL_DATATYPE_INITIALIZER_UB +#define OMPI_DATATYPE_UB OPAL_DATATYPE_UB + +#define OMPI_DATATYPE_INITIALIZER_CHAR OPAL_DATATYPE_INITIALIZER_INT1 +#define OMPI_DATATYPE_CHAR OPAL_DATATYPE_INT1 /* MPI-2.1: p28 signed char; vs. unspecified in C99 ISO/IEC 9899:1999: 5.2.4.2.2 and 6.2.6 */ + +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_CHAR OPAL_DATATYPE_INITIALIZER_UINT1 +#define OMPI_DATATYPE_UNSIGNED_CHAR OPAL_DATATYPE_UINT1 + +#define OMPI_DATATYPE_INITIALIZER_SIGNED_CHAR OPAL_DATATYPE_INITIALIZER_INT1 +#define OMPI_DATATYPE_SIGNED_CHAR OPAL_DATATYPE_INT1 + +#define OMPI_DATATYPE_INITIALIZER_BYTE OPAL_DATATYPE_INITIALIZER_UINT1 +#define OMPI_DATATYPE_BYTE OPAL_DATATYPE_UINT1 + + +#if SIZEOF_SHORT == 2 +#define OMPI_DATATYPE_INITIALIZER_SHORT OPAL_DATATYPE_INITIALIZER_INT2 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_SHORT OPAL_DATATYPE_INITIALIZER_UINT2 +#define OMPI_DATATYPE_SHORT OPAL_DATATYPE_INT2 +#define OMPI_DATATYPE_UNSIGNED_SHORT OPAL_DATATYPE_UINT2 +#elif SIZEOF_SHORT == 4 +#define OMPI_DATATYPE_INITIALIZER_SHORT OPAL_DATATYPE_INITIALIZER_INT4 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_SHORT OPAL_DATATYPE_INITIALIZER_UINT4 +#define OMPI_DATATYPE_SHORT OPAL_DATATYPE_INT4 +#define OMPI_DATATYPE_UNSIGNED_SHORT OPAL_DATATYPE_UINT4 +#elif SIZEOF_SHORT == 8 +#define OMPI_DATATYPE_INITIALIZER_SHORT OPAL_DATATYPE_INITIALIZER_INT8 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_SHORT OPAL_DATATYPE_INITIALIZER_UINT8 +#define OMPI_DATATYPE_SHORT OPAL_DATATYPE_INT8 +#define OMPI_DATATYPE_UNSIGNED_SHORT OPAL_DATATYPE_UINT8 +#endif + +/* + * Unfortunately, the following does not work: + * +#define OMPI_DATATYPE_INITIALIZER_INT OPAL_DATATYPE_INITIALIZER_INT ## SIZEOF_INT +#define OMPI_DATATYPE_INITIALIZER_UINT OPAL_DATATYPE_INITIALIZER_UINT ## SIZEOF_INT +#define OMPI_DATATYPE_INT OPAL_DATATYPE_INT ## SIZEOF_INT +#define OMPI_DATATYPE_UNSIGNED_INT OPAL_DATATYPE_UINT ## SIZEOF_INT + * therefore do it the long way + */ + +#if SIZEOF_INT == 2 +#define OMPI_DATATYPE_INITIALIZER_INT OPAL_DATATYPE_INITIALIZER_INT2 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_INT OPAL_DATATYPE_INITIALIZER_UINT2 +#define OMPI_DATATYPE_INT OPAL_DATATYPE_INT2 +#define OMPI_DATATYPE_UNSIGNED_INT OPAL_DATATYPE_UINT2 +#elif SIZEOF_INT == 4 +#define OMPI_DATATYPE_INITIALIZER_INT OPAL_DATATYPE_INITIALIZER_INT4 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_INT OPAL_DATATYPE_INITIALIZER_UINT4 +#define OMPI_DATATYPE_INT OPAL_DATATYPE_INT4 +#define OMPI_DATATYPE_UNSIGNED_INT OPAL_DATATYPE_UINT4 +#elif SIZEOF_INT == 8 +#define OMPI_DATATYPE_INITIALIZER_INT OPAL_DATATYPE_INITIALIZER_INT8 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_INT OPAL_DATATYPE_INITIALIZER_UINT8 +#define OMPI_DATATYPE_INT OPAL_DATATYPE_INT8 +#define OMPI_DATATYPE_UNSIGNED_INT OPAL_DATATYPE_UINT8 +#endif + +#if SIZEOF_LONG == 4 +#define OMPI_DATATYPE_INITIALIZER_LONG OPAL_DATATYPE_INITIALIZER_INT4 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG OPAL_DATATYPE_INITIALIZER_UINT4 +#define OMPI_DATATYPE_LONG OPAL_DATATYPE_INT4 +#define OMPI_DATATYPE_UNSIGNED_LONG OPAL_DATATYPE_UINT4 +#elif SIZEOF_LONG == 8 +#define OMPI_DATATYPE_INITIALIZER_LONG OPAL_DATATYPE_INITIALIZER_INT8 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG OPAL_DATATYPE_INITIALIZER_UINT8 +#define OMPI_DATATYPE_LONG OPAL_DATATYPE_INT8 +#define OMPI_DATATYPE_UNSIGNED_LONG OPAL_DATATYPE_UINT8 +#elif SIZEOF_LONG == 16 +#define OMPI_DATATYPE_INITIALIZER_LONG OPAL_DATATYPE_INITIALIZER_INT16 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG OPAL_DATATYPE_INITIALIZER_UINT16 +#define OMPI_DATATYPE_LONG OPAL_DATATYPE_INT16 +#define OMPI_DATATYPE_UNSIGNED_LONG OPAL_DATATYPE_UINT16 +#endif + + +#ifdef HAVE_LONG_LONG +#if SIZEOF_LONG_LONG == 4 +#define OMPI_DATATYPE_INITIALIZER_LONG_LONG OPAL_DATATYPE_INITIALIZER_INT4 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG_LONG OPAL_DATATYPE_INITIALIZER_UINT4 +#define OMPI_DATATYPE_LONG_LONG OPAL_DATATYPE_INT4 +#define OMPI_DATATYPE_UNSIGNED_LONG_LONG OPAL_DATATYPE_UINT4 +#elif SIZEOF_LONG_LONG == 8 +#define OMPI_DATATYPE_INITIALIZER_LONG_LONG OPAL_DATATYPE_INITIALIZER_INT8 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG_LONG OPAL_DATATYPE_INITIALIZER_UINT8 +#define OMPI_DATATYPE_LONG_LONG OPAL_DATATYPE_INT8 +#define OMPI_DATATYPE_UNSIGNED_LONG_LONG OPAL_DATATYPE_UINT8 +#elif SIZEOF_LONG_LONG == 16 +#define OMPI_DATATYPE_INITIALIZER_LONG_LONG OPAL_DATATYPE_INITIALIZER_INT16 +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG_LONG OPAL_DATATYPE_INITIALIZER_UINT16 +#define OMPI_DATATYPE_LONG_LONG OPAL_DATATYPE_INT16 +#define OMPI_DATATYPE_UNSIGNED_LONG_LONG OPAL_DATATYPE_UINT16 +#endif + +#else /* HAVE_LONG_LONG */ + +#define OMPI_DATATYPE_INITIALIZER_LONG_LONG OPAL_DATATYPE_INIT_UNAVAILABLE (LONG_LONG, OMPI_DATATYPE_FLAG_DATA_C) +#define OMPI_DATATYPE_INITIALIZER_UNSIGNED_LONG_LONG OPAL_DATATYPE_INIT_UNAVAILABLE (UNSIGNED_LONG_LONG, OMPI_DATATYPE_FLAG_DATA_C) +#define OMPI_DATATYPE_LONG_LONG OPAL_DATATYPE_UNAVAILABLE +#define OMPI_DATATYPE_UNSIGNED_LONG_LONG OPAL_DATATYPE_UNAVAILABLE + +#endif /* HAVE_LONG_LONG */ + + +#if SIZEOF_FLOAT == 2 +#define OMPI_DATATYPE_INITIALIZER_FLOAT OPAL_DATATYPE_INITIALIZER_FLOAT2 +#define OMPI_DATATYPE_FLOAT OPAL_DATATYPE_FLOAT2 +#elif SIZEOF_FLOAT == 4 +#define OMPI_DATATYPE_INITIALIZER_FLOAT OPAL_DATATYPE_INITIALIZER_FLOAT4 +#define OMPI_DATATYPE_FLOAT OPAL_DATATYPE_FLOAT4 +#elif SIZEOF_FLOAT == 8 +#define OMPI_DATATYPE_INITIALIZER_FLOAT OPAL_DATATYPE_INITIALIZER_FLOAT8 +#define OMPI_DATATYPE_FLOAT OPAL_DATATYPE_FLOAT8 +#endif + + +#if SIZEOF_DOUBLE == 4 +#define OMPI_DATATYPE_INITIALIZER_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT4 +#define OMPI_DATATYPE_DOUBLE OPAL_DATATYPE_FLOAT4 +#elif SIZEOF_DOUBLE == 8 +#define OMPI_DATATYPE_INITIALIZER_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT8 +#define OMPI_DATATYPE_DOUBLE OPAL_DATATYPE_FLOAT8 +#elif SIZEOF_DOUBLE == 12 +#define OMPI_DATATYPE_INITIALIZER_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT12 +#define OMPI_DATATYPE_DOUBLE OPAL_DATATYPE_FLOAT12 +#elif SIZEOF_DOUBLE == 16 +#define OMPI_DATATYPE_INITIALIZER_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT16 +#define OMPI_DATATYPE_DOUBLE OPAL_DATATYPE_FLOAT16 +#endif + + +#ifdef HAVE_LONG_DOUBLE +#if SIZEOF_LONG_DOUBLE == 4 +#define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT4 +#define OMPI_DATATYPE_LONG_DOUBLE OPAL_DATATYPE_FLOAT4 +#elif SIZEOF_LONG_DOUBLE == 8 +#define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT8 +#define OMPI_DATATYPE_LONG_DOUBLE OPAL_DATATYPE_FLOAT8 +#elif SIZEOF_LONG_DOUBLE == 12 +#define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT12 +#define OMPI_DATATYPE_LONG_DOUBLE OPAL_DATATYPE_FLOAT12 +#elif SIZEOF_LONG_DOUBLE == 16 +#define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OPAL_DATATYPE_INITIALIZER_FLOAT16 +#define OMPI_DATATYPE_LONG_DOUBLE OPAL_DATATYPE_FLOAT16 +#endif + +#else /* HAVE_LONG_DOUBLE */ + +#define OMPI_DATATYPE_INITIALIZER_LONG_DOUBLE OMPI_DATATYPE_INIT_UNAVAILABLE(LONG_DOUBLE, OMPI_DATATYPE_FLAG_DATA_C) +#define OMPI_DATATYPE_LONG_DOUBLE OPAL_DATATYPE_UNAVAILABLE + +#endif /* HAVE_LONG_DOUBLE */ + +#define OMPI_DATATYPE_INITIALIZER_PACKED OPAL_DATATYPE_INITIALIZER_UINT1 +#define OMPI_DATATYPE_PACKED OPAL_DATATYPE_UINT1 + +#define OMPI_DATATYPE_INITIALIZER_BOOL OPAL_DATATYPE_INITIALIZER_BOOL +#define OMPI_DATATYPE_BOOL OPAL_DATATYPE_BOOL + +#define OMPI_DATATYPE_INITIALIZER_WCHAR OPAL_DATATYPE_INITIALIZER_WCHAR +#define OMPI_DATATYPE_WCHAR OPAL_DATATYPE_WCHAR + +/* + * Now come the id's of the Fortran Datatypes. + */ +#if OMPI_SIZEOF_FORTRAN_LOGICAL == 1 +#define OMPI_DATATYPE_LOGICAL OPAL_DATATYPE_INT1 +#elif OMPI_SIZEOF_FORTRAN_LOGICAL == 2 +#define OMPI_DATATYPE_LOGICAL OPAL_DATATYPE_INT2 +#elif OMPI_SIZEOF_FORTRAN_LOGICAL == 4 +#define OMPI_DATATYPE_LOGICAL OPAL_DATATYPE_INT4 +#elif OMPI_SIZEOF_FORTRAN_LOGICAL == 8 +#define OMPI_DATATYPE_LOGICAL OPAL_DATATYPE_INT8 +#endif + +#if OMPI_SIZEOF_FORTRAN_CHARACTER == 1 +#define OMPI_DATATYPE_CHARACTER OPAL_DATATYPE_INT1 +#elif OMPI_SIZEOF_FORTRAN_CHARACTER == 2 +#define OMPI_DATATYPE_CHARACTER OPAL_DATATYPE_INT2 +#elif OMPI_SIZEOF_FORTRAN_CHARACTER == 4 +#define OMPI_DATATYPE_CHARACTER OPAL_DATATYPE_INT4 +#elif OMPI_SIZEOF_FORTRAN_CHARACTER == 8 +#define OMPI_DATATYPE_CHARACTER OPAL_DATATYPE_INT8 +#endif + +#if OMPI_SIZEOF_FORTRAN_INTEGER == 1 +#define OMPI_DATATYPE_INTEGER OPAL_DATATYPE_INT1 +#elif OMPI_SIZEOF_FORTRAN_INTEGER == 2 +#define OMPI_DATATYPE_INTEGER OPAL_DATATYPE_INT2 +#elif OMPI_SIZEOF_FORTRAN_INTEGER == 4 +#define OMPI_DATATYPE_INTEGER OPAL_DATATYPE_INT4 +#elif OMPI_SIZEOF_FORTRAN_INTEGER == 8 +#define OMPI_DATATYPE_INTEGER OPAL_DATATYPE_INT8 +#endif + +#if OMPI_SIZEOF_FORTRAN_REAL == 2 +#define OMPI_DATATYPE_REAL OPAL_DATATYPE_FLOAT2 +#elif OMPI_SIZEOF_FORTRAN_REAL == 4 +#define OMPI_DATATYPE_REAL OPAL_DATATYPE_FLOAT4 +#elif OMPI_SIZEOF_FORTRAN_REAL == 8 +#define OMPI_DATATYPE_REAL OPAL_DATATYPE_FLOAT8 +#elif OMPI_SIZEOF_FORTRAN_REAL == 16 +#define OMPI_DATATYPE_REAL OPAL_DATATYPE_FLOAT16 +#endif + +#if OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION == 2 +#define OMPI_DATATYPE_DOUBLE_PRECISION OPAL_DATATYPE_FLOAT2 +#elif OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION == 4 +#define OMPI_DATATYPE_DOUBLE_PRECISION OPAL_DATATYPE_FLOAT4 +#elif OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION == 8 +#define OMPI_DATATYPE_DOUBLE_PRECISION OPAL_DATATYPE_FLOAT8 +#elif OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION == 16 +#define OMPI_DATATYPE_DOUBLE_PRECISION OPAL_DATATYPE_FLOAT16 +#endif + +/* + * Following are the structured types, that cannot be represented + * by one single OPAL basic type + */ +#define OMPI_DATATYPE_FIRST_TYPE OPAL_DATATYPE_MAX_PREDEFINED +#define OMPI_DATATYPE_COMPLEX (OMPI_DATATYPE_FIRST_TYPE+0) /* Equal to OMPI_DATATYPE_FIRST_TYPE */ +#define OMPI_DATATYPE_DOUBLE_COMPLEX (OMPI_DATATYPE_FIRST_TYPE+1) +#define OMPI_DATATYPE_LONG_DOUBLE_COMPLEX (OMPI_DATATYPE_FIRST_TYPE+2) + +#define OMPI_DATATYPE_COMPLEX8 (OMPI_DATATYPE_FIRST_TYPE+3) +#define OMPI_DATATYPE_COMPLEX16 (OMPI_DATATYPE_FIRST_TYPE+4) +#define OMPI_DATATYPE_COMPLEX32 (OMPI_DATATYPE_FIRST_TYPE+5) + +/* + * Derived datatypes supposely contiguous + */ +#define OMPI_DATATYPE_2INT (OMPI_DATATYPE_FIRST_TYPE+6) +#define OMPI_DATATYPE_2INTEGER (OMPI_DATATYPE_FIRST_TYPE+7) +#define OMPI_DATATYPE_2REAL (OMPI_DATATYPE_FIRST_TYPE+8) +#define OMPI_DATATYPE_2DBLPREC (OMPI_DATATYPE_FIRST_TYPE+9) +#define OMPI_DATATYPE_2COMPLEX (OMPI_DATATYPE_FIRST_TYPE+10) +#define OMPI_DATATYPE_2DOUBLE_COMPLEX (OMPI_DATATYPE_FIRST_TYPE+11) +/* + * Derived datatypes which will definitively be non contiguous on some architectures. + */ +#define OMPI_DATATYPE_FLOAT_INT (OMPI_DATATYPE_FIRST_TYPE+12) +#define OMPI_DATATYPE_DOUBLE_INT (OMPI_DATATYPE_FIRST_TYPE+13) +#define OMPI_DATATYPE_LONG_DOUBLE_INT (OMPI_DATATYPE_FIRST_TYPE+14) +#define OMPI_DATATYPE_SHORT_INT (OMPI_DATATYPE_FIRST_TYPE+15) +#define OMPI_DATATYPE_LONG_INT (OMPI_DATATYPE_FIRST_TYPE+16) + +/* Used locally as a nice marker */ +#define OMPI_DATATYPE_UNAVAILABLE (OMPI_DATATYPE_FIRST_TYPE+17) + +/* If the number of basic datatype should change update OMPI_DATATYPE_MAX_PREDEFINED in ompi_datatype.h */ +#if OMPI_DATATYPE_MAX_PREDEFINED <= OMPI_DATATYPE_UNAVAILABLE +#error OMPI_DATATYPE_MAX_PREDEFINED should be updated to the next value after the OMPI_DATATYPE_UNAVAILABLE define +#endif /* safe check for max predefined datatypes. */ + +#endif /* OMPI_DATATYPE_INTERNAL_H */ diff --git a/ompi/datatype/dt_match_size.c b/ompi/datatype/ompi_datatype_match_size.c similarity index 58% rename from ompi/datatype/dt_match_size.c rename to ompi/datatype/ompi_datatype_match_size.c index 8fd976ddf6..2c72a69d17 100644 --- a/ompi/datatype/dt_match_size.c +++ b/ompi/datatype/ompi_datatype_match_size.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2007 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -11,6 +11,7 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,32 +20,31 @@ */ #include "ompi_config.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" -extern int32_t ompi_ddt_number_of_predefined_data; +extern int32_t ompi_datatype_number_of_predefined_data; -const ompi_datatype_t* -ompi_ddt_match_size( int size, uint16_t datakind, uint16_t datalang ) +const ompi_datatype_t* ompi_datatype_match_size( int size, uint16_t datakind, uint16_t datalang ) { int32_t i; const ompi_datatype_t* datatype; /* If we're not looking for a complex C++ type then set the default type to C */ - if( datalang == DT_FLAG_DATA_CPP ) { - if( datakind != DT_FLAG_DATA_COMPLEX ) - datalang = DT_FLAG_DATA_C; + if( datalang == OMPI_DATATYPE_FLAG_DATA_CPP ) { + if( datakind != OMPI_DATATYPE_FLAG_DATA_COMPLEX ) + datalang = OMPI_DATATYPE_FLAG_DATA_C; } - for( i = 0; i < ompi_ddt_number_of_predefined_data; i++ ) { + for( i = 0; i < ompi_datatype_number_of_predefined_data; i++ ) { datatype = (ompi_datatype_t*)opal_pointer_array_get_item(&ompi_datatype_f_to_c_table, i); - if( (datatype->flags & DT_FLAG_DATA_LANGUAGE) != datalang ) + if( (datatype->super.flags & OMPI_DATATYPE_FLAG_DATA_LANGUAGE) != datalang ) continue; - if( (datatype->flags & DT_FLAG_DATA_TYPE) != datakind ) + if( (datatype->super.flags & OMPI_DATATYPE_FLAG_DATA_TYPE) != datakind ) continue; - if( (size_t)size == datatype->size ) { + if( (size_t)size == datatype->super.size ) { return datatype; } } diff --git a/ompi/datatype/ompi_datatype_module.c b/ompi/datatype/ompi_datatype_module.c new file mode 100644 index 0000000000..042b709a07 --- /dev/null +++ b/ompi/datatype/ompi_datatype_module.c @@ -0,0 +1,754 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include +#include + +#include "ompi/constants.h" +#include "opal/datatype/opal_convertor_internal.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" + +#include "mpi.h" + +#if OPAL_ENABLE_DEBUG +#include "opal/mca/base/mca_base_param.h" +/* These are used within test/datatype/position.c -- and therefore not static */ +int ompi_unpack_debug = 0; +int ompi_pack_debug = 0; +int ompi_copy_debug = 0; +int ompi_position_debug = 0; +#endif /* OPAL_ENABLE_DEBUG */ + +/* by default the debuging is turned off */ +int ompi_datatype_dfd = -1; +OMPI_DECLSPEC union dt_elem_desc ompi_datatype_predefined_elem_desc[2 * OMPI_DATATYPE_MPI_MAX_PREDEFINED]; + +/** + * This is the number of predefined datatypes. It is different than the MAX_PREDEFINED + * as it include all the optional datatypes (such as MPI_INTEGER?, MPI_REAL?). + */ +int32_t ompi_datatype_number_of_predefined_data = 0; + +/* + * The following initialization of C, C++ and Fortran types is fairly complex, + * based on the OPAL-datatypes. + * ompi_datatypes.h + * \-------> ompi_datatypes_internal.h (Macros defining type-number and initalization) + * opal_datatypes.h + * \-------> opal_datatypes_internal.h (Macros defining type-number and initalization) + * + * The Macros in the OMPI Layer differ in that: + * Additionally to OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE, we have a OMPI_DATATYPE_INIT_PREDEFINED, + * for all available types (getting rid of duplication of the name. + * Of course initialization of ompi_mpi_datatype_null includes the string-name NULL, + * which CPP converts to ((void*)0), which we do not really want... + */ +ompi_predefined_datatype_t ompi_mpi_datatype_null = + { + { + OMPI_DATATYPE_INITIALIZER_NULL (0), + OMPI_DATATYPE_EMPTY_DATA(NULL), + }, + {0, } /* padding */ + }; + +ompi_predefined_datatype_t ompi_mpi_unavailable = OMPI_DATATYPE_INIT_PREDEFINED (UNAVAILABLE, 0); + +ompi_predefined_datatype_t ompi_mpi_lb = OMPI_DATATYPE_INIT_PREDEFINED (LB, 0); +ompi_predefined_datatype_t ompi_mpi_ub = OMPI_DATATYPE_INIT_PREDEFINED (UB, 0); +ompi_predefined_datatype_t ompi_mpi_char = OMPI_DATATYPE_INIT_PREDEFINED (CHAR, OMPI_DATATYPE_FLAG_DATA_C); +ompi_predefined_datatype_t ompi_mpi_signed_char = OMPI_DATATYPE_INIT_PREDEFINED (SIGNED_CHAR, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_unsigned_char = OMPI_DATATYPE_INIT_PREDEFINED (UNSIGNED_CHAR, OMPI_DATATYPE_FLAG_DATA_C); +ompi_predefined_datatype_t ompi_mpi_byte = OMPI_DATATYPE_INIT_PREDEFINED (BYTE, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_short = OMPI_DATATYPE_INIT_PREDEFINED (SHORT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_unsigned_short = OMPI_DATATYPE_INIT_PREDEFINED (UNSIGNED_SHORT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_int = OMPI_DATATYPE_INIT_PREDEFINED (INT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_unsigned = OMPI_DATATYPE_INIT_PREDEFINED (UNSIGNED_INT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_long = OMPI_DATATYPE_INIT_PREDEFINED (LONG, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_unsigned_long = OMPI_DATATYPE_INIT_PREDEFINED (UNSIGNED_LONG, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +#if HAVE_LONG_LONG +ompi_predefined_datatype_t ompi_mpi_long_long_int = OMPI_DATATYPE_INIT_PREDEFINED (LONG_LONG, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_unsigned_long_long = OMPI_DATATYPE_INIT_PREDEFINED (UNSIGNED_LONG_LONG, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +#else +ompi_predefined_datatype_t ompi_mpi_long_long_int = OMPI_DATATYPE_INIT_UNAVAILABLE (LONG_LONG, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_unsigned_long_long = OMPI_DATATYPE_INIT_UNAVAILABLE (UNSIGNED_LONG_LONG, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT); +#endif /* HAVE_LONG_LONG */ +ompi_predefined_datatype_t ompi_mpi_float = OMPI_DATATYPE_INIT_PREDEFINED (FLOAT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_FLOAT ); +ompi_predefined_datatype_t ompi_mpi_double = OMPI_DATATYPE_INIT_PREDEFINED (DOUBLE, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_FLOAT ); +#if HAVE_LONG_DOUBLE +ompi_predefined_datatype_t ompi_mpi_long_double = OMPI_DATATYPE_INIT_PREDEFINED (LONG_DOUBLE, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_FLOAT ); +#else +ompi_predefined_datatype_t ompi_mpi_long_double = OMPI_DATATYPE_INIT_UNAVAILABLE (LONG_DOUBLE, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_FLOAT ); +#endif /* HAVE_LONG_DOUBLE */ +#if defined(OPAL_ALIGNMENT_WCHAR) && OPAL_ALIGNMENT_WCHAR != 0 +ompi_predefined_datatype_t ompi_mpi_wchar = OMPI_DATATYPE_INIT_PREDEFINED (WCHAR, OMPI_DATATYPE_FLAG_DATA_C ); +#else +ompi_predefined_datatype_t ompi_mpi_wchar = OMPI_DATATYPE_INIT_UNAVAILABLE (WCHAR, OMPI_DATATYPE_FLAG_DATA_C ); +#endif /* OPAL_ALIGNMENT_WCHAR */ +ompi_predefined_datatype_t ompi_mpi_packed = OMPI_DATATYPE_INIT_PREDEFINED (PACKED, 0 ); + +/* + * C++ / C99 datatypes + */ +ompi_predefined_datatype_t ompi_mpi_cxx_bool = OMPI_DATATYPE_INIT_PREDEFINED (BOOL, OMPI_DATATYPE_FLAG_DATA_CPP); +ompi_predefined_datatype_t ompi_mpi_cxx_cplex = OMPI_DATATYPE_INIT_DEFER (COMPLEX, OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +ompi_predefined_datatype_t ompi_mpi_cxx_dblcplex = OMPI_DATATYPE_INIT_DEFER (DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +#if HAVE_LONG_DOUBLE +ompi_predefined_datatype_t ompi_mpi_cxx_ldblcplex = OMPI_DATATYPE_INIT_DEFER (LONG_DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +#else +ompi_predefined_datatype_t ompi_mpi_cxx_ldblcplex = OMPI_DATATYPE_INIT_UNAVAILABLE (LONG_DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +#endif /* HAVE_LONG_DOUBLE */ + +/* + * Fortran datatypes + */ +ompi_predefined_datatype_t ompi_mpi_logical = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, LOGICAL, OMPI_SIZEOF_FORTRAN_LOGICAL, OMPI_ALIGNMENT_FORTRAN_LOGICAL, 0 ); +ompi_predefined_datatype_t ompi_mpi_character = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, CHARACTER, 1, OPAL_ALIGNMENT_CHAR, 0 ); +ompi_predefined_datatype_t ompi_mpi_integer = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, INTEGER, OMPI_SIZEOF_FORTRAN_INTEGER, OMPI_ALIGNMENT_FORTRAN_INTEGER, OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_real = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (FLOAT, REAL, OMPI_SIZEOF_FORTRAN_REAL, OMPI_ALIGNMENT_FORTRAN_REAL, OMPI_DATATYPE_FLAG_DATA_FLOAT ); +ompi_predefined_datatype_t ompi_mpi_dblprec = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (FLOAT, DOUBLE_PRECISION, OMPI_SIZEOF_FORTRAN_DOUBLE_PRECISION, OMPI_ALIGNMENT_FORTRAN_DOUBLE_PRECISION, OMPI_DATATYPE_FLAG_DATA_FLOAT ); +ompi_predefined_datatype_t ompi_mpi_cplex = OMPI_DATATYPE_INIT_DEFER (COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +#if OMPI_HAVE_F90_DOUBLE_COMPLEX +/* We do not configure-check for alignment of F90 types ... Alignment of F77 OMPI_ALIGNMENT_FORTRAN_COMPLEX has to suffice */ +ompi_predefined_datatype_t ompi_mpi_dblcplex = OMPI_DATATYPE_INIT_DEFER (DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +#else +ompi_predefined_datatype_t ompi_mpi_dblcplex = OMPI_DATATYPE_INIT_UNAVAILABLE (DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +#endif + +/* In Fortran, there does not exist a type LONG DOUBLE COMPLEX, but DOUBLE COMPLEX(KIND=8) may require this */ +#if HAVE_LONG_DOUBLE && OMPI_HAVE_F90_DOUBLE_COMPLEX +/* We do not configure-check for alignment of F90 types ... Alignment of F77 OMPI_ALIGNMENT_FORTRAN_COMPLEX has to suffice */ +ompi_predefined_datatype_t ompi_mpi_ldblcplex = OMPI_DATATYPE_INIT_DEFER (LONG_DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +#else +ompi_predefined_datatype_t ompi_mpi_ldblcplex = OMPI_DATATYPE_INIT_UNAVAILABLE (LONG_DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +#endif + +/* Aggregate struct datatypes are not const */ +ompi_predefined_datatype_t ompi_mpi_float_int = OMPI_DATATYPE_INIT_DEFER (FLOAT_INT, OMPI_DATATYPE_FLAG_DATA_C ); +ompi_predefined_datatype_t ompi_mpi_double_int = OMPI_DATATYPE_INIT_DEFER (DOUBLE_INT, OMPI_DATATYPE_FLAG_DATA_C ); +#if HAVE_LONG_DOUBLE +ompi_predefined_datatype_t ompi_mpi_longdbl_int = OMPI_DATATYPE_INIT_DEFER (LONG_DOUBLE_INT, OMPI_DATATYPE_FLAG_DATA_C ); +#else +ompi_predefined_datatype_t ompi_mpi_longdbl_int = OMPI_DATATYPE_INIT_UNAVAILABLE (LONG_DOUBLE_INT, OMPI_DATATYPE_FLAG_DATA_C ); +#endif /* HAVE_LONG_DOUBLE */ + +ompi_predefined_datatype_t ompi_mpi_2int = OMPI_DATATYPE_INIT_DEFER (2INT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_short_int = OMPI_DATATYPE_INIT_DEFER (SHORT_INT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_long_int = OMPI_DATATYPE_INIT_DEFER (LONG_INT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); + +ompi_predefined_datatype_t ompi_mpi_2integer = OMPI_DATATYPE_INIT_DEFER (2INTEGER, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_INT ); +ompi_predefined_datatype_t ompi_mpi_2real = OMPI_DATATYPE_INIT_DEFER (2REAL, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT ); +ompi_predefined_datatype_t ompi_mpi_2dblprec = OMPI_DATATYPE_INIT_DEFER (2REAL, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT ); + +ompi_predefined_datatype_t ompi_mpi_2cplex = OMPI_DATATYPE_INIT_DEFER (2COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); +ompi_predefined_datatype_t ompi_mpi_2dblcplex = OMPI_DATATYPE_INIT_DEFER (2DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); + +/* For each of these we figure out, whether it is available -- otherwise it's set to unavailable */ +#if OMPI_HAVE_FORTRAN_LOGICAL1 +ompi_predefined_datatype_t ompi_mpi_logical1 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, LOGICAL1, OMPI_SIZEOF_FORTRAN_LOGICAL1, OMPI_ALIGNMENT_FORTRAN_LOGICAL1, 0); +#else +ompi_predefined_datatype_t ompi_mpi_logical1 = OMPI_DATATYPE_INIT_UNAVAILABLE (LOGICAL1, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); +#endif +#if OMPI_HAVE_FORTRAN_LOGICAL2 +ompi_predefined_datatype_t ompi_mpi_logical2 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, LOGICAL2, OMPI_SIZEOF_FORTRAN_LOGICAL2, OMPI_ALIGNMENT_FORTRAN_LOGICAL2, 0); +#else +ompi_predefined_datatype_t ompi_mpi_logical2 = OMPI_DATATYPE_INIT_UNAVAILABLE (LOGICAL2, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); +#endif +#if OMPI_HAVE_FORTRAN_LOGICAL4 +ompi_predefined_datatype_t ompi_mpi_logical4 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, LOGICAL4, OMPI_SIZEOF_FORTRAN_LOGICAL4, OMPI_ALIGNMENT_FORTRAN_LOGICAL4, 0); +#else +ompi_predefined_datatype_t ompi_mpi_logical4 = OMPI_DATATYPE_INIT_UNAVAILABLE (LOGICAL4, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); +#endif +#if OMPI_HAVE_FORTRAN_LOGICAL8 +ompi_predefined_datatype_t ompi_mpi_logical8 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, LOGICAL8, OMPI_SIZEOF_FORTRAN_LOGICAL8, OMPI_ALIGNMENT_FORTRAN_LOGICAL8, 0); +#else +ompi_predefined_datatype_t ompi_mpi_logical8 = OMPI_DATATYPE_INIT_UNAVAILABLE (LOGICAL8, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); +#endif +#if OMPI_HAVE_FORTRAN_REAL2 +ompi_predefined_datatype_t ompi_mpi_real2 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (FLOAT, REAL2, OMPI_SIZEOF_FORTRAN_REAL2, OMPI_ALIGNMENT_FORTRAN_REAL2, OMPI_DATATYPE_FLAG_DATA_FLOAT); +#else +ompi_predefined_datatype_t ompi_mpi_real2 = OMPI_DATATYPE_INIT_UNAVAILABLE (REAL2, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT); +#endif +#if OMPI_HAVE_FORTRAN_REAL4 +ompi_predefined_datatype_t ompi_mpi_real4 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (FLOAT, REAL4, OMPI_SIZEOF_FORTRAN_REAL4, OMPI_ALIGNMENT_FORTRAN_REAL4, OMPI_DATATYPE_FLAG_DATA_FLOAT); +#else +ompi_predefined_datatype_t ompi_mpi_real4 = OMPI_DATATYPE_INIT_UNAVAILABLE (REAL4, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT); +#endif +#if OMPI_HAVE_FORTRAN_REAL8 +ompi_predefined_datatype_t ompi_mpi_real8 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (FLOAT, REAL8, OMPI_SIZEOF_FORTRAN_REAL8, OMPI_ALIGNMENT_FORTRAN_REAL8, OMPI_DATATYPE_FLAG_DATA_FLOAT); +#else +ompi_predefined_datatype_t ompi_mpi_real8 = OMPI_DATATYPE_INIT_UNAVAILABLE (REAL8, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT); +#endif +#if OMPI_HAVE_FORTRAN_REAL16 +ompi_predefined_datatype_t ompi_mpi_real16 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (FLOAT, REAL16, OMPI_SIZEOF_FORTRAN_REAL16, OMPI_ALIGNMENT_FORTRAN_REAL16, OMPI_DATATYPE_FLAG_DATA_FLOAT); +#else +ompi_predefined_datatype_t ompi_mpi_real16 = OMPI_DATATYPE_INIT_UNAVAILABLE (REAL16, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT); +#endif + +#if OMPI_HAVE_FORTRAN_INTEGER1 +ompi_predefined_datatype_t ompi_mpi_integer1 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, INTEGER1, OMPI_SIZEOF_FORTRAN_INTEGER1, OMPI_ALIGNMENT_FORTRAN_INTEGER1, OMPI_DATATYPE_FLAG_DATA_INT); +#else +ompi_predefined_datatype_t ompi_mpi_integer1 = OMPI_DATATYPE_INIT_UNAVAILABLE (INTEGER1, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_INT); +#endif +#if OMPI_HAVE_FORTRAN_INTEGER2 +ompi_predefined_datatype_t ompi_mpi_integer2 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, INTEGER2, OMPI_SIZEOF_FORTRAN_INTEGER2, OMPI_ALIGNMENT_FORTRAN_INTEGER2, OMPI_DATATYPE_FLAG_DATA_INT); +#else +ompi_predefined_datatype_t ompi_mpi_integer2 = OMPI_DATATYPE_INIT_UNAVAILABLE (INTEGER2, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_INT); +#endif +#if OMPI_HAVE_FORTRAN_INTEGER4 +ompi_predefined_datatype_t ompi_mpi_integer4 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, INTEGER4, OMPI_SIZEOF_FORTRAN_INTEGER4, OMPI_ALIGNMENT_FORTRAN_INTEGER4, OMPI_DATATYPE_FLAG_DATA_INT); +#else +ompi_predefined_datatype_t ompi_mpi_integer4 = OMPI_DATATYPE_INIT_UNAVAILABLE (INTEGER4, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_INT); +#endif +#if OMPI_HAVE_FORTRAN_INTEGER8 +ompi_predefined_datatype_t ompi_mpi_integer8 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, INTEGER8, OMPI_SIZEOF_FORTRAN_INTEGER8, OMPI_ALIGNMENT_FORTRAN_INTEGER8, OMPI_DATATYPE_FLAG_DATA_INT); +#else +ompi_predefined_datatype_t ompi_mpi_integer8 = OMPI_DATATYPE_INIT_UNAVAILABLE (INTEGER8, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_INT); +#endif +#if OMPI_HAVE_FORTRAN_INTEGER16 +ompi_predefined_datatype_t ompi_mpi_integer16 = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE_FORTRAN (INT, INTEGER16, OMPI_SIZEOF_FORTRAN_INTEGER16, OMPI_ALIGNMENT_FORTRAN_INTEGER16, OMPI_DATATYPE_FLAG_DATA_INT); +#else +ompi_predefined_datatype_t ompi_mpi_integer16 = OMPI_DATATYPE_INIT_UNAVAILABLE (INTEGER8, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_INT); +#endif + +#if OMPI_HAVE_FORTRAN_COMPLEX8 +ompi_predefined_datatype_t ompi_mpi_complex8 = OMPI_DATATYPE_INIT_DEFER (COMPLEX8, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX); +#else +ompi_predefined_datatype_t ompi_mpi_complex8 = OMPI_DATATYPE_INIT_UNAVAILABLE (COMPLEX8, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX); +#endif +#if OMPI_HAVE_FORTRAN_COMPLEX16 +ompi_predefined_datatype_t ompi_mpi_complex16 = OMPI_DATATYPE_INIT_DEFER (COMPLEX16, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX); +#else +ompi_predefined_datatype_t ompi_mpi_complex16 = OMPI_DATATYPE_INIT_UNAVAILABLE (COMPLEX16, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX); +#endif +#if OMPI_HAVE_FORTRAN_COMPLEX32 +ompi_predefined_datatype_t ompi_mpi_complex32 = OMPI_DATATYPE_INIT_DEFER (COMPLEX32, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX); +#else +ompi_predefined_datatype_t ompi_mpi_complex32 = OMPI_DATATYPE_INIT_UNAVAILABLE (COMPLEX32, OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX); +#endif + + +/* + * NOTE: The order of this array *MUST* match what is listed in + * opal_datatype_internal.h and ompi_datatype_internal.h + * Everything referring to types/ids should be ORDERED as in ompi_datatype_basicDatatypes array. + */ +const ompi_datatype_t* ompi_datatype_basicDatatypes[OMPI_DATATYPE_MPI_MAX_PREDEFINED] = { + &ompi_mpi_lb.dt, /* 0 */ + &ompi_mpi_ub.dt, + &ompi_mpi_char.dt, + &ompi_mpi_signed_char.dt, + &ompi_mpi_unsigned_char.dt, + &ompi_mpi_byte.dt, /* 5 */ + &ompi_mpi_short.dt, + &ompi_mpi_unsigned_short.dt, + &ompi_mpi_int.dt, + &ompi_mpi_unsigned.dt, + &ompi_mpi_long.dt, /* 10 */ + &ompi_mpi_unsigned_long.dt, + &ompi_mpi_long_long_int.dt, + &ompi_mpi_unsigned_long_long.dt, + &ompi_mpi_float.dt, + &ompi_mpi_double.dt, /* 15 */ + &ompi_mpi_long_double.dt, + &ompi_mpi_wchar.dt, + &ompi_mpi_packed.dt, + + /* C++ / C99 datatypes */ + &ompi_mpi_cxx_bool.dt, + + /* Fortran datatypes */ + &ompi_mpi_logical.dt, /* 20 */ + &ompi_mpi_character.dt, + &ompi_mpi_integer.dt, + &ompi_mpi_real.dt, + &ompi_mpi_dblprec.dt, + &ompi_mpi_cplex.dt, /* 25 */ + &ompi_mpi_dblcplex.dt, + &ompi_mpi_ldblcplex.dt, + + /* Structure types, based on two basic types */ + &ompi_mpi_2int.dt, + &ompi_mpi_2integer.dt, + &ompi_mpi_2real.dt, /* 30 */ + &ompi_mpi_2dblprec.dt, + &ompi_mpi_2cplex.dt, + &ompi_mpi_2dblcplex.dt, + &ompi_mpi_float_int.dt, + &ompi_mpi_double_int.dt, /* 35 */ + &ompi_mpi_longdbl_int.dt, + &ompi_mpi_long_int.dt, + &ompi_mpi_short_int.dt, + &ompi_mpi_unavailable.dt /* 39 */ +}; + +opal_pointer_array_t ompi_datatype_f_to_c_table; + +#define COPY_DATA_DESC( PDST, PSRC ) \ + do { \ + (PDST)->super.flags = (PSRC)->super.flags; \ + (PDST)->super.id = (PSRC)->super.id; \ + (PDST)->super.bdt_used = (PSRC)->super.bdt_used; \ + (PDST)->super.size = (PSRC)->super.size; \ + (PDST)->super.true_lb = (PSRC)->super.true_lb; \ + (PDST)->super.true_ub = (PSRC)->super.true_ub; \ + (PDST)->super.lb = (PSRC)->super.lb; \ + (PDST)->super.ub = (PSRC)->super.ub; \ + (PDST)->super.align = (PSRC)->super.align; \ + (PDST)->super.nbElems = (PSRC)->super.nbElems; \ + if( !opal_datatype_is_predefined (&((PDST)->super)) && \ + (NULL != (PDST)->super.desc.desc) ) \ + /* free( (PDST)->super.desc.desc ) */; \ + /* Don't re-assign the (PDST)->desc because we need the pointer-value in the \ + * following if statement. In case of predefined datatypes both descriptors \ + * point to the same memory: if we free memory twice, bad things happen. \ + */ \ + if( !opal_datatype_is_predefined (&((PDST)->super)) && \ + (NULL != (PDST)->super.opt_desc.desc) && \ + ((PDST)->super.opt_desc.desc != (PDST)->super.desc.desc) ) \ + /* free( (PDST)->super.opt_desc.desc ) */; \ + (PDST)->super.desc = (PSRC)->super.desc; \ + (PDST)->super.opt_desc = (PSRC)->super.opt_desc; \ + (PDST)->packed_description = (PSRC)->packed_description; \ + (PSRC)->packed_description = NULL; \ + memcpy( (PDST)->super.btypes, (PSRC)->super.btypes, \ + OPAL_DATATYPE_MAX_PREDEFINED * sizeof(uint32_t) ); \ + } while(0) + +#define DECLARE_MPI2_COMPOSED_STRUCT_DDT( PDATA, MPIDDT, MPIDDTNAME, type1, type2, MPIType1, MPIType2, FLAGS) \ + do { \ + struct { type1 v1; type2 v2; } s[2]; \ + ompi_datatype_t *types[2], *ptype; \ + int bLength[2] = {1, 1}; \ + OPAL_PTRDIFF_TYPE base, displ[2]; \ + \ + types[0] = (ompi_datatype_t*)ompi_datatype_basicDatatypes[MPIType1]; \ + types[1] = (ompi_datatype_t*)ompi_datatype_basicDatatypes[MPIType2]; \ + base = (OPAL_PTRDIFF_TYPE)(&(s[0])); \ + displ[0] = (OPAL_PTRDIFF_TYPE)(&(s[0].v1)); \ + displ[0] -= base; \ + displ[1] = (OPAL_PTRDIFF_TYPE)(&(s[0].v2)); \ + displ[1] -= base; \ + \ + ompi_datatype_create_struct( 2, bLength, displ, types, &ptype ); \ + displ[0] = (OPAL_PTRDIFF_TYPE)(&(s[1])); \ + displ[0] -= base; \ + if( displ[0] != (displ[1] + (OPAL_PTRDIFF_TYPE)sizeof(type2)) ) \ + ptype->super.ub = displ[0]; /* force a new extent for the datatype */ \ + ptype->super.flags |= (FLAGS); \ + ptype->id = MPIDDT; \ + ompi_datatype_commit( &ptype ); \ + COPY_DATA_DESC( PDATA, ptype ); \ + (PDATA)->super.flags &= ~OPAL_DATATYPE_FLAG_PREDEFINED; \ + (PDATA)->super.flags |= (OMPI_DATATYPE_FLAG_PREDEFINED|OMPI_DATATYPE_FLAG_ONE_SIDED); \ + ptype->super.desc.desc = NULL; \ + ptype->super.opt_desc.desc = NULL; \ + OBJ_RELEASE( ptype ); \ + strncpy( (PDATA)->super.name, MPIDDTNAME, MPI_MAX_OBJECT_NAME ); \ + } while(0) + +#define DECLARE_MPI2_COMPOSED_BLOCK_DDT( PDATA, MPIDDT, MPIDDTNAME, MPIType, FLAGS ) \ + do { \ + ompi_datatype_t *ptype; \ + ompi_datatype_create_contiguous( 2, ompi_datatype_basicDatatypes[MPIType], &ptype ); \ + ptype->super.flags |= (FLAGS); \ + ptype->super.id = (MPIDDT); \ + ompi_datatype_commit( &ptype ); \ + COPY_DATA_DESC( (PDATA), ptype ); \ + (PDATA)->super.flags &= ~OPAL_DATATYPE_FLAG_PREDEFINED; \ + (PDATA)->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED; \ + ptype->super.desc.desc = NULL; \ + ptype->super.opt_desc.desc = NULL; \ + OBJ_RELEASE( ptype ); \ + strncpy( (PDATA)->super.name, (MPIDDTNAME), MPI_MAX_OBJECT_NAME ); \ + } while(0) + +#define DECLARE_MPI_SYNONYM_DDT( PDATA, MPIDDTNAME, PORIGDDT) \ + do { \ + /* just memcpy as it's easier this way */ \ + memcpy( (PDATA), (PORIGDDT), sizeof(ompi_datatype_t) ); \ + strncpy( (PDATA)->name, MPIDDTNAME, MPI_MAX_OBJECT_NAME ); \ + /* forget the language flag */ \ + (PDATA)->super.flags &= ~OMPI_DATATYPE_FLAG_DATA_LANGUAGE; \ + (PDATA)->super.flags &= ~OPAL_DATATYPE_FLAG_PREDEFINED; \ + (PDATA)->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED; \ + } while(0) + + +int32_t ompi_datatype_init( void ) +{ + int32_t i; + + for( i = OMPI_DATATYPE_FIRST_TYPE; i < OMPI_DATATYPE_MPI_MAX_PREDEFINED; i++ ) { + const ompi_datatype_t* datatype = (ompi_datatype_t*)ompi_datatype_basicDatatypes[i]; + + datatype->super.desc.desc[0].elem.common.flags = OPAL_DATATYPE_FLAG_PREDEFINED | + OPAL_DATATYPE_FLAG_DATA | + OPAL_DATATYPE_FLAG_CONTIGUOUS; + datatype->super.desc.desc[0].elem.common.type = i; + datatype->super.desc.desc[0].elem.count = 1; + datatype->super.desc.desc[0].elem.disp = 0; + datatype->super.desc.desc[0].elem.extent = datatype->super.size; + + datatype->super.desc.desc[1].end_loop.common.flags = 0; + datatype->super.desc.desc[1].end_loop.common.type = OPAL_DATATYPE_END_LOOP; + datatype->super.desc.desc[1].end_loop.items = 1; + datatype->super.desc.desc[1].end_loop.first_elem_disp = datatype->super.desc.desc[0].elem.disp; + datatype->super.desc.desc[1].end_loop.size = datatype->super.size; + + /* Check if the data contain gaps */ + if( (datatype->super.ub - datatype->super.lb) == (OPAL_PTRDIFF_TYPE)datatype->super.size ) { + datatype->super.desc.desc[0].elem.common.flags |= OPAL_DATATYPE_FLAG_NO_GAPS; + } + } + + /* Create the f2c translation table */ + OBJ_CONSTRUCT(&ompi_datatype_f_to_c_table, opal_pointer_array_t); + if( OPAL_SUCCESS != opal_pointer_array_init(&ompi_datatype_f_to_c_table, + 0, OMPI_FORTRAN_HANDLE_MAX, 64)) { + return OMPI_ERROR; + } + /* All temporary datatypes created on the following statement will get registered + * on the f2c table. But as they get destroyed they will (hopefully) get unregistered + * so later when we start registering the real datatypes they will get the index + * in mpif.h + */ + +#if 0 /* XXX TODO The following may be deleted, both CXX and F77/F90 complex types are statically set up */ + /* the 2 complex datatypes (float and double) */ + DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_cplex.dt, OMPI_DATATYPE_COMPLEX_FLOAT, "MPI_COMPLEX", + float, float, OMPI_DATATYPE_FLOAT, OMPI_DATATYPE_FLOAT, + OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT ); + DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_dblcplex.dt, DT_COMPLEX_DOUBLE, "MPI_DOUBLE_COMPLEX", + double, double, DT_DOUBLE, DT_DOUBLE, + OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT ); +#if HAVE_LONG_DOUBLE + DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_ldblcplex.dt, DT_COMPLEX_LONG_DOUBLE, "MPI_LONG_DOUBLE_COMPLEX", + long double, long double, DT_LONG_DOUBLE, DT_LONG_DOUBLE, + OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT ); +#endif /* HAVE_LONG_DOUBLE */ +#endif + + /* Now the predefined MPI2 datatypes (they should last forever!) */ + DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2int.dt, OMPI_DATATYPE_2INT, "MPI_2INT", + OMPI_DATATYPE_MPI_INT, + OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); + DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2integer.dt, OMPI_DATATYPE_2INTEGER, "MPI_2INTEGER", + OMPI_DATATYPE_MPI_INT, + OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_INT); + DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2real.dt, OMPI_DATATYPE_2REAL, "MPI_2REAL", + OMPI_DATATYPE_MPI_FLOAT, + OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT ); + DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2dblprec.dt, OMPI_DATATYPE_2DBLPREC, "MPI_2DOUBLE_PRECISION", + OMPI_DATATYPE_MPI_DOUBLE, + OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_FLOAT ); + DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2cplex.dt, OMPI_DATATYPE_2COMPLEX, "MPI_2COMPLEX", + OMPI_DATATYPE_MPI_COMPLEX, + OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); + DECLARE_MPI2_COMPOSED_BLOCK_DDT( &ompi_mpi_2dblcplex.dt, OMPI_DATATYPE_2DOUBLE_COMPLEX, "MPI_2DOUBLE_COMPLEX", + OMPI_DATATYPE_MPI_DOUBLE_COMPLEX, + OMPI_DATATYPE_FLAG_DATA_FORTRAN | OMPI_DATATYPE_FLAG_DATA_COMPLEX ); + + DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_float_int.dt, OMPI_DATATYPE_FLOAT_INT, "MPI_FLOAT_INT", + float, int, + OMPI_DATATYPE_MPI_FLOAT, OMPI_DATATYPE_MPI_INT, + OMPI_DATATYPE_FLAG_DATA_C ); + DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_double_int.dt, OMPI_DATATYPE_DOUBLE_INT, "MPI_DOUBLE_INT", + double, int, + OMPI_DATATYPE_MPI_DOUBLE, OMPI_DATATYPE_MPI_INT, + OMPI_DATATYPE_FLAG_DATA_C ); + DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_long_int.dt, OMPI_DATATYPE_LONG_INT, "MPI_LONG_INT", + long, int, + OMPI_DATATYPE_MPI_LONG, OMPI_DATATYPE_MPI_INT, + OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); + DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_short_int.dt, OMPI_DATATYPE_SHORT_INT, "MPI_SHORT_INT", + short, int, + OMPI_DATATYPE_MPI_SHORT, OMPI_DATATYPE_MPI_INT, + OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT ); + DECLARE_MPI2_COMPOSED_STRUCT_DDT( &ompi_mpi_longdbl_int.dt, OMPI_DATATYPE_LONG_DOUBLE_INT, "MPI_LONG_DOUBLE_INT", + long double, int, + OMPI_DATATYPE_MPI_LONG_DOUBLE, OMPI_DATATYPE_MPI_INT, + OMPI_DATATYPE_FLAG_DATA_C ); + + + /* Copy the desc pointer from the ub - datatype->lb) == (OPAL_PTRDIFF_TYPE)datatype->size ) { + datatype->flags |= OPAL_DATATYPE_FLAG_NO_GAPS; + } else { + datatype->flags &= ~OPAL_DATATYPE_FLAG_NO_GAPS; + } + } + + ompi_datatype_default_convertors_init(); + return OMPI_SUCCESS; +} + + +int32_t ompi_datatype_finalize( void ) +{ + /* As the synonyms are just copies of the internal data we should not free them. + * Anyway they are over the limit of OMPI_DATATYPE_MPI_MAX_PREDEFINED so they will never get freed. + */ + + /* As they are statically allocated they cannot be released. + * XXX But we can call OBJ_DESTRUCT, just to free all internally allocated ressources. + */ +#if 0 + int i; + + for( i = 0; i < OMPI_DATATYPE_MAX_PREDEFINED; i++ ) { + OBJ_DESTRUCT( ompi_datatype_basicDatatypes[i] ); + } +#endif /* 0 */ + + /* Get rid of the Fortran2C translation table */ + OBJ_DESTRUCT(&ompi_datatype_f_to_c_table); + +#if defined(VERBOSE) + if( ompi_datatype_dfd != -1 ) + opal_output_close( ompi_datatype_dfd ); + ompi_datatype_dfd = -1; +#endif /* VERBOSE */ + + /* release the local convertors (external32 and local) */ + ompi_datatype_default_convertors_fini(); + + opal_datatype_finalize(); + + return OMPI_SUCCESS; +} + + +#if OPAL_ENABLE_DEBUG +/* + * Set a breakpoint to this function in your favorite debugger + * to make it stop on all pack and unpack errors. + */ +int ompi_datatype_safeguard_pointer_debug_breakpoint( const void* actual_ptr, int length, + const void* initial_ptr, + const ompi_datatype_t* pData, + int count ) +{ + return 0; +} +#endif /* OPAL_ENABLE_DEBUG */ + + +/******************************************************** + * Data dumping functions + ********************************************************/ + +static int _ompi_dump_data_flags( unsigned short usflags, char* ptr, size_t length ) +{ + int index = 0; + if( length < 22 ) return 0; + /* The lower-level part is the responsibility of opal_datatype_dump_data_flags */ + index += opal_datatype_dump_data_flags (usflags, ptr, length); + + /* Which kind of datatype is that */ + switch( usflags & OMPI_DATATYPE_FLAG_DATA_LANGUAGE ) { + case OMPI_DATATYPE_FLAG_DATA_C: + ptr[12] = ' '; ptr[13] = 'C'; ptr[14] = ' '; break; + case OMPI_DATATYPE_FLAG_DATA_CPP: + ptr[12] = 'C'; ptr[13] = 'P'; ptr[14] = 'P'; break; + case OMPI_DATATYPE_FLAG_DATA_FORTRAN: + ptr[12] = 'F'; ptr[13] = '7'; ptr[14] = '7'; break; + default: + if( usflags & OMPI_DATATYPE_FLAG_PREDEFINED ) { + ptr[12] = 'E'; ptr[13] = 'R'; ptr[14] = 'R'; break; + } + } + switch( usflags & OMPI_DATATYPE_FLAG_DATA_TYPE ) { + case OMPI_DATATYPE_FLAG_DATA_INT: + ptr[17] = 'I'; ptr[18] = 'N'; ptr[19] = 'T'; break; + case OMPI_DATATYPE_FLAG_DATA_FLOAT: + ptr[17] = 'F'; ptr[18] = 'L'; ptr[19] = 'T'; break; + case OMPI_DATATYPE_FLAG_DATA_COMPLEX: + ptr[17] = 'C'; ptr[18] = 'P'; ptr[19] = 'L'; break; + default: + if( usflags & OMPI_DATATYPE_FLAG_PREDEFINED ) { + ptr[17] = 'E'; ptr[18] = 'R'; ptr[19] = 'R'; break; + } + } + return index; +} + + +void ompi_datatype_dump( const ompi_datatype_t* pData ) +{ + size_t length; + int index = 0; + char* buffer; + + length = pData->super.opt_desc.used + pData->super.desc.used; + length = length * 100 + 500; + buffer = (char*)malloc( length ); + index += snprintf( buffer, length - index, + "Datatype %p[%s] id %d size %ld align %d opal_id %d length %d used %d\n" + "true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n" + "nbElems %d loops %d flags %X (", + (void*)pData, pData->name, pData->id, + (long)pData->super.size, (int)pData->super.align, pData->super.id, (int)pData->super.desc.length, (int)pData->super.desc.used, + (long)pData->super.true_lb, (long)pData->super.true_ub, (long)(pData->super.true_ub - pData->super.true_lb), + (long)pData->super.lb, (long)pData->super.ub, (long)(pData->super.ub - pData->super.lb), + (int)pData->super.nbElems, (int)pData->super.btypes[OPAL_DATATYPE_LOOP], (int)pData->super.flags ); + /* dump the flags */ + if( ompi_datatype_is_predefined(pData) ) + index += snprintf( buffer + index, length - index, "predefined " ); + else { + if( pData->super.flags & OPAL_DATATYPE_FLAG_COMMITED ) index += snprintf( buffer + index, length - index, "commited " ); + if( pData->super.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) index += snprintf( buffer + index, length - index, "contiguous " ); + } + index += snprintf( buffer + index, length - index, ")" ); + index += _ompi_dump_data_flags( pData->super.flags, buffer + index, length - index ); + { + index += snprintf( buffer + index, length - index, "\n contain " ); + index += opal_datatype_contain_basic_datatypes( &pData->super, buffer + index, length - index ); + index += snprintf( buffer + index, length - index, "\n" ); + } + if( (pData->super.opt_desc.desc != pData->super.desc.desc) && (NULL != pData->super.opt_desc.desc) ) { + /* If the data is already committed print everything including the last + * fake DT_END_LOOP entry. + */ + index += opal_datatype_dump_data_desc( pData->super.desc.desc, pData->super.desc.used + 1, buffer + index, length - index ); + index += snprintf( buffer + index, length - index, "Optimized description \n" ); + index += opal_datatype_dump_data_desc( pData->super.opt_desc.desc, pData->super.opt_desc.used + 1, buffer + index, length - index ); + } else { + index += opal_datatype_dump_data_desc( pData->super.desc.desc, pData->super.desc.used, buffer + index, length - index ); + index += snprintf( buffer + index, length - index, "No optimized description\n" ); + } + buffer[index] = '\0'; /* make sure we end the string with 0 */ + opal_output( 0, "%s\n", buffer ); + + ompi_datatype_print_args ( pData ); + + free(buffer); +} diff --git a/ompi/datatype/ompi_datatype_sndrcv.c b/ompi/datatype/ompi_datatype_sndrcv.c new file mode 100644 index 0000000000..542b421808 --- /dev/null +++ b/ompi/datatype/ompi_datatype_sndrcv.c @@ -0,0 +1,125 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/constants.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "opal/datatype/opal_convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" +/* + * opal_datatype_sndrcv + * + * Function: - copy MPI message from buffer into another + * - send/recv done if cannot optimize + * Accepts: - send buffer + * - send count + * - send datatype + * - receive buffer + * - receive count + * - receive datatype + * - tag + * - communicator + * Returns: - MPI_SUCCESS or error code + */ +int32_t ompi_datatype_sndrcv( void *sbuf, int32_t scount, const ompi_datatype_t* sdtype, + void *rbuf, int32_t rcount, const ompi_datatype_t* rdtype) +{ + opal_convertor_t send_convertor, recv_convertor; + struct iovec iov; + int length, completed; + uint32_t iov_count; + size_t max_data; + + /* First check if we really have something to do */ + if (0 == rcount) { + return ((0 == scount) ? MPI_SUCCESS : MPI_ERR_TRUNCATE); + } + + /* If same datatypes used, just copy. */ + /* XXX TODO sdtype ptr == rdtype ptr check enough??? Shouldn't the ID be the criteria for equality ?*/ + if (sdtype == rdtype) { + int32_t count = ( scount < rcount ? scount : rcount ); + opal_datatype_copy_content_same_ddt(&(rdtype->super), count, (char*)rbuf, (char*)sbuf); + return ((scount > rcount) ? MPI_ERR_TRUNCATE : MPI_SUCCESS); + } + + /* If receive packed. */ + if (rdtype->super.id == OMPI_DATATYPE_PACKED) { + OBJ_CONSTRUCT( &send_convertor, opal_convertor_t ); + opal_convertor_copy_and_prepare_for_send( ompi_mpi_local_convertor, + &(sdtype->super), scount, sbuf, 0, + &send_convertor ); + + iov_count = 1; + iov.iov_base = (IOVBASE_TYPE*)rbuf; + iov.iov_len = scount * sdtype->super.size; + if( (int32_t)iov.iov_len > rcount ) iov.iov_len = rcount; + + opal_convertor_pack( &send_convertor, &iov, &iov_count, &max_data ); + OBJ_DESTRUCT( &send_convertor ); + return ((max_data < (size_t)rcount) ? MPI_ERR_TRUNCATE : MPI_SUCCESS); + } + + /* If send packed. */ + if (sdtype->super.id == OMPI_DATATYPE_PACKED) { + OBJ_CONSTRUCT( &recv_convertor, opal_convertor_t ); + opal_convertor_copy_and_prepare_for_recv( ompi_mpi_local_convertor, + &(rdtype->super), rcount, rbuf, 0, + &recv_convertor ); + + iov_count = 1; + iov.iov_base = (IOVBASE_TYPE*)sbuf; + iov.iov_len = rcount * rdtype->super.size; + if( (int32_t)iov.iov_len > scount ) iov.iov_len = scount; + + opal_convertor_unpack( &recv_convertor, &iov, &iov_count, &max_data ); + OBJ_DESTRUCT( &recv_convertor ); + return (((size_t)scount > max_data) ? MPI_ERR_TRUNCATE : MPI_SUCCESS); + } + + iov.iov_len = length = 64 * 1024; + iov.iov_base = (IOVBASE_TYPE*)malloc( length * sizeof(char) ); + + OBJ_CONSTRUCT( &send_convertor, opal_convertor_t ); + opal_convertor_copy_and_prepare_for_send( ompi_mpi_local_convertor, + &(sdtype->super), scount, sbuf, 0, + &send_convertor ); + OBJ_CONSTRUCT( &recv_convertor, opal_convertor_t ); + opal_convertor_copy_and_prepare_for_recv( ompi_mpi_local_convertor, + &(rdtype->super), rcount, rbuf, 0, + &recv_convertor ); + + completed = 0; + while( !completed ) { + iov.iov_len = length; + iov_count = 1; + max_data = length; + completed |= opal_convertor_pack( &send_convertor, &iov, &iov_count, &max_data ); + completed |= opal_convertor_unpack( &recv_convertor, &iov, &iov_count, &max_data ); + } + free( iov.iov_base ); + OBJ_DESTRUCT( &send_convertor ); + OBJ_DESTRUCT( &recv_convertor ); + + return ( (scount * sdtype->super.size) <= (rcount * rdtype->super.size) ? MPI_SUCCESS : MPI_ERR_TRUNCATE ); +} diff --git a/ompi/debuggers/ompi_common_dll.c b/ompi/debuggers/ompi_common_dll.c index d3d90ddc13..7c7a99f6d8 100644 --- a/ompi/debuggers/ompi_common_dll.c +++ b/ompi/debuggers/ompi_common_dll.c @@ -36,6 +36,7 @@ #include "ompi_config.h" #include "ompi_common_dll_defs.h" +#include "ompi/datatype/ompi_datatype.h" /* Basic callbacks into the debugger */ const mqs_basic_callbacks *mqs_basic_entrypoints; @@ -391,8 +392,9 @@ int ompi_fill_in_type_info(mqs_image *image, char **message) } i_info->ompi_datatype_t.type = qh_type; i_info->ompi_datatype_t.size = mqs_sizeof(qh_type); + /* XXX TODO need to check whether super.size is OK here */ ompi_field_offset(i_info->ompi_datatype_t.offset.size, - qh_type, ompi_datatype_t, size); + qh_type, ompi_datatype_t, super.size); ompi_field_offset(i_info->ompi_datatype_t.offset.name, qh_type, ompi_datatype_t, name); } diff --git a/ompi/debuggers/ompi_debuggers.c b/ompi/debuggers/ompi_debuggers.c index a21e08d981..abbd6c4e73 100644 --- a/ompi/debuggers/ompi_debuggers.c +++ b/ompi/debuggers/ompi_debuggers.c @@ -67,7 +67,7 @@ #include "opal/class/opal_pointer_array.h" #include "ompi/communicator/communicator.h" #include "ompi/group/group.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/include/mpi.h" #include "orte/mca/errmgr/errmgr.h" diff --git a/ompi/mca/bml/bml.h b/ompi/mca/bml/bml.h index 2592b72f52..8c9556eada 100644 --- a/ompi/mca/bml/bml.h +++ b/ompi/mca/bml/bml.h @@ -28,14 +28,15 @@ #include "ompi_config.h" #include "opal/mca/mca.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/mca/crs/crs.h" +#include "opal/mca/crs/base/base.h" #include "ompi/mca/btl/btl.h" #include "ompi/mca/bml/base/bml_base_btl.h" #include "ompi/types.h" -#include "opal/mca/crs/crs.h" -#include "opal/mca/crs/base/base.h" #include "ompi/constants.h" #define OPAL_ENABLE_DEBUG_RELIABILITY 0 @@ -290,7 +291,7 @@ static inline int mca_bml_base_send_status( mca_bml_base_btl_t* bml_btl, } static inline int mca_bml_base_sendi( mca_bml_base_btl_t* bml_btl, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, void* header, size_t header_size, size_t payload_size, @@ -326,7 +327,7 @@ static inline int mca_bml_base_get( mca_bml_base_btl_t* bml_btl, static inline void mca_bml_base_prepare_src(mca_bml_base_btl_t* bml_btl, mca_mpool_base_registration_t* reg, - struct ompi_convertor_t* conv, + struct opal_convertor_t* conv, uint8_t order, size_t reserve, size_t *size, @@ -344,7 +345,7 @@ static inline void mca_bml_base_prepare_src(mca_bml_base_btl_t* bml_btl, static inline void mca_bml_base_prepare_dst(mca_bml_base_btl_t* bml_btl, mca_mpool_base_registration_t* reg, - struct ompi_convertor_t* conv, + struct opal_convertor_t* conv, uint8_t order, size_t reserve, size_t *size, diff --git a/ompi/mca/btl/btl.h b/ompi/mca/btl/btl.h index 1a3cfeac8f..0b7b49a025 100644 --- a/ompi/mca/btl/btl.h +++ b/ompi/mca/btl/btl.h @@ -112,6 +112,7 @@ #include "ompi_config.h" #include "opal/mca/mca.h" #include "opal/class/opal_bitmap.h" +#include "opal/datatype/opal_convertor.h" #include "opal/prefetch.h" /* For OPAL_LIKELY */ #include "ompi/mca/mpool/mpool.h" #include "ompi/types.h" @@ -601,7 +602,7 @@ typedef struct mca_btl_base_descriptor_t* (*mca_btl_base_module_prepare_fn_t)( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -663,7 +664,7 @@ typedef int (*mca_btl_base_module_send_fn_t)( typedef int (*mca_btl_base_module_sendi_fn_t)( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, void* header, size_t header_size, size_t payload_size, diff --git a/ompi/mca/btl/elan/btl_elan.c b/ompi/mca/btl/elan/btl_elan.c index 38ef3a0d67..f0c00ae539 100644 --- a/ompi/mca/btl/elan/btl_elan.c +++ b/ompi/mca/btl/elan/btl_elan.c @@ -18,7 +18,7 @@ #include "btl_elan_proc.h" #include "btl_elan_endpoint.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/btl/base/base.h" #include @@ -306,7 +306,7 @@ static mca_btl_base_descriptor_t* mca_btl_elan_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -342,7 +342,7 @@ mca_btl_elan_prepare_src( struct mca_btl_base_module_t* btl, iov.iov_len = max_data; iov.iov_base = (unsigned char*)frag->segment.seg_addr.pval + reserve; - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); *size = max_data; if( rc < 0 ) { MCA_BTL_ELAN_FRAG_RETURN(frag); @@ -357,7 +357,7 @@ mca_btl_elan_prepare_src( struct mca_btl_base_module_t* btl, frag->type = MCA_BTL_ELAN_HDR_TYPE_PUT; iov.iov_len = max_data; iov.iov_base = NULL; - ompi_convertor_pack(convertor, &iov, &iov_count, &max_data); + opal_convertor_pack(convertor, &iov, &iov_count, &max_data); *size = max_data; frag->segment.seg_addr.pval = iov.iov_base; frag->segment.seg_len = max_data; @@ -391,7 +391,7 @@ static mca_btl_base_descriptor_t* mca_btl_elan_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -409,10 +409,10 @@ mca_btl_elan_prepare_dst( struct mca_btl_base_module_t* btl, return NULL; } - ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); + opal_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); origin = convertor->bConverted; position += origin; - ompi_convertor_set_position( convertor, &position ); + opal_convertor_set_position( convertor, &position ); *size = position - origin; frag->segment.seg_len = *size; diff --git a/ompi/mca/btl/gm/btl_gm.c b/ompi/mca/btl/gm/btl_gm.c index 1e69afa161..1799348c33 100644 --- a/ompi/mca/btl/gm/btl_gm.c +++ b/ompi/mca/btl/gm/btl_gm.c @@ -27,7 +27,7 @@ #include "btl_gm_frag.h" #include "btl_gm_proc.h" #include "btl_gm_endpoint.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mpool/base/base.h" #include "ompi/mca/mpool/mpool.h" #include "ompi/proc/proc.h" @@ -251,7 +251,7 @@ mca_btl_base_descriptor_t* mca_btl_gm_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -265,7 +265,7 @@ mca_btl_base_descriptor_t* mca_btl_gm_prepare_src( int rc; #if (OMPI_MCA_BTL_GM_HAVE_RDMA_GET || OMPI_MCA_BTL_GM_HAVE_RDMA_PUT) - if(ompi_convertor_need_buffers(convertor) == false && 0 == reserve) { + if(opal_convertor_need_buffers(convertor) == false && 0 == reserve) { if(registration != NULL || max_data > btl->btl_max_send_size) { MCA_BTL_GM_FRAG_ALLOC_USER(btl, frag, rc); if(NULL == frag) { @@ -281,7 +281,7 @@ mca_btl_base_descriptor_t* mca_btl_gm_prepare_src( iov.iov_base = NULL; - ompi_convertor_pack(convertor, &iov, &iov_count, &max_data); + opal_convertor_pack(convertor, &iov, &iov_count, &max_data); *size = max_data; @@ -335,7 +335,7 @@ mca_btl_base_descriptor_t* mca_btl_gm_prepare_src( iov.iov_len = max_data; iov.iov_base = (unsigned char*) frag->segment.seg_addr.pval + reserve; - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data); if(rc < 0) { MCA_BTL_GM_FRAG_RETURN(btl, frag); return NULL; @@ -371,7 +371,7 @@ mca_btl_base_descriptor_t* mca_btl_gm_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -395,7 +395,7 @@ mca_btl_base_descriptor_t* mca_btl_gm_prepare_dst( frag->type = MCA_BTL_GM_PUT; frag->segment.seg_len = *size; - ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); + opal_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); frag->base.des_src = NULL; frag->base.des_src_cnt = 0; diff --git a/ompi/mca/btl/gm/btl_gm.h b/ompi/mca/btl/gm/btl_gm.h index 86536fbb5f..0b910935f7 100644 --- a/ompi/mca/btl/gm/btl_gm.h +++ b/ompi/mca/btl/gm/btl_gm.h @@ -296,7 +296,7 @@ mca_btl_base_descriptor_t* mca_btl_gm_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -307,7 +307,7 @@ extern mca_btl_base_descriptor_t* mca_btl_gm_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, diff --git a/ompi/mca/btl/mx/btl_mx.c b/ompi/mca/btl/mx/btl_mx.c index f7cc1f0808..186a37bed8 100644 --- a/ompi/mca/btl/mx/btl_mx.c +++ b/ompi/mca/btl/mx/btl_mx.c @@ -27,7 +27,7 @@ #include "btl_mx_frag.h" #include "btl_mx_proc.h" #include "btl_mx_endpoint.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "opal/prefetch.h" /** @@ -219,7 +219,7 @@ mca_btl_base_descriptor_t* mca_btl_mx_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -238,7 +238,7 @@ mca_btl_mx_prepare_src( struct mca_btl_base_module_t* btl, /* If the data is contiguous we can use directly the pointer * to the user memory. */ - if( 0 == ompi_convertor_need_buffers(convertor) ) { + if( 0 == opal_convertor_need_buffers(convertor) ) { /** * let the convertor figure out the correct pointer depending * on the data layout @@ -268,7 +268,7 @@ mca_btl_mx_prepare_src( struct mca_btl_base_module_t* btl, } iov.iov_len = max_data; - (void)ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + (void)opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); *size = max_data; if( 1 == frag->base.des_src_cnt ) { @@ -304,7 +304,7 @@ mca_btl_mx_prepare_src( struct mca_btl_base_module_t* btl, mca_btl_base_descriptor_t* mca_btl_mx_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -322,7 +322,7 @@ mca_btl_base_descriptor_t* mca_btl_mx_prepare_dst( struct mca_btl_base_module_t* } frag->segment[0].seg_len = *size; - ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segment[0].seg_addr.pval) ); + opal_convertor_get_current_pointer( convertor, (void**)&(frag->segment[0].seg_addr.pval) ); frag->segment[0].seg_key.key64 = (uint64_t)(intptr_t)frag; mx_segment.segment_ptr = frag->segment[0].seg_addr.pval; @@ -414,7 +414,7 @@ static int mca_btl_mx_put( struct mca_btl_base_module_t* btl, */ static int mca_btl_mx_sendi( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, void* header, size_t header_size, size_t payload_size, @@ -435,7 +435,7 @@ static int mca_btl_mx_sendi( struct mca_btl_base_module_t* btl, return OMPI_ERROR; } - if( !ompi_convertor_need_buffers(convertor) ) { + if( !opal_convertor_need_buffers(convertor) ) { uint32_t mx_segment_count = 0; uint64_t tag64 = 0x01ULL | (((uint64_t)tag) << 8); mx_return_t mx_return; @@ -455,7 +455,7 @@ static int mca_btl_mx_sendi( struct mca_btl_base_module_t* btl, iov.iov_base = NULL; iov.iov_len = payload_size; - (void)ompi_convertor_pack( convertor, &iov, &iov_count, &max_data ); + (void)opal_convertor_pack( convertor, &iov, &iov_count, &max_data ); assert( max_data == payload_size ); mx_segment->segment_ptr = iov.iov_base; diff --git a/ompi/mca/btl/mx/btl_mx.h b/ompi/mca/btl/mx/btl_mx.h index 083b9cec56..782e544880 100644 --- a/ompi/mca/btl/mx/btl_mx.h +++ b/ompi/mca/btl/mx/btl_mx.h @@ -285,7 +285,7 @@ mca_btl_base_descriptor_t* mca_btl_mx_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -295,7 +295,7 @@ mca_btl_base_descriptor_t* mca_btl_mx_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, diff --git a/ompi/mca/btl/ofud/btl_ofud.c b/ompi/mca/btl/ofud/btl_ofud.c index c2dc334ce9..1cc0089519 100644 --- a/ompi/mca/btl/ofud/btl_ofud.c +++ b/ompi/mca/btl/ofud/btl_ofud.c @@ -26,7 +26,7 @@ #include "opal/class/opal_bitmap.h" #include "opal/prefetch.h" #include "opal/util/output.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/btl/btl.h" #include "ompi/mca/btl/base/btl_base_error.h" #include "ompi/mca/mpool/base/base.h" @@ -278,7 +278,7 @@ mca_btl_base_descriptor_t* mca_btl_ud_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -290,7 +290,7 @@ mca_btl_base_descriptor_t* mca_btl_ud_prepare_src( size_t max_data = *size; int rc; - if(ompi_convertor_need_buffers(convertor) == 0 && reserve == 0 && + if(opal_convertor_need_buffers(convertor) == 0 && reserve == 0 && (registration != NULL || max_data > btl->btl_max_send_size)) { /* The user buffer is contigous and we are asked to send more than the max send size. */ @@ -303,7 +303,7 @@ mca_btl_base_descriptor_t* mca_btl_ud_prepare_src( iov.iov_len = max_data; iov.iov_base = NULL; - ompi_convertor_pack(convertor, &iov, &iov_count, &max_data); + opal_convertor_pack(convertor, &iov, &iov_count, &max_data); frag->segment.seg_len = max_data; frag->segment.seg_addr.pval = iov.iov_base; @@ -344,7 +344,7 @@ mca_btl_base_descriptor_t* mca_btl_ud_prepare_src( iov.iov_len = max_data; iov.iov_base = (unsigned char*)frag->segment.seg_addr.pval + reserve; - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data); if(OPAL_UNLIKELY(rc < 0)) { MCA_BTL_UD_RETURN_FRAG(btl, frag); return NULL; diff --git a/ompi/mca/btl/ofud/btl_ofud.h b/ompi/mca/btl/ofud/btl_ofud.h index 6ba4c7b9b4..2d4d0203c4 100644 --- a/ompi/mca/btl/ofud/btl_ofud.h +++ b/ompi/mca/btl/ofud/btl_ofud.h @@ -312,7 +312,7 @@ mca_btl_base_descriptor_t* mca_btl_ud_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, diff --git a/ompi/mca/btl/openib/btl_openib.c b/ompi/mca/btl/openib/btl_openib.c index 35f1a541bf..36f2df0af2 100644 --- a/ompi/mca/btl/openib/btl_openib.c +++ b/ompi/mca/btl/openib/btl_openib.c @@ -44,7 +44,7 @@ #include "btl_openib_proc.h" #include "btl_openib_endpoint.h" #include "btl_openib_xrc.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mpool/base/base.h" #include "ompi/mca/mpool/mpool.h" #include "ompi/mca/mpool/rdma/mpool_rdma.h" @@ -782,7 +782,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -798,7 +798,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src( openib_btl = (mca_btl_openib_module_t*)btl; - if(ompi_convertor_need_buffers(convertor) == false && 0 == reserve) { + if(opal_convertor_need_buffers(convertor) == false && 0 == reserve) { /* GMS bloody HACK! */ if(registration != NULL || max_data > btl->btl_max_send_size) { frag = alloc_send_user_frag(); @@ -809,7 +809,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src( iov.iov_len = max_data; iov.iov_base = NULL; - ompi_convertor_pack(convertor, &iov, &iov_count, &max_data); + opal_convertor_pack(convertor, &iov, &iov_count, &max_data); *size = max_data; @@ -866,7 +866,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src( iov.iov_len = max_data; iov.iov_base = (unsigned char*)to_base_frag(frag)->segment.seg_addr.pval + reserve; - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data); *size = max_data; @@ -894,7 +894,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -913,7 +913,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_dst( return NULL; } - ompi_convertor_get_current_pointer(convertor, &buffer); + opal_convertor_get_current_pointer(convertor, &buffer); if(NULL == registration){ /* we didn't get a memory registration passed in, so we have to @@ -1063,7 +1063,7 @@ int mca_btl_openib_finalize(struct mca_btl_base_module_t* btl) */ int mca_btl_openib_sendi( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* ep, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, void* header, size_t header_size, size_t payload_size, @@ -1156,7 +1156,7 @@ int mca_btl_openib_sendi( struct mca_btl_base_module_t* btl, iov.iov_len = max_data = payload_size; iov_count = 1; - (void)ompi_convertor_pack( convertor, &iov, &iov_count, &max_data); + (void)opal_convertor_pack( convertor, &iov, &iov_count, &max_data); assert(max_data == payload_size); } diff --git a/ompi/mca/btl/openib/btl_openib.h b/ompi/mca/btl/openib/btl_openib.h index 8dc6cf9421..de05938172 100644 --- a/ompi/mca/btl/openib/btl_openib.h +++ b/ompi/mca/btl/openib/btl_openib.h @@ -503,7 +503,7 @@ extern int mca_btl_openib_send( */ extern int mca_btl_openib_sendi( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* ep, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, void* header, size_t header_size, size_t payload_size, @@ -576,7 +576,7 @@ mca_btl_base_descriptor_t* mca_btl_openib_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -593,7 +593,7 @@ extern mca_btl_base_descriptor_t* mca_btl_openib_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, diff --git a/ompi/mca/btl/pcie/btl_pcie.c b/ompi/mca/btl/pcie/btl_pcie.c index 306f584597..07b178ceb2 100644 --- a/ompi/mca/btl/pcie/btl_pcie.c +++ b/ompi/mca/btl/pcie/btl_pcie.c @@ -360,7 +360,7 @@ mca_btl_base_descriptor_t* mca_btl_pcie_prepare_dst( if(NULL == frag) { return NULL; } - ompi_ddt_type_lb(convertor->pDesc, &lb); + ompi_datatype_type_lb(convertor->pDesc, &lb); frag->segment.seg_addr.pval = convertor->pBaseBuf + lb + convertor->bConverted; if(NULL == registration) { diff --git a/ompi/mca/btl/portals/btl_portals.c b/ompi/mca/btl/portals/btl_portals.c index ebc94621dd..1ef111e54f 100644 --- a/ompi/mca/btl/portals/btl_portals.c +++ b/ompi/mca/btl/portals/btl_portals.c @@ -28,7 +28,7 @@ #include "opal/class/opal_bitmap.h" #include "ompi/constants.h" #include "ompi/mca/btl/btl.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "btl_portals.h" #include "btl_portals_endpoint.h" @@ -295,7 +295,7 @@ mca_btl_base_descriptor_t* mca_btl_portals_prepare_src(struct mca_btl_base_module_t* btl_base, struct mca_btl_base_endpoint_t* peer, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -309,7 +309,7 @@ mca_btl_portals_prepare_src(struct mca_btl_base_module_t* btl_base, assert(&mca_btl_portals_module == (mca_btl_portals_module_t*) btl_base); - if (0 != reserve || 0 != ompi_convertor_need_buffers(convertor)) { + if (0 != reserve || 0 != opal_convertor_need_buffers(convertor)) { frag = (mca_btl_portals_frag_t*) mca_btl_portals_alloc(btl_base, peer, MCA_BTL_NO_ORDER, max_data + reserve, flags); if (NULL == frag) { @@ -322,7 +322,7 @@ mca_btl_portals_prepare_src(struct mca_btl_base_module_t* btl_base, iov.iov_len = max_data; iov.iov_base = (unsigned char*) frag->segments[0].seg_addr.pval + reserve; - ret = ompi_convertor_pack(convertor, &iov, &iov_count, + ret = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); *size = max_data; if ( ret < 0 ) { @@ -352,7 +352,7 @@ mca_btl_portals_prepare_src(struct mca_btl_base_module_t* btl_base, iov.iov_len = max_data; iov.iov_base = NULL; - ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); frag->segments[0].seg_len = max_data; frag->segments[0].seg_addr.pval = iov.iov_base; @@ -420,7 +420,7 @@ mca_btl_base_descriptor_t* mca_btl_portals_prepare_dst(struct mca_btl_base_module_t* btl_base, struct mca_btl_base_endpoint_t* peer, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -447,7 +447,7 @@ mca_btl_portals_prepare_dst(struct mca_btl_base_module_t* btl_base, } frag->segments[0].seg_len = *size; - ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segments[0].seg_addr.pval) ); + opal_convertor_get_current_pointer( convertor, (void**)&(frag->segments[0].seg_addr.pval) ); frag->segments[0].seg_key.key64 = OPAL_THREAD_ADD64(&(mca_btl_portals_module.portals_rdma_key), 1); frag->base.des_src = NULL; diff --git a/ompi/mca/btl/portals/btl_portals.h b/ompi/mca/btl/portals/btl_portals.h index fbdb469115..c966637d06 100644 --- a/ompi/mca/btl/portals/btl_portals.h +++ b/ompi/mca/btl/portals/btl_portals.h @@ -182,7 +182,7 @@ mca_btl_base_descriptor_t* mca_btl_portals_prepare_src(struct mca_btl_base_module_t* btl_base, struct mca_btl_base_endpoint_t* peer, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -192,7 +192,7 @@ mca_btl_base_descriptor_t* mca_btl_portals_prepare_dst(struct mca_btl_base_module_t* btl_base, struct mca_btl_base_endpoint_t* peer, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -206,7 +206,7 @@ int mca_btl_portals_send(struct mca_btl_base_module_t* btl_base, int mca_btl_portals_sendi(struct mca_btl_base_module_t* btl_base, struct mca_btl_base_endpoint_t* endpoint, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, void* header, size_t header_size, size_t payload_size, diff --git a/ompi/mca/btl/portals/btl_portals_send.c b/ompi/mca/btl/portals/btl_portals_send.c index a24dbca2b6..7ad85085fc 100644 --- a/ompi/mca/btl/portals/btl_portals_send.c +++ b/ompi/mca/btl/portals/btl_portals_send.c @@ -23,7 +23,7 @@ #include #include "ompi/constants.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "btl_portals.h" #include "btl_portals_send.h" @@ -118,7 +118,7 @@ mca_btl_portals_send(struct mca_btl_base_module_t* btl_base, int mca_btl_portals_sendi(struct mca_btl_base_module_t* btl_base, struct mca_btl_base_endpoint_t* endpoint, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, void* header, size_t header_size, size_t payload_size, @@ -177,7 +177,7 @@ int mca_btl_portals_sendi(struct mca_btl_base_module_t* btl_base, iov.iov_len = max_data = payload_size; iov_count = 1; - (void)ompi_convertor_pack( convertor, + (void)opal_convertor_pack( convertor, &iov, &iov_count, &max_data); assert(max_data == payload_size); diff --git a/ompi/mca/btl/sctp/btl_sctp.c b/ompi/mca/btl/sctp/btl_sctp.c index cafca7f290..4a8a7e2c0f 100644 --- a/ompi/mca/btl/sctp/btl_sctp.c +++ b/ompi/mca/btl/sctp/btl_sctp.c @@ -25,7 +25,7 @@ #include "btl_sctp_frag.h" #include "btl_sctp_proc.h" #include "btl_sctp_endpoint.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mpool/base/base.h" #include "ompi/mca/mpool/mpool.h" #include "ompi/proc/proc.h" @@ -220,7 +220,7 @@ mca_btl_base_descriptor_t* mca_btl_sctp_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -258,7 +258,7 @@ mca_btl_base_descriptor_t* mca_btl_sctp_prepare_src( frag->segments[0].seg_len = reserve; frag->base.des_src_cnt = 1; - } else if(ompi_convertor_need_buffers(convertor)) { + } else if(opal_convertor_need_buffers(convertor)) { if (max_data + reserve > frag->size) { max_data = frag->size - reserve; @@ -266,7 +266,7 @@ mca_btl_base_descriptor_t* mca_btl_sctp_prepare_src( iov.iov_len = max_data; iov.iov_base = (IOVBASE_TYPE*)(((unsigned char*)(frag+1)) + reserve); - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); if( rc < 0 ) { mca_btl_sctp_free(btl, &frag->base); return NULL; @@ -281,7 +281,7 @@ mca_btl_base_descriptor_t* mca_btl_sctp_prepare_src( iov.iov_len = max_data; iov.iov_base = NULL; - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); if( rc < 0 ) { mca_btl_sctp_free(btl, &frag->base); return NULL; @@ -321,7 +321,7 @@ mca_btl_base_descriptor_t* mca_btl_sctp_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -336,7 +336,7 @@ mca_btl_base_descriptor_t* mca_btl_sctp_prepare_dst( return NULL; } - ompi_ddt_type_lb(convertor->pDesc, &lb); + ompi_datatype_type_lb(convertor->pDesc, &lb); frag->segments->seg_len = *size; frag->segments->seg_addr.pval = convertor->pBaseBuf + lb + convertor->bConverted; diff --git a/ompi/mca/btl/sctp/btl_sctp.h b/ompi/mca/btl/sctp/btl_sctp.h index 81d3f6cd5b..a2586e4ba0 100644 --- a/ompi/mca/btl/sctp/btl_sctp.h +++ b/ompi/mca/btl/sctp/btl_sctp.h @@ -308,7 +308,7 @@ mca_btl_base_descriptor_t* mca_btl_sctp_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -319,7 +319,7 @@ extern mca_btl_base_descriptor_t* mca_btl_sctp_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, diff --git a/ompi/mca/btl/self/btl_self.c b/ompi/mca/btl/self/btl_self.c index 63e9493cc4..d721033ee6 100644 --- a/ompi/mca/btl/self/btl_self.c +++ b/ompi/mca/btl/self/btl_self.c @@ -26,7 +26,7 @@ #include #include "opal/class/opal_bitmap.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "opal/sys/atomic.h" #include "ompi/mca/btl/btl.h" #include "ompi/mca/mpool/base/base.h" @@ -178,7 +178,7 @@ struct mca_btl_base_descriptor_t* mca_btl_self_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -191,7 +191,7 @@ mca_btl_self_prepare_src( struct mca_btl_base_module_t* btl, int rc; /* non-contigous data */ - if( ompi_convertor_need_buffers(convertor) || + if( opal_convertor_need_buffers(convertor) || max_data < mca_btl_self.btl_max_send_size || reserve != 0 ) { @@ -206,7 +206,7 @@ mca_btl_self_prepare_src( struct mca_btl_base_module_t* btl, iov.iov_len = max_data; iov.iov_base = (IOVBASE_TYPE*)((unsigned char*)(frag+1) + reserve); - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); if(rc < 0) { MCA_BTL_SELF_FRAG_RETURN_SEND(frag); return NULL; @@ -223,7 +223,7 @@ mca_btl_self_prepare_src( struct mca_btl_base_module_t* btl, iov.iov_base = NULL; /* convertor should return offset into users buffer */ - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); if(rc < 0) { MCA_BTL_SELF_FRAG_RETURN_RDMA(frag); return NULL; @@ -246,7 +246,7 @@ struct mca_btl_base_descriptor_t* mca_btl_self_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -262,7 +262,7 @@ mca_btl_self_prepare_dst( struct mca_btl_base_module_t* btl, } /* setup descriptor to point directly to user buffer */ - ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); + opal_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); frag->segment.seg_len = reserve + max_data; frag->segment.seg_key.key64 = (uint64_t)(intptr_t)convertor; frag->base.des_dst = &frag->segment; diff --git a/ompi/mca/btl/self/btl_self.h b/ompi/mca/btl/self/btl_self.h index 69e7976c84..84bcaaa17d 100644 --- a/ompi/mca/btl/self/btl_self.h +++ b/ompi/mca/btl/self/btl_self.h @@ -168,7 +168,7 @@ struct mca_btl_base_descriptor_t* mca_btl_self_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -185,7 +185,7 @@ struct mca_btl_base_descriptor_t* mca_btl_self_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, diff --git a/ompi/mca/btl/sm/btl_sm.c b/ompi/mca/btl/sm/btl_sm.c index c1eaf00b8a..4c94b786de 100644 --- a/ompi/mca/btl/sm/btl_sm.c +++ b/ompi/mca/btl/sm/btl_sm.c @@ -35,7 +35,7 @@ #include "opal/mca/paffinity/base/base.h" #include "opal/mca/maffinity/base/base.h" #include "orte/util/proc_info.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/class/ompi_free_list.h" #include "ompi/mca/btl/btl.h" #include "ompi/mca/mpool/base/base.h" @@ -638,7 +638,7 @@ struct mca_btl_base_descriptor_t* mca_btl_sm_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -667,7 +667,7 @@ struct mca_btl_base_descriptor_t* mca_btl_sm_prepare_src( (IOVBASE_TYPE*)(((unsigned char*)(frag->segment.seg_addr.pval)) + reserve); - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); if(rc < 0) { MCA_BTL_SM_FRAG_RETURN(frag); return NULL; @@ -718,7 +718,7 @@ struct mca_btl_base_descriptor_t* mca_btl_sm_prepare_src( */ int mca_btl_sm_sendi( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, void* header, size_t header_size, size_t payload_size, @@ -770,7 +770,7 @@ int mca_btl_sm_sendi( struct mca_btl_base_module_t* btl, iov.iov_len = max_data = payload_size; iov_count = 1; - (void)ompi_convertor_pack( convertor, &iov, &iov_count, &max_data); + (void)opal_convertor_pack( convertor, &iov, &iov_count, &max_data); assert(max_data == payload_size); } diff --git a/ompi/mca/btl/sm/btl_sm.h b/ompi/mca/btl/sm/btl_sm.h index 1d2b4de50c..eb43d1f0be 100644 --- a/ompi/mca/btl/sm/btl_sm.h +++ b/ompi/mca/btl/sm/btl_sm.h @@ -427,7 +427,7 @@ struct mca_btl_base_descriptor_t* mca_btl_sm_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -443,7 +443,7 @@ struct mca_btl_base_descriptor_t* mca_btl_sm_prepare_src( */ extern int mca_btl_sm_sendi( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, void* header, size_t header_size, size_t payload_size, diff --git a/ompi/mca/btl/tcp/btl_tcp.c b/ompi/mca/btl/tcp/btl_tcp.c index 91bcee6f75..4f21bbd39a 100644 --- a/ompi/mca/btl/tcp/btl_tcp.c +++ b/ompi/mca/btl/tcp/btl_tcp.c @@ -28,7 +28,7 @@ #include "btl_tcp_frag.h" #include "btl_tcp_proc.h" #include "btl_tcp_endpoint.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mpool/base/base.h" #include "ompi/mca/mpool/mpool.h" #include "ompi/proc/proc.h" @@ -222,7 +222,7 @@ mca_btl_base_descriptor_t* mca_btl_tcp_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -258,7 +258,7 @@ mca_btl_base_descriptor_t* mca_btl_tcp_prepare_src( frag->segments[0].seg_len = reserve; frag->base.des_src_cnt = 1; - if(ompi_convertor_need_buffers(convertor)) { + if(opal_convertor_need_buffers(convertor)) { if (max_data + reserve > frag->size) { max_data = frag->size - reserve; @@ -266,7 +266,7 @@ mca_btl_base_descriptor_t* mca_btl_tcp_prepare_src( iov.iov_len = max_data; iov.iov_base = (IOVBASE_TYPE*)(((unsigned char*)(frag->segments[0].seg_addr.pval)) + reserve); - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); if( OPAL_UNLIKELY(rc < 0) ) { mca_btl_tcp_free(btl, &frag->base); return NULL; @@ -279,7 +279,7 @@ mca_btl_base_descriptor_t* mca_btl_tcp_prepare_src( iov.iov_len = max_data; iov.iov_base = NULL; - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); if( OPAL_UNLIKELY(rc < 0) ) { mca_btl_tcp_free(btl, &frag->base); return NULL; @@ -318,7 +318,7 @@ mca_btl_base_descriptor_t* mca_btl_tcp_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -336,7 +336,7 @@ mca_btl_base_descriptor_t* mca_btl_tcp_prepare_dst( } frag->segments->seg_len = *size; - ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segments->seg_addr.pval) ); + opal_convertor_get_current_pointer( convertor, (void**)&(frag->segments->seg_addr.pval) ); frag->base.des_src = NULL; frag->base.des_src_cnt = 0; diff --git a/ompi/mca/btl/tcp/btl_tcp.h b/ompi/mca/btl/tcp/btl_tcp.h index 0c64ee82ba..5eca3a10ea 100644 --- a/ompi/mca/btl/tcp/btl_tcp.h +++ b/ompi/mca/btl/tcp/btl_tcp.h @@ -310,7 +310,7 @@ mca_btl_base_descriptor_t* mca_btl_tcp_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -321,7 +321,7 @@ extern mca_btl_base_descriptor_t* mca_btl_tcp_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, diff --git a/ompi/mca/btl/template/btl_template.c b/ompi/mca/btl/template/btl_template.c index ec31778527..07f2b29135 100644 --- a/ompi/mca/btl/template/btl_template.c +++ b/ompi/mca/btl/template/btl_template.c @@ -25,7 +25,7 @@ #include "btl_template_frag.h" #include "btl_template_proc.h" #include "btl_template_endpoint.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mpool/base/base.h" #include "ompi/mca/mpool/mpool.h" @@ -220,7 +220,7 @@ mca_btl_base_descriptor_t* mca_btl_template_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -248,7 +248,7 @@ mca_btl_base_descriptor_t* mca_btl_template_prepare_src( iov.iov_len = max_data; iov.iov_base = (unsigned char*) frag->segment.seg_addr.pval + reserve; - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); *size = max_data; if( rc < 0 ) { MCA_BTL_TEMPLATE_FRAG_RETURN_EAGER(btl, frag); @@ -273,7 +273,7 @@ mca_btl_base_descriptor_t* mca_btl_template_prepare_src( iov.iov_len = max_data; iov.iov_base = (unsigned char*) frag->segment.seg_addr.pval + reserve; - rc = ompi_convertor_pack(convertor, &iov, &iov_count, &max_data ); + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); *size = max_data; if( rc < 0 ) { @@ -310,7 +310,7 @@ mca_btl_base_descriptor_t* mca_btl_template_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -325,7 +325,7 @@ mca_btl_base_descriptor_t* mca_btl_template_prepare_dst( } frag->segment.seg_len = *size; - ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); + opal_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); frag->base.des_src = NULL; frag->base.des_src_cnt = 0; diff --git a/ompi/mca/btl/template/btl_template.h b/ompi/mca/btl/template/btl_template.h index 805610b5af..758de4a5fd 100644 --- a/ompi/mca/btl/template/btl_template.h +++ b/ompi/mca/btl/template/btl_template.h @@ -289,7 +289,7 @@ mca_btl_base_descriptor_t* mca_btl_template_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -300,7 +300,7 @@ extern mca_btl_base_descriptor_t* mca_btl_template_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, diff --git a/ompi/mca/btl/udapl/btl_udapl.c b/ompi/mca/btl/udapl/btl_udapl.c index e7da5b9628..61d78c876c 100644 --- a/ompi/mca/btl/udapl/btl_udapl.c +++ b/ompi/mca/btl/udapl/btl_udapl.c @@ -33,7 +33,7 @@ #include "btl_udapl_frag.h" #include "btl_udapl_mca.h" #include "btl_udapl_proc.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mpool/base/base.h" #include "ompi/mca/mpool/rdma/mpool_rdma.h" #include "ompi/mca/btl/base/btl_base_error.h" @@ -1020,7 +1020,7 @@ mca_btl_base_descriptor_t* mca_btl_udapl_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -1038,7 +1038,7 @@ mca_btl_base_descriptor_t* mca_btl_udapl_prepare_src( MCA_BTL_UDAPL_FRAG_CALC_ALIGNMENT_PAD(pad, (max_data + reserve + sizeof(mca_btl_udapl_footer_t))); - if(ompi_convertor_need_buffers(convertor) == false && 0 == reserve) { + if(opal_convertor_need_buffers(convertor) == false && 0 == reserve) { if(registration != NULL || max_data > btl->btl_max_send_size) { MCA_BTL_UDAPL_FRAG_ALLOC_USER(btl, frag, rc); @@ -1049,7 +1049,7 @@ mca_btl_base_descriptor_t* mca_btl_udapl_prepare_src( iov.iov_len = max_data; iov.iov_base = NULL; - ompi_convertor_pack(convertor, &iov, + opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); *size = max_data; @@ -1106,7 +1106,7 @@ mca_btl_base_descriptor_t* mca_btl_udapl_prepare_src( iov.iov_len = max_data; iov.iov_base = (char *) frag->segment.seg_addr.pval + reserve; - rc = ompi_convertor_pack(convertor, + rc = opal_convertor_pack(convertor, &iov, &iov_count, &max_data ); if(rc < 0) { MCA_BTL_UDAPL_FRAG_RETURN_MAX(btl, frag); @@ -1150,7 +1150,7 @@ mca_btl_base_descriptor_t* mca_btl_udapl_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, struct mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -1165,7 +1165,7 @@ mca_btl_base_descriptor_t* mca_btl_udapl_prepare_dst( } frag->segment.seg_len = *size; - ompi_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); + opal_convertor_get_current_pointer( convertor, (void**)&(frag->segment.seg_addr.pval) ); if(NULL == registration) { /* didn't get a memory registration passed in, so must diff --git a/ompi/mca/btl/udapl/btl_udapl.h b/ompi/mca/btl/udapl/btl_udapl.h index 458e0284b3..c8d8788fa9 100644 --- a/ompi/mca/btl/udapl/btl_udapl.h +++ b/ompi/mca/btl/udapl/btl_udapl.h @@ -443,7 +443,7 @@ mca_btl_base_descriptor_t* mca_btl_udapl_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, @@ -454,7 +454,7 @@ extern mca_btl_base_descriptor_t* mca_btl_udapl_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* peer, struct mca_mpool_base_registration_t*, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, uint8_t order, size_t reserve, size_t* size, diff --git a/ompi/mca/coll/basic/coll_basic_allgather.c b/ompi/mca/coll/basic/coll_basic_allgather.c index 1043c3d4b5..f85904f8a9 100644 --- a/ompi/mca/coll/basic/coll_basic_allgather.c +++ b/ompi/mca/coll/basic/coll_basic_allgather.c @@ -23,7 +23,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/pml/pml.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -53,7 +53,7 @@ mca_coll_basic_allgather_intra(void *sbuf, int scount, as sbuf and avoid using a temporary buffer if gather is implemented correctly */ if (MPI_IN_PLACE == sbuf && 0 != ompi_comm_rank(comm)) { - ompi_ddt_get_extent(rdtype, &lb, &extent); + ompi_datatype_get_extent(rdtype, &lb, &extent); sbuf = ((char*) rbuf) + (ompi_comm_rank(comm) * extent * rcount); sdtype = rdtype; scount = rcount; @@ -118,11 +118,11 @@ mca_coll_basic_allgather_inter(void *sbuf, int scount, } } else { /* receive a msg. from all other procs. */ - err = ompi_ddt_get_extent(rdtype, &rlb, &rextent); + err = ompi_datatype_get_extent(rdtype, &rlb, &rextent); if (OMPI_SUCCESS != err) { return err; } - err = ompi_ddt_get_extent(sdtype, &slb, &sextent); + err = ompi_datatype_get_extent(sdtype, &slb, &sextent); if (OMPI_SUCCESS != err) { return err; } diff --git a/ompi/mca/coll/basic/coll_basic_allgatherv.c b/ompi/mca/coll/basic/coll_basic_allgatherv.c index 7dcd73589e..284953b0a9 100644 --- a/ompi/mca/coll/basic/coll_basic_allgatherv.c +++ b/ompi/mca/coll/basic/coll_basic_allgatherv.c @@ -20,7 +20,7 @@ #include "coll_basic.h" #include "mpi.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/constants.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -57,7 +57,7 @@ mca_coll_basic_allgatherv_intra(void *sbuf, int scount, */ if (MPI_IN_PLACE == sbuf) { - ompi_ddt_get_extent(rdtype, &lb, &extent); + ompi_datatype_get_extent(rdtype, &lb, &extent); send_type = rdtype; send_buf = (char*)rbuf; for (i = 0; i < rank; ++i) { @@ -89,12 +89,12 @@ mca_coll_basic_allgatherv_intra(void *sbuf, int scount, * datatype. */ - err = ompi_ddt_create_indexed(size,rcounts,disps,rdtype,&newtype); + err = ompi_datatype_create_indexed(size,rcounts,disps,rdtype,&newtype); if (MPI_SUCCESS != err) { return err; } - err = ompi_ddt_commit(&newtype); + err = ompi_datatype_commit(&newtype); if(MPI_SUCCESS != err) { return err; } @@ -102,7 +102,7 @@ mca_coll_basic_allgatherv_intra(void *sbuf, int scount, comm->c_coll.coll_bcast( rbuf, 1 ,newtype,0,comm, comm->c_coll.coll_bcast_module); - ompi_ddt_destroy (&newtype); + ompi_datatype_destroy (&newtype); return MPI_SUCCESS; } diff --git a/ompi/mca/coll/basic/coll_basic_allreduce.c b/ompi/mca/coll/basic/coll_basic_allreduce.c index df34ca2e7c..9dc665124e 100644 --- a/ompi/mca/coll/basic/coll_basic_allreduce.c +++ b/ompi/mca/coll/basic/coll_basic_allreduce.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -98,7 +98,7 @@ mca_coll_basic_allreduce_inter(void *sbuf, void *rbuf, int count, * simultaniously. */ /*****************************************************************/ if (rank == root) { - err = ompi_ddt_get_extent(dtype, &lb, &extent); + err = ompi_datatype_get_extent(dtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/basic/coll_basic_alltoall.c b/ompi/mca/coll/basic/coll_basic_alltoall.c index 46505518b3..db0af67994 100644 --- a/ompi/mca/coll/basic/coll_basic_alltoall.c +++ b/ompi/mca/coll/basic/coll_basic_alltoall.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -63,13 +63,13 @@ mca_coll_basic_alltoall_intra(void *sbuf, int scount, size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); - err = ompi_ddt_get_extent(sdtype, &lb, &sndinc); + err = ompi_datatype_get_extent(sdtype, &lb, &sndinc); if (OMPI_SUCCESS != err) { return err; } sndinc *= scount; - err = ompi_ddt_get_extent(rdtype, &lb, &rcvinc); + err = ompi_datatype_get_extent(rdtype, &lb, &rcvinc); if (OMPI_SUCCESS != err) { return err; } @@ -80,7 +80,7 @@ mca_coll_basic_alltoall_intra(void *sbuf, int scount, psnd = ((char *) sbuf) + (rank * sndinc); prcv = ((char *) rbuf) + (rank * rcvinc); - err = ompi_ddt_sndrcv(psnd, scount, sdtype, prcv, rcount, rdtype); + err = ompi_datatype_sndrcv(psnd, scount, sdtype, prcv, rcount, rdtype); if (MPI_SUCCESS != err) { return err; } @@ -185,13 +185,13 @@ mca_coll_basic_alltoall_inter(void *sbuf, int scount, size = ompi_comm_remote_size(comm); - err = ompi_ddt_get_extent(sdtype, &lb, &sndinc); + err = ompi_datatype_get_extent(sdtype, &lb, &sndinc); if (OMPI_SUCCESS != err) { return err; } sndinc *= scount; - err = ompi_ddt_get_extent(rdtype, &lb, &rcvinc); + err = ompi_datatype_get_extent(rdtype, &lb, &rcvinc); if (OMPI_SUCCESS != err) { return err; } diff --git a/ompi/mca/coll/basic/coll_basic_alltoallv.c b/ompi/mca/coll/basic/coll_basic_alltoallv.c index 47475a78f2..0abe9b0042 100644 --- a/ompi/mca/coll/basic/coll_basic_alltoallv.c +++ b/ompi/mca/coll/basic/coll_basic_alltoallv.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -60,8 +60,8 @@ mca_coll_basic_alltoallv_intra(void *sbuf, int *scounts, int *sdisps, size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); - ompi_ddt_type_extent(sdtype, &sndextent); - ompi_ddt_type_extent(rdtype, &rcvextent); + ompi_datatype_type_extent(sdtype, &sndextent); + ompi_datatype_type_extent(rdtype, &rcvextent); /* simple optimization */ @@ -69,7 +69,7 @@ mca_coll_basic_alltoallv_intra(void *sbuf, int *scounts, int *sdisps, prcv = ((char *) rbuf) + (rdisps[rank] * rcvextent); if (0 != scounts[rank]) { - err = ompi_ddt_sndrcv(psnd, scounts[rank], sdtype, + err = ompi_datatype_sndrcv(psnd, scounts[rank], sdtype, prcv, rcounts[rank], rdtype); if (MPI_SUCCESS != err) { return err; @@ -179,8 +179,8 @@ mca_coll_basic_alltoallv_inter(void *sbuf, int *scounts, int *sdisps, rsize = ompi_comm_remote_size(comm); - ompi_ddt_type_extent(sdtype, &sndextent); - ompi_ddt_type_extent(rdtype, &rcvextent); + ompi_datatype_type_extent(sdtype, &sndextent); + ompi_datatype_type_extent(rdtype, &rcvextent); /* Initiate all send/recv to/from others. */ nreqs = rsize * 2; diff --git a/ompi/mca/coll/basic/coll_basic_alltoallw.c b/ompi/mca/coll/basic/coll_basic_alltoallw.c index 22313474a1..2b913c8550 100644 --- a/ompi/mca/coll/basic/coll_basic_alltoallw.c +++ b/ompi/mca/coll/basic/coll_basic_alltoallw.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -63,7 +63,7 @@ mca_coll_basic_alltoallw_intra(void *sbuf, int *scounts, int *sdisps, prcv = ((char *) rbuf) + rdisps[rank]; if (0 != scounts[rank]) { - err = ompi_ddt_sndrcv(psnd, scounts[rank], sdtypes[rank], + err = ompi_datatype_sndrcv(psnd, scounts[rank], sdtypes[rank], prcv, rcounts[rank], rdtypes[rank]); if (MPI_SUCCESS != err) { return err; diff --git a/ompi/mca/coll/basic/coll_basic_bcast.c b/ompi/mca/coll/basic/coll_basic_bcast.c index 56831084c9..2ea5c307c5 100644 --- a/ompi/mca/coll/basic/coll_basic_bcast.c +++ b/ompi/mca/coll/basic/coll_basic_bcast.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "coll_basic.h" diff --git a/ompi/mca/coll/basic/coll_basic_exscan.c b/ompi/mca/coll/basic/coll_basic_exscan.c index 6862f112fe..70ab9d1189 100644 --- a/ompi/mca/coll/basic/coll_basic_exscan.c +++ b/ompi/mca/coll/basic/coll_basic_exscan.c @@ -24,7 +24,7 @@ #include "mpi.h" #include "ompi/constants.h" #include "ompi/op/op.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/pml/pml.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -88,8 +88,8 @@ mca_coll_basic_exscan_intra(void *sbuf, void *rbuf, int count, /* Get a temporary buffer to perform the reduction into. Rationale * for malloc'ing this size is provided in coll_basic_reduce.c. */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); free_buffer = (char*)malloc(true_extent + (count - 1) * extent); if (NULL == free_buffer) { @@ -102,7 +102,7 @@ mca_coll_basic_exscan_intra(void *sbuf, void *rbuf, int count, /* If we're commutative, we can copy my sbuf into the reduction * buffer before the receive completes */ - err = ompi_ddt_copy_content_same_ddt(dtype, count, + err = ompi_datatype_copy_content_same_ddt(dtype, count, reduce_buffer, (char*)sbuf); if (MPI_SUCCESS != err) { goto error; @@ -133,7 +133,7 @@ mca_coll_basic_exscan_intra(void *sbuf, void *rbuf, int count, goto error; } - err = ompi_ddt_copy_content_same_ddt(dtype, count, + err = ompi_datatype_copy_content_same_ddt(dtype, count, reduce_buffer, (char*)rbuf); if (MPI_SUCCESS != err) { goto error; diff --git a/ompi/mca/coll/basic/coll_basic_gather.c b/ompi/mca/coll/basic/coll_basic_gather.c index 99a6da9e39..cccd7ce0b7 100644 --- a/ompi/mca/coll/basic/coll_basic_gather.c +++ b/ompi/mca/coll/basic/coll_basic_gather.c @@ -22,7 +22,7 @@ #include "mpi.h" #include "ompi/constants.h" #include "coll_basic.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -64,12 +64,12 @@ mca_coll_basic_gather_intra(void *sbuf, int scount, /* I am the root, loop receiving the data. */ - ompi_ddt_get_extent(rdtype, &lb, &extent); + ompi_datatype_get_extent(rdtype, &lb, &extent); incr = extent * rcount; for (i = 0, ptmp = (char *) rbuf; i < size; ++i, ptmp += incr) { if (i == rank) { if (MPI_IN_PLACE != sbuf) { - err = ompi_ddt_sndrcv(sbuf, scount, sdtype, + err = ompi_datatype_sndrcv(sbuf, scount, sdtype, ptmp, rcount, rdtype); } else { err = MPI_SUCCESS; @@ -125,7 +125,7 @@ mca_coll_basic_gather_inter(void *sbuf, int scount, MCA_PML_BASE_SEND_STANDARD, comm)); } else { /* I am the root, loop receiving the data. */ - err = ompi_ddt_get_extent(rdtype, &lb, &extent); + err = ompi_datatype_get_extent(rdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/basic/coll_basic_gatherv.c b/ompi/mca/coll/basic/coll_basic_gatherv.c index 0d64a1a151..df1489e91c 100644 --- a/ompi/mca/coll/basic/coll_basic_gatherv.c +++ b/ompi/mca/coll/basic/coll_basic_gatherv.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -66,7 +66,7 @@ mca_coll_basic_gatherv_intra(void *sbuf, int scount, /* I am the root, loop receiving data. */ - err = ompi_ddt_get_extent(rdtype, &lb, &extent); + err = ompi_datatype_get_extent(rdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } @@ -77,7 +77,7 @@ mca_coll_basic_gatherv_intra(void *sbuf, int scount, if (i == rank) { /* simple optimization */ if (MPI_IN_PLACE != sbuf && (0 < scount) && (0 < rcounts[i])) { - err = ompi_ddt_sndrcv(sbuf, scount, sdtype, + err = ompi_datatype_sndrcv(sbuf, scount, sdtype, ptmp, rcounts[i], rdtype); } } else { @@ -136,7 +136,7 @@ mca_coll_basic_gatherv_inter(void *sbuf, int scount, MCA_PML_BASE_SEND_STANDARD, comm)); } else { /* I am the root, loop receiving data. */ - err = ompi_ddt_get_extent(rdtype, &lb, &extent); + err = ompi_datatype_get_extent(rdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/basic/coll_basic_reduce.c b/ompi/mca/coll/basic/coll_basic_reduce.c index 43fb20be25..674486cad4 100644 --- a/ompi/mca/coll/basic/coll_basic_reduce.c +++ b/ompi/mca/coll/basic/coll_basic_reduce.c @@ -188,8 +188,8 @@ mca_coll_basic_reduce_lin_intra(void *sbuf, void *rbuf, int count, * */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); if (MPI_IN_PLACE == sbuf) { sbuf = rbuf; @@ -211,7 +211,7 @@ mca_coll_basic_reduce_lin_intra(void *sbuf, void *rbuf, int count, /* Initialize the receive buffer. */ if (rank == (size - 1)) { - err = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); } else { err = MCA_PML_CALL(recv(rbuf, count, dtype, size - 1, MCA_COLL_BASE_TAG_REDUCE, comm, @@ -249,7 +249,7 @@ mca_coll_basic_reduce_lin_intra(void *sbuf, void *rbuf, int count, } if (NULL != inplace_temp) { - err = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)sbuf, inplace_temp); + err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)sbuf, inplace_temp); free(inplace_temp); } if (NULL != free_buffer) { @@ -350,8 +350,8 @@ mca_coll_basic_reduce_log_intra(void *sbuf, void *rbuf, int count, /* Allocate the incoming and resulting message buffers. See lengthy * rationale above. */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); free_buffer = (char*)malloc(true_extent + (count - 1) * extent); if (NULL == free_buffer) { @@ -375,7 +375,7 @@ mca_coll_basic_reduce_log_intra(void *sbuf, void *rbuf, int count, goto cleanup_and_return; } sbuf = inplace_temp - lb; - err = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)sbuf, (char*)rbuf); + err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)sbuf, (char*)rbuf); } snd_buffer = (char*)sbuf; @@ -453,7 +453,7 @@ mca_coll_basic_reduce_log_intra(void *sbuf, void *rbuf, int count, * buffer into a temp buffer (pml_buffer) and then reduce * what we just received against it. */ if (!ompi_op_is_commute(op)) { - ompi_ddt_copy_content_same_ddt(dtype, count, pml_buffer, + ompi_datatype_copy_content_same_ddt(dtype, count, pml_buffer, (char*)sbuf); ompi_op_reduce(op, rbuf, pml_buffer, count, dtype); } else { @@ -472,7 +472,7 @@ mca_coll_basic_reduce_log_intra(void *sbuf, void *rbuf, int count, err = MPI_SUCCESS; if (0 == vrank) { if (root == rank) { - ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, snd_buffer); + ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, snd_buffer); } else { err = MCA_PML_CALL(send(snd_buffer, count, dtype, root, MCA_COLL_BASE_TAG_REDUCE, @@ -536,8 +536,8 @@ mca_coll_basic_reduce_lin_inter(void *sbuf, void *rbuf, int count, MCA_PML_BASE_SEND_STANDARD, comm)); } else { /* Root receives and reduces messages */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); free_buffer = (char*)malloc(true_extent + (count - 1) * extent); if (NULL == free_buffer) { diff --git a/ompi/mca/coll/basic/coll_basic_reduce_scatter.c b/ompi/mca/coll/basic/coll_basic_reduce_scatter.c index 5d2390dda3..de57c03aa5 100644 --- a/ompi/mca/coll/basic/coll_basic_reduce_scatter.c +++ b/ompi/mca/coll/basic/coll_basic_reduce_scatter.c @@ -28,7 +28,7 @@ #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_basic.h" #include "ompi/op/op.h" @@ -101,8 +101,8 @@ mca_coll_basic_reduce_scatter_intra(void *sbuf, void *rbuf, int *rcounts, } /* get datatype information */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); buf_size = true_extent + (count - 1) * extent; /* Handle MPI_IN_PLACE */ @@ -127,7 +127,7 @@ mca_coll_basic_reduce_scatter_intra(void *sbuf, void *rbuf, int *rcounts, result_buf = result_buf_free - lb; /* copy local buffer into the temporary results */ - err = ompi_ddt_sndrcv(sbuf, count, dtype, result_buf, count, dtype); + err = ompi_datatype_sndrcv(sbuf, count, dtype, result_buf, count, dtype); if (OMPI_SUCCESS != err) goto cleanup; /* figure out power of two mapping: grow until larger than @@ -287,7 +287,7 @@ mca_coll_basic_reduce_scatter_intra(void *sbuf, void *rbuf, int *rcounts, /* copy local results from results buffer into real receive buffer */ if (0 != rcounts[rank]) { - err = ompi_ddt_sndrcv(result_buf + disps[rank] * extent, + err = ompi_datatype_sndrcv(result_buf + disps[rank] * extent, rcounts[rank], dtype, rbuf, rcounts[rank], dtype); if (OMPI_SUCCESS != err) { @@ -405,7 +405,7 @@ mca_coll_basic_reduce_scatter_inter(void *sbuf, void *rbuf, int *rcounts, * its size is the same as the local communicator size. */ if (rank == root) { - err = ompi_ddt_get_extent(dtype, &lb, &extent); + err = ompi_datatype_get_extent(dtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/basic/coll_basic_scan.c b/ompi/mca/coll/basic/coll_basic_scan.c index 6eb6f62855..627e9a3067 100644 --- a/ompi/mca/coll/basic/coll_basic_scan.c +++ b/ompi/mca/coll/basic/coll_basic_scan.c @@ -58,7 +58,7 @@ mca_coll_basic_scan_intra(void *sbuf, void *rbuf, int count, if (0 == rank) { if (MPI_IN_PLACE != sbuf) { - err = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); if (MPI_SUCCESS != err) { return err; } @@ -72,8 +72,8 @@ mca_coll_basic_scan_intra(void *sbuf, void *rbuf, int count, * listed in coll_basic_reduce.c. Use this temporary buffer to * receive into, later. */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); free_buffer = (char*)malloc(true_extent + (count - 1) * extent); if (NULL == free_buffer) { @@ -84,7 +84,7 @@ mca_coll_basic_scan_intra(void *sbuf, void *rbuf, int count, /* Copy the send buffer into the receive buffer. */ if (MPI_IN_PLACE != sbuf) { - err = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); if (MPI_SUCCESS != err) { if (NULL != free_buffer) { free(free_buffer); diff --git a/ompi/mca/coll/basic/coll_basic_scatter.c b/ompi/mca/coll/basic/coll_basic_scatter.c index 9f8c0974d5..46d9a20263 100644 --- a/ompi/mca/coll/basic/coll_basic_scatter.c +++ b/ompi/mca/coll/basic/coll_basic_scatter.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -63,7 +63,7 @@ mca_coll_basic_scatter_intra(void *sbuf, int scount, /* I am the root, loop sending data. */ - err = ompi_ddt_get_extent(sdtype, &lb, &incr); + err = ompi_datatype_get_extent(sdtype, &lb, &incr); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } @@ -76,7 +76,7 @@ mca_coll_basic_scatter_intra(void *sbuf, int scount, if (i == rank) { if (MPI_IN_PLACE != rbuf) { err = - ompi_ddt_sndrcv(ptmp, scount, sdtype, rbuf, rcount, + ompi_datatype_sndrcv(ptmp, scount, sdtype, rbuf, rcount, rdtype); } } else { @@ -129,7 +129,7 @@ mca_coll_basic_scatter_inter(void *sbuf, int scount, comm, MPI_STATUS_IGNORE)); } else { /* I am the root, loop sending data. */ - err = ompi_ddt_get_extent(sdtype, &lb, &incr); + err = ompi_datatype_get_extent(sdtype, &lb, &incr); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/basic/coll_basic_scatterv.c b/ompi/mca/coll/basic/coll_basic_scatterv.c index a104eedf90..06dcd7c3d0 100644 --- a/ompi/mca/coll/basic/coll_basic_scatterv.c +++ b/ompi/mca/coll/basic/coll_basic_scatterv.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -66,7 +66,7 @@ mca_coll_basic_scatterv_intra(void *sbuf, int *scounts, /* I am the root, loop sending data. */ - err = ompi_ddt_get_extent(sdtype, &lb, &extent); + err = ompi_datatype_get_extent(sdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } @@ -79,7 +79,7 @@ mca_coll_basic_scatterv_intra(void *sbuf, int *scounts, if (i == rank) { /* simple optimization or a local operation */ if (scounts[i] > 0 && MPI_IN_PLACE != rbuf) { - err = ompi_ddt_sndrcv(ptmp, scounts[i], sdtype, rbuf, rcount, + err = ompi_datatype_sndrcv(ptmp, scounts[i], sdtype, rbuf, rcount, rdtype); } } else { @@ -138,7 +138,7 @@ mca_coll_basic_scatterv_inter(void *sbuf, int *scounts, comm, MPI_STATUS_IGNORE)); } else { /* I am the root, loop sending data. */ - err = ompi_ddt_get_extent(sdtype, &lb, &extent); + err = ompi_datatype_get_extent(sdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/hierarch/coll_hierarch_allreduce.c b/ompi/mca/coll/hierarch/coll_hierarch_allreduce.c index 8fcabc58df..3fd1a8380e 100644 --- a/ompi/mca/coll/hierarch/coll_hierarch_allreduce.c +++ b/ompi/mca/coll/hierarch/coll_hierarch_allreduce.c @@ -25,7 +25,7 @@ #include "mpi.h" #include "ompi/constants.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" @@ -63,8 +63,8 @@ int mca_coll_hierarch_allreduce_intra(void *sbuf, void *rbuf, int count, llcomm = mca_coll_hierarch_get_llcomm ( root, hierarch_module, &llroot, &lroot); if ( MPI_COMM_NULL != lcomm ) { - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); tbuf = (char*)malloc(true_extent + (count - 1) * extent); if (NULL == tbuf) { diff --git a/ompi/mca/coll/hierarch/coll_hierarch_bcast.c b/ompi/mca/coll/hierarch/coll_hierarch_bcast.c index 178d4002b7..0788a5a10a 100644 --- a/ompi/mca/coll/hierarch/coll_hierarch_bcast.c +++ b/ompi/mca/coll/hierarch/coll_hierarch_bcast.c @@ -25,7 +25,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/pml/pml.h" /* @@ -167,8 +167,8 @@ static int mca_coll_hierarch_bcast_intra_seg (void *buff, llcomm = mca_coll_hierarch_get_llcomm ( root, hierarch_module, &llroot, &lroot); - ompi_ddt_type_size ( datatype, &typesize); - ompi_ddt_get_extent ( datatype, &ub, &typeext); + ompi_datatype_type_size ( datatype, &typesize); + ompi_datatype_get_extent ( datatype, &ub, &typeext); /* Determine number of segments and number of elements per segment */ @@ -267,8 +267,8 @@ static int mca_coll_hierarch_bcast_intra_seg1 (void *buff, */ llcomm = mca_coll_hierarch_get_llcomm ( root, hierarch_module, &llroot, &lroot); - ompi_ddt_type_size ( datatype, &typesize); - ompi_ddt_get_extent ( datatype, &ub, &typeext); + ompi_datatype_type_size ( datatype, &typesize); + ompi_datatype_get_extent ( datatype, &ub, &typeext); /* Determine number of segments and number of elements per segment */ if ((typesize > 0) && (segsize % typesize != 0)) { @@ -431,8 +431,8 @@ static int mca_coll_hierarch_bcast_intra_seg2 (void *buff, */ llcomm = mca_coll_hierarch_get_llcomm ( root, hierarch_module, &llroot, &lroot); - ompi_ddt_type_size ( datatype, &typesize); - ompi_ddt_get_extent ( datatype, &ub, &typeext); + ompi_datatype_type_size ( datatype, &typesize); + ompi_datatype_get_extent ( datatype, &ub, &typeext); /* Determine number of segments and number of elements per segment */ if ((typesize > 0) && (segsize % typesize != 0)) { @@ -589,8 +589,8 @@ static int mca_coll_hierarch_bcast_intra_seg3 (void *buff, */ llcomm = mca_coll_hierarch_get_llcomm ( root, hierarch_module, &llroot, &lroot); - ompi_ddt_type_size ( datatype, &typesize); - ompi_ddt_get_extent ( datatype, &ub, &typeext); + ompi_datatype_type_size ( datatype, &typesize); + ompi_datatype_get_extent ( datatype, &ub, &typeext); /* Determine number of segments and number of elements per segment */ if ((typesize > 0) && (segsize % typesize != 0)) { diff --git a/ompi/mca/coll/hierarch/coll_hierarch_reduce.c b/ompi/mca/coll/hierarch/coll_hierarch_reduce.c index a518635ccc..85686405cd 100644 --- a/ompi/mca/coll/hierarch/coll_hierarch_reduce.c +++ b/ompi/mca/coll/hierarch/coll_hierarch_reduce.c @@ -25,7 +25,7 @@ #include "mpi.h" #include "ompi/constants.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" @@ -62,8 +62,8 @@ int mca_coll_hierarch_reduce_intra(void *sbuf, void *rbuf, int count, llcomm = mca_coll_hierarch_get_llcomm ( root, hierarch_module, &llroot, &lroot); if ( MPI_COMM_NULL != lcomm ) { - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); tbuf = (char*)malloc(true_extent + (count - 1) * extent); if (NULL == tbuf) { diff --git a/ompi/mca/coll/hierarch/coll_hierarch_tmpcoll.c b/ompi/mca/coll/hierarch/coll_hierarch_tmpcoll.c index d880c23fbe..f6df3004fa 100644 --- a/ompi/mca/coll/hierarch/coll_hierarch_tmpcoll.c +++ b/ompi/mca/coll/hierarch/coll_hierarch_tmpcoll.c @@ -122,13 +122,13 @@ int mca_coll_hierarch_reduce_tmp(void *sbuf, void *rbuf, int count, size = ompi_comm_size(comm); - ompi_ddt_get_extent(dtype, &lb, &extent); + ompi_datatype_get_extent(dtype, &lb, &extent); pml_buffer = (char*)malloc(count * extent); if (NULL == pml_buffer) { return OMPI_ERR_OUT_OF_RESOURCE; } - err = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); if (MPI_SUCCESS != err) { goto exit; } @@ -184,12 +184,12 @@ int mca_coll_hierarch_gather_tmp(void *sbuf, int scount, } /* I am the root, loop receiving the data. */ - ompi_ddt_get_extent(rdtype, &lb, &extent); + ompi_datatype_get_extent(rdtype, &lb, &extent); incr = extent * rcount; for (i = 0, ptmp = (char *) rbuf; i < size; ++i, ptmp += incr) { if (i == rank) { if (MPI_IN_PLACE != sbuf) { - err = ompi_ddt_sndrcv(sbuf, scount, sdtype, + err = ompi_datatype_sndrcv(sbuf, scount, sdtype, ptmp, rcount, rdtype); } else { err = MPI_SUCCESS; diff --git a/ompi/mca/coll/inter/coll_inter_allgather.c b/ompi/mca/coll/inter/coll_inter_allgather.c index 84f766e356..7a898c6002 100644 --- a/ompi/mca/coll/inter/coll_inter_allgather.c +++ b/ompi/mca/coll/inter/coll_inter_allgather.c @@ -24,7 +24,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/request/request.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" @@ -56,7 +56,7 @@ mca_coll_inter_allgather_inter(void *sbuf, int scount, rsize = ompi_comm_remote_size(comm); /* Perform the gather locally at the root */ - err = ompi_ddt_get_extent(sdtype, &slb, &sextent); + err = ompi_datatype_get_extent(sdtype, &slb, &sextent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/inter/coll_inter_allgatherv.c b/ompi/mca/coll/inter/coll_inter_allgatherv.c index 50009e74a8..9cbe00fd32 100644 --- a/ompi/mca/coll/inter/coll_inter_allgatherv.c +++ b/ompi/mca/coll/inter/coll_inter_allgatherv.c @@ -21,7 +21,7 @@ #include "coll_inter.h" #include "mpi.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/request/request.h" #include "ompi/communicator/communicator.h" #include "ompi/constants.h" @@ -82,7 +82,7 @@ mca_coll_inter_allgatherv_inter(void *sbuf, int scount, displace[i] = displace[i-1] + count[i-1]; } /* Perform the gatherv locally with the first process as root */ - err = ompi_ddt_get_extent(sdtype, &lb, &extent); + err = ompi_datatype_get_extent(sdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } @@ -103,8 +103,8 @@ mca_coll_inter_allgatherv_inter(void *sbuf, int scount, return err; } - ompi_ddt_create_indexed(size,rcounts,disps,rdtype,&ndtype); - ompi_ddt_commit(&ndtype); + ompi_datatype_create_indexed(size,rcounts,disps,rdtype,&ndtype); + ompi_datatype_commit(&ndtype); if (0 == rank) { for (i = 0; i < size_local; i++) { @@ -140,7 +140,7 @@ mca_coll_inter_allgatherv_inter(void *sbuf, int scount, return err; } - ompi_ddt_destroy(&ndtype); + ompi_datatype_destroy(&ndtype); if (NULL != ptmp) { free(ptmp); } diff --git a/ompi/mca/coll/inter/coll_inter_allreduce.c b/ompi/mca/coll/inter/coll_inter_allreduce.c index b06f81c187..1203e92923 100644 --- a/ompi/mca/coll/inter/coll_inter_allreduce.c +++ b/ompi/mca/coll/inter/coll_inter_allreduce.c @@ -22,7 +22,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/request/request.h" #include "ompi/op/op.h" @@ -53,7 +53,7 @@ mca_coll_inter_allreduce_inter(void *sbuf, void *rbuf, int count, rsize = ompi_comm_remote_size(comm); /* Perform the reduction locally */ - err = ompi_ddt_get_extent(dtype, &lb, &extent); + err = ompi_datatype_get_extent(dtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/inter/coll_inter_gather.c b/ompi/mca/coll/inter/coll_inter_gather.c index 1000d6410c..958cf24351 100644 --- a/ompi/mca/coll/inter/coll_inter_gather.c +++ b/ompi/mca/coll/inter/coll_inter_gather.c @@ -22,7 +22,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -59,7 +59,7 @@ mca_coll_inter_gather_inter(void *sbuf, int scount, err = OMPI_SUCCESS; } else if (MPI_ROOT != root) { /* Perform the gather locally with the first process as root */ - err = ompi_ddt_get_extent(sdtype, &lb, &extent); + err = ompi_datatype_get_extent(sdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/inter/coll_inter_gatherv.c b/ompi/mca/coll/inter/coll_inter_gatherv.c index bd8000a589..16814da86d 100644 --- a/ompi/mca/coll/inter/coll_inter_gatherv.c +++ b/ompi/mca/coll/inter/coll_inter_gatherv.c @@ -22,7 +22,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -83,7 +83,7 @@ mca_coll_inter_gatherv_inter(void *sbuf, int scount, displace[i] = displace[i-1] + count[i-1]; } /* Perform the gatherv locally with the first process as root */ - err = ompi_ddt_get_extent(sdtype, &lb, &extent); + err = ompi_datatype_get_extent(sdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } @@ -127,8 +127,8 @@ mca_coll_inter_gatherv_inter(void *sbuf, int scount, } } else { /* I am the root, loop receiving the data. */ - ompi_ddt_create_indexed(size,rcounts,disps,rdtype,&ndtype); - ompi_ddt_commit(&ndtype); + ompi_datatype_create_indexed(size,rcounts,disps,rdtype,&ndtype); + ompi_datatype_commit(&ndtype); err = MCA_PML_CALL(recv(rbuf, 1, ndtype, 0, MCA_COLL_BASE_TAG_GATHERV, @@ -136,7 +136,7 @@ mca_coll_inter_gatherv_inter(void *sbuf, int scount, if (OMPI_SUCCESS != err) { return err; } - ompi_ddt_destroy(&ndtype); + ompi_datatype_destroy(&ndtype); } /* All done */ diff --git a/ompi/mca/coll/inter/coll_inter_reduce.c b/ompi/mca/coll/inter/coll_inter_reduce.c index d94d558f6b..b35c228411 100644 --- a/ompi/mca/coll/inter/coll_inter_reduce.c +++ b/ompi/mca/coll/inter/coll_inter_reduce.c @@ -57,8 +57,8 @@ mca_coll_inter_reduce_inter(void *sbuf, void *rbuf, int count, err = OMPI_SUCCESS; } else if (MPI_ROOT != root) { /* Perform the reduce locally with the first process as root */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); free_buffer = (char*)malloc(true_extent + (count - 1) * extent); if (NULL == free_buffer) { diff --git a/ompi/mca/coll/inter/coll_inter_scatter.c b/ompi/mca/coll/inter/coll_inter_scatter.c index abff0b9c15..1350a69ed9 100644 --- a/ompi/mca/coll/inter/coll_inter_scatter.c +++ b/ompi/mca/coll/inter/coll_inter_scatter.c @@ -22,7 +22,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -57,7 +57,7 @@ mca_coll_inter_scatter_inter(void *sbuf, int scount, } else if (MPI_ROOT != root) { /* First process receives the data from root */ if(0 == rank) { - err = ompi_ddt_get_extent(rdtype, &lb, &incr); + err = ompi_datatype_get_extent(rdtype, &lb, &incr); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } diff --git a/ompi/mca/coll/inter/coll_inter_scatterv.c b/ompi/mca/coll/inter/coll_inter_scatterv.c index eb2339f02a..3fbb3ddca6 100644 --- a/ompi/mca/coll/inter/coll_inter_scatterv.c +++ b/ompi/mca/coll/inter/coll_inter_scatterv.c @@ -22,7 +22,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" @@ -71,7 +71,7 @@ mca_coll_inter_scatterv_inter(void *sbuf, int *scounts, return err; } /* calculate the whole buffer size and recieve it from root */ - err = ompi_ddt_get_extent(rdtype, &lb, &extent); + err = ompi_datatype_get_extent(rdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } @@ -127,8 +127,8 @@ mca_coll_inter_scatterv_inter(void *sbuf, int *scounts, return err; } - ompi_ddt_create_indexed(size,scounts,disps,sdtype,&ndtype); - ompi_ddt_commit(&ndtype); + ompi_datatype_create_indexed(size,scounts,disps,sdtype,&ndtype); + ompi_datatype_commit(&ndtype); err = MCA_PML_CALL(send(sbuf, 1, ndtype, 0, MCA_COLL_BASE_TAG_SCATTERV, @@ -136,7 +136,7 @@ mca_coll_inter_scatterv_inter(void *sbuf, int *scounts, if (OMPI_SUCCESS != err) { return err; } - ompi_ddt_destroy(&ndtype); + ompi_datatype_destroy(&ndtype); } diff --git a/ompi/mca/coll/self/coll_self_allgather.c b/ompi/mca/coll/self/coll_self_allgather.c index 3175988620..714baee0c5 100644 --- a/ompi/mca/coll/self/coll_self_allgather.c +++ b/ompi/mca/coll/self/coll_self_allgather.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -39,7 +39,7 @@ int mca_coll_self_allgather_intra(void *sbuf, int scount, if (MPI_IN_PLACE == sbuf) { return MPI_SUCCESS; } else { - return ompi_ddt_sndrcv(sbuf, scount, sdtype, + return ompi_datatype_sndrcv(sbuf, scount, sdtype, rbuf, rcount, rdtype); } } diff --git a/ompi/mca/coll/self/coll_self_allgatherv.c b/ompi/mca/coll/self/coll_self_allgatherv.c index ce6133d327..fb1368f124 100644 --- a/ompi/mca/coll/self/coll_self_allgatherv.c +++ b/ompi/mca/coll/self/coll_self_allgatherv.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -42,11 +42,11 @@ int mca_coll_self_allgatherv_intra(void *sbuf, int scount, } else { int err; ptrdiff_t lb, extent; - err = ompi_ddt_get_extent(rdtype, &lb, &extent); + err = ompi_datatype_get_extent(rdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } - return ompi_ddt_sndrcv(sbuf, scount, sdtype, + return ompi_datatype_sndrcv(sbuf, scount, sdtype, ((char *) rbuf) + disps[0] * extent, rcounts[0], rdtype); } } diff --git a/ompi/mca/coll/self/coll_self_allreduce.c b/ompi/mca/coll/self/coll_self_allreduce.c index 601eea2304..f34d1b95c8 100644 --- a/ompi/mca/coll/self/coll_self_allreduce.c +++ b/ompi/mca/coll/self/coll_self_allreduce.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -39,6 +39,6 @@ int mca_coll_self_allreduce_intra(void *sbuf, void *rbuf, int count, if (MPI_IN_PLACE == sbuf) { return MPI_SUCCESS; } else { - return ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + return ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); } } diff --git a/ompi/mca/coll/self/coll_self_alltoall.c b/ompi/mca/coll/self/coll_self_alltoall.c index e25f53d036..6c99703b0a 100644 --- a/ompi/mca/coll/self/coll_self_alltoall.c +++ b/ompi/mca/coll/self/coll_self_alltoall.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -37,6 +37,6 @@ int mca_coll_self_alltoall_intra(void *sbuf, int scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - return ompi_ddt_sndrcv(sbuf, scount, sdtype, + return ompi_datatype_sndrcv(sbuf, scount, sdtype, rbuf, rcount, rdtype); } diff --git a/ompi/mca/coll/self/coll_self_alltoallv.c b/ompi/mca/coll/self/coll_self_alltoallv.c index 10e06f0e22..907c2f8b81 100644 --- a/ompi/mca/coll/self/coll_self_alltoallv.c +++ b/ompi/mca/coll/self/coll_self_alltoallv.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -40,15 +40,15 @@ mca_coll_self_alltoallv_intra(void *sbuf, int *scounts, int *sdisps, { int err; ptrdiff_t lb, rextent, sextent; - err = ompi_ddt_get_extent(sdtype, &lb, &sextent); + err = ompi_datatype_get_extent(sdtype, &lb, &sextent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } - err = ompi_ddt_get_extent(rdtype, &lb, &rextent); + err = ompi_datatype_get_extent(rdtype, &lb, &rextent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } - return ompi_ddt_sndrcv(((char *) sbuf) + sdisps[0] * sextent, + return ompi_datatype_sndrcv(((char *) sbuf) + sdisps[0] * sextent, scounts[0], sdtype, ((char *) rbuf) + rdisps[0] * rextent, rcounts[0], rdtype); diff --git a/ompi/mca/coll/self/coll_self_alltoallw.c b/ompi/mca/coll/self/coll_self_alltoallw.c index ac7c8049a1..9cab09cd38 100644 --- a/ompi/mca/coll/self/coll_self_alltoallw.c +++ b/ompi/mca/coll/self/coll_self_alltoallw.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -39,16 +39,16 @@ int mca_coll_self_alltoallw_intra(void *sbuf, int *scounts, int *sdisps, { int err; ptrdiff_t lb, rextent, sextent; - err = ompi_ddt_get_extent(sdtypes[0], &lb, &sextent); + err = ompi_datatype_get_extent(sdtypes[0], &lb, &sextent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } - err = ompi_ddt_get_extent(rdtypes[0], &lb, &rextent); + err = ompi_datatype_get_extent(rdtypes[0], &lb, &rextent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } - return ompi_ddt_sndrcv(((char *) sbuf) + sdisps[0] * sextent, + return ompi_datatype_sndrcv(((char *) sbuf) + sdisps[0] * sextent, scounts[0], sdtypes[0], ((char *) rbuf) + rdisps[0] * rextent, rcounts[0], rdtypes[0]); diff --git a/ompi/mca/coll/self/coll_self_bcast.c b/ompi/mca/coll/self/coll_self_bcast.c index 96565f2dc7..5121f749b2 100644 --- a/ompi/mca/coll/self/coll_self_bcast.c +++ b/ompi/mca/coll/self/coll_self_bcast.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" diff --git a/ompi/mca/coll/self/coll_self_gather.c b/ompi/mca/coll/self/coll_self_gather.c index 786c602ca2..794ac8fa54 100644 --- a/ompi/mca/coll/self/coll_self_gather.c +++ b/ompi/mca/coll/self/coll_self_gather.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -40,7 +40,7 @@ int mca_coll_self_gather_intra(void *sbuf, int scount, if (MPI_IN_PLACE == sbuf) { return MPI_SUCCESS; } else { - return ompi_ddt_sndrcv(sbuf, scount, sdtype, + return ompi_datatype_sndrcv(sbuf, scount, sdtype, rbuf, rcount, rdtype); } } diff --git a/ompi/mca/coll/self/coll_self_gatherv.c b/ompi/mca/coll/self/coll_self_gatherv.c index fa476527c2..795c3ad3c6 100644 --- a/ompi/mca/coll/self/coll_self_gatherv.c +++ b/ompi/mca/coll/self/coll_self_gatherv.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -42,11 +42,11 @@ int mca_coll_self_gatherv_intra(void *sbuf, int scount, } else { int err; ptrdiff_t lb, extent; - err = ompi_ddt_get_extent(rdtype, &lb, &extent); + err = ompi_datatype_get_extent(rdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } - return ompi_ddt_sndrcv(sbuf, scount, sdtype, + return ompi_datatype_sndrcv(sbuf, scount, sdtype, ((char *) rbuf) + disps[0]*extent, rcounts[0], rdtype); } diff --git a/ompi/mca/coll/self/coll_self_reduce.c b/ompi/mca/coll/self/coll_self_reduce.c index 9c94b56d06..5446835b03 100644 --- a/ompi/mca/coll/self/coll_self_reduce.c +++ b/ompi/mca/coll/self/coll_self_reduce.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -39,6 +39,6 @@ int mca_coll_self_reduce_intra(void *sbuf, void *rbuf, int count, if (MPI_IN_PLACE == sbuf) { return MPI_SUCCESS; } else { - return ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + return ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); } } diff --git a/ompi/mca/coll/self/coll_self_reduce_scatter.c b/ompi/mca/coll/self/coll_self_reduce_scatter.c index eae1eb0a16..2ca8afdf6e 100644 --- a/ompi/mca/coll/self/coll_self_reduce_scatter.c +++ b/ompi/mca/coll/self/coll_self_reduce_scatter.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -39,6 +39,6 @@ int mca_coll_self_reduce_scatter_intra(void *sbuf, void *rbuf, int *rcounts, if (MPI_IN_PLACE == sbuf) { return MPI_SUCCESS; } else { - return ompi_ddt_copy_content_same_ddt(dtype, rcounts[0], (char*)rbuf, (char*)sbuf); + return ompi_datatype_copy_content_same_ddt(dtype, rcounts[0], (char*)rbuf, (char*)sbuf); } } diff --git a/ompi/mca/coll/self/coll_self_scan.c b/ompi/mca/coll/self/coll_self_scan.c index 6b94c16f9d..34a625cce2 100644 --- a/ompi/mca/coll/self/coll_self_scan.c +++ b/ompi/mca/coll/self/coll_self_scan.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -39,6 +39,6 @@ int mca_coll_self_scan_intra(void *sbuf, void *rbuf, int count, if (MPI_IN_PLACE == sbuf) { return MPI_SUCCESS; } else { - return ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + return ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); } } diff --git a/ompi/mca/coll/self/coll_self_scatter.c b/ompi/mca/coll/self/coll_self_scatter.c index 548ef86b72..74e6022087 100644 --- a/ompi/mca/coll/self/coll_self_scatter.c +++ b/ompi/mca/coll/self/coll_self_scatter.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "coll_self.h" @@ -41,7 +41,7 @@ int mca_coll_self_scatter_intra(void *sbuf, int scount, if (MPI_IN_PLACE == rbuf) { return MPI_SUCCESS; } else { - return ompi_ddt_sndrcv(sbuf, scount, sdtype, + return ompi_datatype_sndrcv(sbuf, scount, sdtype, rbuf, rcount, rdtype); } } diff --git a/ompi/mca/coll/self/coll_self_scatterv.c b/ompi/mca/coll/self/coll_self_scatterv.c index 7ae5188f28..e817d2f41c 100644 --- a/ompi/mca/coll/self/coll_self_scatterv.c +++ b/ompi/mca/coll/self/coll_self_scatterv.c @@ -20,7 +20,7 @@ #include "ompi/constants.h" #include "coll_self.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" /* @@ -42,11 +42,11 @@ int mca_coll_self_scatterv_intra(void *sbuf, int *scounts, } else { int err; ptrdiff_t lb, extent; - err = ompi_ddt_get_extent(sdtype, &lb, &extent); + err = ompi_datatype_get_extent(sdtype, &lb, &extent); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } - return ompi_ddt_sndrcv(((char *) sbuf) + disps[0]*extent, scounts[0], + return ompi_datatype_sndrcv(((char *) sbuf) + disps[0]*extent, scounts[0], sdtype, rbuf, rcount, rdtype); } } diff --git a/ompi/mca/coll/sm/coll_sm.h b/ompi/mca/coll/sm/coll_sm.h index 117a570159..4ecd4b8b10 100644 --- a/ompi/mca/coll/sm/coll_sm.h +++ b/ompi/mca/coll/sm/coll_sm.h @@ -25,6 +25,7 @@ #include "mpi.h" #include "opal/mca/mca.h" +#include "opal/datatype/opal_convertor.h" #include "orte/types.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/mpool/mpool.h" @@ -508,7 +509,7 @@ extern uint32_t mca_coll_sm_iov_size; (index)->mcbmi_data + \ ((rank) * mca_coll_sm_component.sm_fragment_size); \ (max_data) = (iov).iov_len = mca_coll_sm_component.sm_fragment_size; \ - ompi_convertor_pack(&(convertor), &(iov), &mca_coll_sm_iov_size, \ + opal_convertor_pack(&(convertor), &(iov), &mca_coll_sm_iov_size, \ &(max_data) ) /** @@ -518,7 +519,7 @@ extern uint32_t mca_coll_sm_iov_size; #define COPY_FRAGMENT_OUT(convertor, src_rank, index, iov, max_data) \ (iov).iov_base = (((char*) (index)->mcbmi_data) + \ ((src_rank) * mca_coll_sm_component.sm_fragment_size)); \ - ompi_convertor_unpack(&(convertor), &(iov), &mca_coll_sm_iov_size, \ + opal_convertor_unpack(&(convertor), &(iov), &mca_coll_sm_iov_size, \ &(max_data) ) /** diff --git a/ompi/mca/coll/sm/coll_sm_bcast.c b/ompi/mca/coll/sm/coll_sm_bcast.c index 25a94e712f..a7526065cc 100644 --- a/ompi/mca/coll/sm/coll_sm_bcast.c +++ b/ompi/mca/coll/sm/coll_sm_bcast.c @@ -23,9 +23,10 @@ #include #endif +#include "opal/datatype/opal_convertor.h" #include "ompi/constants.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/coll/coll.h" #include "opal/sys/atomic.h" #include "coll_sm.h" @@ -67,7 +68,7 @@ int mca_coll_sm_bcast_intra(void *buff, int count, int parent_rank; size_t total_size, max_data, bytes; mca_coll_sm_in_use_flag_t *flag; - ompi_convertor_t convertor; + opal_convertor_t convertor; mca_coll_sm_tree_node_t *me, *parent, **children; mca_coll_base_mpool_index_t *index; @@ -76,7 +77,7 @@ int mca_coll_sm_bcast_intra(void *buff, int count, rank = ompi_comm_rank(comm); size = ompi_comm_size(comm); - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); iov.iov_len = mca_coll_sm_component.sm_fragment_size; bytes = 0; @@ -102,15 +103,15 @@ int mca_coll_sm_bcast_intra(void *buff, int count, if (OMPI_SUCCESS != (ret = - ompi_convertor_copy_and_prepare_for_send(ompi_mpi_local_convertor, - datatype, + opal_convertor_copy_and_prepare_for_send(ompi_mpi_local_convertor, + &(datatype->super), count, buff, 0, &convertor))) { return ret; } - ompi_convertor_get_packed_size(&convertor, &total_size); + opal_convertor_get_packed_size(&convertor, &total_size); D(("root got send convertor w/ total_size == %lu\n", (unsigned long) total_size)); @@ -161,15 +162,15 @@ int mca_coll_sm_bcast_intra(void *buff, int count, if (OMPI_SUCCESS != (ret = - ompi_convertor_copy_and_prepare_for_recv(ompi_mpi_local_convertor, - datatype, + opal_convertor_copy_and_prepare_for_recv(ompi_mpi_local_convertor, + &(datatype->super), count, buff, 0, &convertor))) { return ret; } - ompi_convertor_get_packed_size(&convertor, &total_size); + opal_convertor_get_packed_size(&convertor, &total_size); D(("rank %d got recv convertor w/ total_size == %lu\n", rank, (unsigned long) total_size)); diff --git a/ompi/mca/coll/sm/coll_sm_reduce.c b/ompi/mca/coll/sm/coll_sm_reduce.c index 52e5c65335..29b0f34ebf 100644 --- a/ompi/mca/coll/sm/coll_sm_reduce.c +++ b/ompi/mca/coll/sm/coll_sm_reduce.c @@ -22,11 +22,11 @@ #include #endif +#include "opal/datatype/opal_convertor.h" +#include "opal/sys/atomic.h" #include "ompi/constants.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/convertor.h" #include "ompi/mca/coll/coll.h" -#include "opal/sys/atomic.h" #include "ompi/op/op.h" #include "coll_sm.h" @@ -84,7 +84,7 @@ int mca_coll_sm_reduce_intra(void *sbuf, void* rbuf, int count, * ii. if the data is not floating point, use the unordered */ - ompi_ddt_type_size(dtype, &size); + ompi_datatype_type_size(dtype, &size); if ((int)size > mca_coll_sm_component.sm_control_size) { return sm_module->previous_reduce(sbuf, rbuf, count, dtype, op, root, comm, @@ -93,7 +93,7 @@ int mca_coll_sm_reduce_intra(void *sbuf, void* rbuf, int count, #if WANT_REDUCE_NO_ORDER else if (!ompi_op_is_intrinsic(op) || (ompi_op_is_intrinsic(op) && !ompi_op_is_float_assoc(op) && - 0 != (dtype->flags & DT_FLAG_DATA_FLOAT))) { + 0 != (dtype->flags & OMPI_DATATYPE_FLAG_DATA_FLOAT))) { return reduce_inorder(sbuf, rbuf, count, dtype, op, root, comm, module); } else { return reduce_no_order(sbuf, rbuf, count, dtype, op, root, comm, module); @@ -159,7 +159,7 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, int flag_num, segment_num, max_segment_num; size_t total_size, max_data, bytes; mca_coll_sm_in_use_flag_t *flag; - ompi_convertor_t convertor; + opal_convertor_t convertor; mca_coll_base_mpool_index_t *index; size_t ddt_size; size_t segment_ddt_count, segment_ddt_bytes, zero = 0; @@ -175,7 +175,7 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, already guaranteed above that the datatype is not larger than a segment, so we'll at least get 1). */ - ompi_ddt_type_size(dtype, &ddt_size); + ompi_datatype_type_size(dtype, &ddt_size); segment_ddt_count = mca_coll_sm_component.sm_fragment_size / ddt_size; iov.iov_len = segment_ddt_bytes = segment_ddt_count * ddt_size; total_size = ddt_size * count; @@ -207,12 +207,12 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, receive convertor and a temporary buffer to receive into. */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); - if (ompi_ddt_is_contiguous_memory_layout(dtype, count)) { + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); + if (ompi_datatype_is_contiguous_memory_layout(dtype, count)) { reduce_temp_buffer = free_buffer = NULL; } else { - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); /* See lengthy comment in coll basic reduce about explanation for how to malloc the extra buffer. Note @@ -234,8 +234,8 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, user's count that will fit within a single segment. */ if (OMPI_SUCCESS != - (ret = ompi_convertor_copy_and_prepare_for_recv(ompi_mpi_local_convertor, - dtype, + (ret = opal_convertor_copy_and_prepare_for_recv(ompi_mpi_local_convertor, + &(dtype->super), segment_ddt_count, reduce_temp_buffer, 0, @@ -297,7 +297,7 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, if (first_operation) { first_operation = false; if (MPI_IN_PLACE != sbuf) { - ompi_ddt_copy_content_same_ddt(dtype, + ompi_datatype_copy_content_same_ddt(dtype, count, reduce_target, (char*)sbuf); D(("root copied entire buffer to rbuf (contig ddt, count %d) FIRST OPERATION\n", count)); @@ -324,9 +324,9 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, D(("root: special case -- unpack and copy from rank 0 to reduce_target\n")); COPY_FRAGMENT_OUT(convertor, 0, index, iov, max_data); - ompi_convertor_set_position(&convertor, &zero); + opal_convertor_set_position(&convertor, &zero); - ompi_ddt_copy_content_same_ddt(dtype, + ompi_datatype_copy_content_same_ddt(dtype, max_data / ddt_size, reduce_target, iov.iov_base); @@ -386,7 +386,7 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, buffer */ COPY_FRAGMENT_OUT(convertor, peer, index, iov, max_data); - ompi_convertor_set_position(&convertor, &zero); + opal_convertor_set_position(&convertor, &zero); /* Do the reduction on this fragment */ ompi_op_reduce(op, reduce_temp_buffer, @@ -431,11 +431,11 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count, /* Here we get a convertor for the full count that the user provided (as opposed to the convertor that the root got) */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); if (OMPI_SUCCESS != (ret = - ompi_convertor_copy_and_prepare_for_send(ompi_mpi_local_convertor, - dtype, + opal_convertor_copy_and_prepare_for_send(ompi_mpi_local_convertor, + &(dtype->super), count, sbuf, 0, diff --git a/ompi/mca/coll/sm2/coll_sm2_allreduce.c b/ompi/mca/coll/sm2/coll_sm2_allreduce.c index 49d03794ca..e9c34f3f4c 100644 --- a/ompi/mca/coll/sm2/coll_sm2_allreduce.c +++ b/ompi/mca/coll/sm2/coll_sm2_allreduce.c @@ -13,7 +13,7 @@ #include "ompi/constants.h" #include "coll_sm2.h" #include "ompi/op/op.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" /* debug #include "opal/sys/timer.h" @@ -55,7 +55,7 @@ int mca_coll_sm2_allreduce_intra_fanin_fanout(void *sbuf, void *rbuf, int count, /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_extent(dtype, &dt_extent); + rc=ompi_datatype_type_extent(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } @@ -115,7 +115,7 @@ int mca_coll_sm2_allreduce_intra_fanin_fanout(void *sbuf, void *rbuf, int count, * provids only 2 buffers, so can't add from two * into a third buffer. */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -173,7 +173,7 @@ int mca_coll_sm2_allreduce_intra_fanin_fanout(void *sbuf, void *rbuf, int count, /* copy segment into shared buffer - later on will optimize to * eliminate extra copies. */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -207,7 +207,7 @@ int mca_coll_sm2_allreduce_intra_fanin_fanout(void *sbuf, void *rbuf, int count, my_ctl_pointer->flag=-tag; /* copy data to user supplied buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)((char *)rbuf+dt_extent*count_processed), (char *)my_data_pointer); if( 0 != rc ) { @@ -232,7 +232,7 @@ int mca_coll_sm2_allreduce_intra_fanin_fanout(void *sbuf, void *rbuf, int count, } /* copy data to user supplied buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)rbuf+dt_extent*count_processed, (char *)parent_data_pointer); if( 0 != rc ) { @@ -258,7 +258,7 @@ int mca_coll_sm2_allreduce_intra_fanin_fanout(void *sbuf, void *rbuf, int count, } /* copy the data to my shared buffer, for access by children */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer,(char *)parent_data_pointer); if( 0 != rc ) { return OMPI_ERROR; @@ -273,7 +273,7 @@ int mca_coll_sm2_allreduce_intra_fanin_fanout(void *sbuf, void *rbuf, int count, my_ctl_pointer->flag=-tag; /* copy data to user supplied buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)rbuf+dt_extent*count_processed, (char *)my_data_pointer); if( 0 != rc ) { @@ -356,8 +356,8 @@ int progress_fanin_fanout( void *sbuf, void *rbuf, count_processed=reduction_desc->count_processed; count_this_stripe=reduction_desc->count_this_stripe; /* error conditions already checed */ - ompi_ddt_type_extent(dtype, &dt_extent); - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + ompi_datatype_type_extent(dtype, &dt_extent); + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -387,8 +387,8 @@ int progress_fanin_fanout( void *sbuf, void *rbuf, /* copy-in only the first time through */ count_processed=reduction_desc->count_processed; /* error conditions already checed */ - ompi_ddt_type_extent(dtype, &dt_extent); - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + ompi_datatype_type_extent(dtype, &dt_extent); + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -469,8 +469,8 @@ REDUCTION_FANOUT: count_processed=reduction_desc->count_processed; count_this_stripe=reduction_desc->count_this_stripe; /* error conditions already checed */ - ompi_ddt_type_extent(dtype, &dt_extent); - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + ompi_datatype_type_extent(dtype, &dt_extent); + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)rbuf+dt_extent*count_processed, (char *)parent_data_pointer); if( 0 != rc ) { @@ -504,7 +504,7 @@ REDUCTION_FANOUT: /* copy the data to my shared buffer, for access by children */ count_this_stripe=reduction_desc->count_this_stripe; - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer,(char *)parent_data_pointer); if( 0 != rc ) { return OMPI_ERROR; @@ -522,8 +522,8 @@ REDUCTION_FANOUT: count_processed=reduction_desc->count_processed; count_this_stripe=reduction_desc->count_this_stripe; /* error conditions already checed */ - ompi_ddt_type_extent(dtype, &dt_extent); - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + ompi_datatype_type_extent(dtype, &dt_extent); + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)rbuf+dt_extent*count_processed, (char *)my_data_pointer); if( 0 != rc ) { @@ -544,8 +544,8 @@ REDUCTION_FANOUT: count_processed=reduction_desc->count_processed; count_this_stripe=reduction_desc->count_this_stripe; /* error conditions already checed */ - ompi_ddt_type_extent(dtype, &dt_extent); - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + ompi_datatype_type_extent(dtype, &dt_extent); + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)((char *)rbuf+dt_extent*count_processed), (char *)my_data_pointer); if( 0 != rc ) { @@ -595,7 +595,7 @@ int mca_coll_sm2_allreduce_intra_fanin_fanout_pipeline /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_extent(dtype, &dt_extent); + rc=ompi_datatype_type_extent(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } @@ -803,7 +803,7 @@ int mca_coll_sm2_allreduce_intra_recursive_doubling(void *sbuf, void *rbuf, /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_extent(dtype, &dt_extent); + rc=ompi_datatype_type_extent(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } @@ -868,7 +868,7 @@ int mca_coll_sm2_allreduce_intra_recursive_doubling(void *sbuf, void *rbuf, my_tmp_data_buffer[1]=my_read_pointer; /* copy data into the write buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_write_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -927,7 +927,7 @@ int mca_coll_sm2_allreduce_intra_recursive_doubling(void *sbuf, void *rbuf, extra_rank_write_data_pointer+=(n_my_count*dt_extent); if( 0 < (count_this_stripe-n_my_count) ) { - rc=ompi_ddt_copy_content_same_ddt(dtype, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe-n_my_count, (char *)(my_write_pointer+n_my_count*dt_extent), (char *)extra_rank_write_data_pointer); @@ -1079,7 +1079,7 @@ int mca_coll_sm2_allreduce_intra_recursive_doubling(void *sbuf, void *rbuf, /* write the data into my read buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_write_pointer, (char *)extra_rank_read_data_pointer); if( 0 != rc ) { @@ -1122,7 +1122,7 @@ int mca_coll_sm2_allreduce_intra_recursive_doubling(void *sbuf, void *rbuf, t8=opal_sys_timer_get_cycles(); end debug */ /* copy data into the destination buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)((char *)rbuf+dt_extent*count_processed), (char *)my_write_pointer); if( 0 != rc ) { @@ -1203,7 +1203,7 @@ int mca_coll_sm2_allreduce_intra_reducescatter_allgather(void *sbuf, void *rbuf, /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_extent(dtype, &dt_extent); + rc=ompi_datatype_type_extent(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } @@ -1267,7 +1267,7 @@ int mca_coll_sm2_allreduce_intra_reducescatter_allgather(void *sbuf, void *rbuf, /* copy data into the write buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_base_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -1327,7 +1327,7 @@ int mca_coll_sm2_allreduce_intra_reducescatter_allgather(void *sbuf, void *rbuf, extra_rank_write_data_pointer+=(n_my_count*dt_extent); if( 0 < (count_this_stripe-n_my_count) ) { - rc=ompi_ddt_copy_content_same_ddt(dtype, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe-n_my_count, (char *)(my_base_pointer+n_my_count*dt_extent), (char *)extra_rank_write_data_pointer); @@ -1502,7 +1502,7 @@ int mca_coll_sm2_allreduce_intra_reducescatter_allgather(void *sbuf, void *rbuf, opal_progress(); } /* copy data into the destination buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, + rc=ompi_datatype_copy_content_same_ddt(dtype, sm_module->scratch_space[n_copy], (char *)((char *)rbuf+ dt_extent*(count_processed+cnt_offset)), @@ -1579,7 +1579,7 @@ int mca_coll_sm2_allreduce_intra_recursive_doubling(void *sbuf, void *rbuf, /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_size(dtype, &dt_extent); + rc=ompi_datatype_type_size(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } @@ -1649,7 +1649,7 @@ int mca_coll_sm2_allreduce_intra_recursive_doubling(void *sbuf, void *rbuf, end debug */ /* copy data into the write buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_write_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -1801,7 +1801,7 @@ int mca_coll_sm2_allreduce_intra_recursive_doubling(void *sbuf, void *rbuf, /* write the data into my read buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_write_pointer, (char *)extra_rank_read_data_pointer); if( 0 != rc ) { @@ -1845,7 +1845,7 @@ int mca_coll_sm2_allreduce_intra_recursive_doubling(void *sbuf, void *rbuf, t8=opal_sys_timer_get_cycles(); end debug */ /* copy data into the destination buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)((char *)rbuf+dt_extent*count_processed), (char *)my_write_pointer); if( 0 != rc ) { @@ -1888,7 +1888,7 @@ int mca_coll_sm2_allreduce_intra(void *sbuf, void *rbuf, int count, /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_extent(dtype, &dt_extent); + rc=ompi_datatype_type_extent(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } diff --git a/ompi/mca/coll/sm2/coll_sm2_bcast.c b/ompi/mca/coll/sm2/coll_sm2_bcast.c index ea427ce8b9..6fa94c1100 100644 --- a/ompi/mca/coll/sm2/coll_sm2_bcast.c +++ b/ompi/mca/coll/sm2/coll_sm2_bcast.c @@ -12,7 +12,7 @@ #include "ompi/constants.h" #include "coll_sm2.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" /* debug #include "opal/sys/timer.h" @@ -63,7 +63,7 @@ int mca_coll_sm2_fanout(void *buf, int count, /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_extent(dtype, &dt_extent); + rc=ompi_datatype_type_extent(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } @@ -120,7 +120,7 @@ int mca_coll_sm2_fanout(void *buf, int count, if( ROOT_NODE == my_fanout_read_tree->my_node_type ) { /* copy data to user supplied buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer, (char *)((char *)buf+dt_extent*count_processed)); if( 0 != rc ) { @@ -148,7 +148,7 @@ int mca_coll_sm2_fanout(void *buf, int count, } /* copy data to user supplied buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)buf+dt_extent*count_processed, (char *)parent_data_pointer); if( 0 != rc ) { @@ -171,7 +171,7 @@ int mca_coll_sm2_fanout(void *buf, int count, } /* copy the data to my shared buffer, for access by children */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer,(char *)parent_data_pointer); if( 0 != rc ) { return OMPI_ERROR; @@ -186,7 +186,7 @@ int mca_coll_sm2_fanout(void *buf, int count, my_ctl_pointer->flag=tag; /* copy data to user supplied buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)buf+dt_extent*count_processed, (char *)my_data_pointer); if( 0 != rc ) { diff --git a/ompi/mca/coll/sm2/coll_sm2_reduce.c b/ompi/mca/coll/sm2/coll_sm2_reduce.c index 2163297c7f..2ba0a5138e 100644 --- a/ompi/mca/coll/sm2/coll_sm2_reduce.c +++ b/ompi/mca/coll/sm2/coll_sm2_reduce.c @@ -13,7 +13,7 @@ #include "ompi/constants.h" #include "coll_sm2.h" #include "ompi/op/op.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" /* debug #include "opal/sys/timer.h" @@ -64,7 +64,7 @@ int mca_coll_sm2_reduce_intra_fanin(void *sbuf, void *rbuf, int count, /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_extent(dtype, &dt_extent); + rc=ompi_datatype_type_extent(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } @@ -124,7 +124,7 @@ int mca_coll_sm2_reduce_intra_fanin(void *sbuf, void *rbuf, int count, /* * copy local data from source buffer to result buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)rbuf, (char *)sbuf); if( 0 != rc ) { @@ -171,7 +171,7 @@ int mca_coll_sm2_reduce_intra_fanin(void *sbuf, void *rbuf, int count, * provids only 2 buffers, so can't add from two * into a third buffer. */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer, (char *)sbuf); if( 0 != rc ) { @@ -228,7 +228,7 @@ int mca_coll_sm2_reduce_intra_fanin(void *sbuf, void *rbuf, int count, /* copy segment into shared buffer - later on will optimize to * eliminate extra copies. */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer, (char *)sbuf); if( 0 != rc ) { @@ -283,7 +283,7 @@ int mca_coll_sm2_reduce_intra_fanin(void *sbuf, void *rbuf, int count, * provids only 2 buffers, so can't add from two * into a third buffer. */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -337,7 +337,7 @@ int mca_coll_sm2_reduce_intra_fanin(void *sbuf, void *rbuf, int count, /* copy data to destination */ if( ROOT_NODE == my_reduction_node->my_node_type ) { /* copy data to user supplied buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)rbuf+dt_extent*count_processed, (char *)my_data_pointer); if( 0 != rc ) { @@ -350,7 +350,7 @@ int mca_coll_sm2_reduce_intra_fanin(void *sbuf, void *rbuf, int count, /* copy segment into shared buffer - later on will optimize to * eliminate extra copies. */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_data_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -430,7 +430,7 @@ int mca_coll_sm2_reduce_intra_reducescatter_gather(void *sbuf, void *rbuf, /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_extent(dtype, &dt_extent); + rc=ompi_datatype_type_extent(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } @@ -494,7 +494,7 @@ int mca_coll_sm2_reduce_intra_reducescatter_gather(void *sbuf, void *rbuf, /* copy data into the write buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, count_this_stripe, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe, (char *)my_base_pointer, (char *)((char *)sbuf+dt_extent*count_processed)); if( 0 != rc ) { @@ -565,7 +565,7 @@ int mca_coll_sm2_reduce_intra_reducescatter_gather(void *sbuf, void *rbuf, extra_rank_write_data_pointer+=(n_my_count*dt_extent); if( 0 < (count_this_stripe-n_my_count) ) { - rc=ompi_ddt_copy_content_same_ddt(dtype, + rc=ompi_datatype_copy_content_same_ddt(dtype, count_this_stripe-n_my_count, (char *)(my_base_pointer+n_my_count*dt_extent), (char *)extra_rank_write_data_pointer); @@ -753,7 +753,7 @@ int mca_coll_sm2_reduce_intra_reducescatter_gather(void *sbuf, void *rbuf, opal_progress(); } /* copy data into the destination buffer */ - rc=ompi_ddt_copy_content_same_ddt(dtype, + rc=ompi_datatype_copy_content_same_ddt(dtype, sm_module->scratch_space[n_copy], (char *)((char *)rbuf+ dt_extent*(count_processed+cnt_offset)), @@ -808,7 +808,7 @@ int mca_coll_sm2_reduce_intra(void *sbuf, void *rbuf, int count, /* get size of data needed - same layout as user data, so that * we can apply the reudction routines directly on these buffers */ - rc=ompi_ddt_type_extent(dtype, &dt_extent); + rc=ompi_datatype_type_extent(dtype, &dt_extent); if( OMPI_SUCCESS != rc ) { goto Error; } diff --git a/ompi/mca/coll/tuned/coll_tuned_allgather.c b/ompi/mca/coll/tuned/coll_tuned_allgather.c index ee59e0a470..8bcc151211 100644 --- a/ompi/mca/coll/tuned/coll_tuned_allgather.c +++ b/ompi/mca/coll/tuned/coll_tuned_allgather.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -98,10 +98,10 @@ int ompi_coll_tuned_allgather_intra_bruck(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:allgather_intra_bruck rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &slb, &sext); + err = ompi_datatype_get_extent (sdtype, &slb, &sext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &rlb, &rext); + err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Initialization step: @@ -112,12 +112,12 @@ int ompi_coll_tuned_allgather_intra_bruck(void *sbuf, int scount, tmprecv = (char*) rbuf; if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; - err = ompi_ddt_sndrcv(tmpsend, scount, sdtype, tmprecv, rcount, rdtype); + err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, tmprecv, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } else if (0 != rank) { tmpsend = ((char*)rbuf) + rank * rcount * rext; - err = ompi_ddt_copy_content_same_ddt(rdtype, rcount, tmprecv, tmpsend); + err = ompi_datatype_copy_content_same_ddt(rdtype, rcount, tmprecv, tmpsend); if (err < 0) { line = __LINE__; goto err_hndl; } } @@ -169,7 +169,7 @@ int ompi_coll_tuned_allgather_intra_bruck(void *sbuf, int scount, ptrdiff_t true_extent, true_lb; char *free_buf = NULL, *shift_buf = NULL; - err = ompi_ddt_get_true_extent(rdtype, &true_lb, &true_extent); + err = ompi_datatype_get_true_extent(rdtype, &true_lb, &true_extent); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } free_buf = (char*) calloc(((true_extent + @@ -181,19 +181,19 @@ int ompi_coll_tuned_allgather_intra_bruck(void *sbuf, int scount, shift_buf = free_buf - rlb; tmpsend = (char*) rbuf; - err = ompi_ddt_copy_content_same_ddt(rdtype, ((size - rank) * rcount), + err = ompi_datatype_copy_content_same_ddt(rdtype, ((size - rank) * rcount), shift_buf, tmpsend); if (err < 0) { line = __LINE__; goto err_hndl; } tmprecv = (char*) rbuf; tmpsend = (char*) rbuf + (size - rank) * rcount * rext; - err = ompi_ddt_copy_content_same_ddt(rdtype, rank * rcount, + err = ompi_datatype_copy_content_same_ddt(rdtype, rank * rcount, tmprecv, tmpsend); if (err < 0) { line = __LINE__; goto err_hndl; } tmprecv = (char*) rbuf + rank * rcount * rext; - err = ompi_ddt_copy_content_same_ddt(rdtype, (size - rank) * rcount, + err = ompi_datatype_copy_content_same_ddt(rdtype, (size - rank) * rcount, tmprecv, shift_buf); if (err < 0) { line = __LINE__; goto err_hndl; } @@ -292,10 +292,10 @@ ompi_coll_tuned_allgather_intra_recursivedoubling(void *sbuf, int scount, "coll:tuned:allgather_intra_recursivedoubling rank %d, size %d", rank, size)); - err = ompi_ddt_get_extent (sdtype, &slb, &sext); + err = ompi_datatype_get_extent (sdtype, &slb, &sext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &rlb, &rext); + err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Initialization step: @@ -305,7 +305,7 @@ ompi_coll_tuned_allgather_intra_recursivedoubling(void *sbuf, int scount, if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; tmprecv = (char*) rbuf + rank * rcount * rext; - err = ompi_ddt_sndrcv(tmpsend, scount, sdtype, tmprecv, rcount, rdtype); + err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, tmprecv, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -383,10 +383,10 @@ int ompi_coll_tuned_allgather_intra_ring(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:allgather_intra_ring rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &slb, &sext); + err = ompi_datatype_get_extent (sdtype, &slb, &sext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &rlb, &rext); + err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Initialization step: @@ -396,7 +396,7 @@ int ompi_coll_tuned_allgather_intra_ring(void *sbuf, int scount, tmprecv = (char*) rbuf + rank * rcount * rext; if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; - err = ompi_ddt_sndrcv(tmpsend, scount, sdtype, tmprecv, rcount, rdtype); + err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, tmprecv, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -524,10 +524,10 @@ ompi_coll_tuned_allgather_intra_neighborexchange(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:allgather_intra_neighborexchange rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &slb, &sext); + err = ompi_datatype_get_extent (sdtype, &slb, &sext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &rlb, &rext); + err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Initialization step: @@ -537,7 +537,7 @@ ompi_coll_tuned_allgather_intra_neighborexchange(void *sbuf, int scount, tmprecv = (char*) rbuf + rank * rcount * rext; if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; - err = ompi_ddt_sndrcv(tmpsend, scount, sdtype, tmprecv, rcount, rdtype); + err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, tmprecv, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -631,10 +631,10 @@ int ompi_coll_tuned_allgather_intra_two_procs(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allgather_intra_two_procs rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &lb, &sext); + err = ompi_datatype_get_extent (sdtype, &lb, &sext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &lb, &rext); + err = ompi_datatype_get_extent (rdtype, &lb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Exchange data: @@ -660,7 +660,7 @@ int ompi_coll_tuned_allgather_intra_two_procs(void *sbuf, int scount, /* Place your data in correct location if necessary */ if (MPI_IN_PLACE != sbuf) { - err = ompi_ddt_sndrcv((char*)sbuf, scount, sdtype, + err = ompi_datatype_sndrcv((char*)sbuf, scount, sdtype, (char*)rbuf + rank * rcount * rext, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -713,7 +713,7 @@ ompi_coll_tuned_allgather_intra_basic_linear(void *sbuf, int scount, as sbuf and avoid using a temporary buffer if gather is implemented correctly */ if (MPI_IN_PLACE == sbuf && 0 != ompi_comm_rank(comm)) { - ompi_ddt_get_extent(rdtype, &lb, &extent); + ompi_datatype_get_extent(rdtype, &lb, &extent); sbuf = ((char*) rbuf) + (ompi_comm_rank(comm) * extent * rcount); sdtype = rdtype; scount = rcount; diff --git a/ompi/mca/coll/tuned/coll_tuned_allgatherv.c b/ompi/mca/coll/tuned/coll_tuned_allgatherv.c index 1d45db6761..baf2dc86d7 100644 --- a/ompi/mca/coll/tuned/coll_tuned_allgatherv.c +++ b/ompi/mca/coll/tuned/coll_tuned_allgatherv.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -107,10 +107,10 @@ int ompi_coll_tuned_allgatherv_intra_bruck(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:allgather_intra_bruck rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &slb, &sext); + err = ompi_datatype_get_extent (sdtype, &slb, &sext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &rlb, &rext); + err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Initialization step: @@ -120,7 +120,7 @@ int ompi_coll_tuned_allgatherv_intra_bruck(void *sbuf, int scount, tmprecv = (char*) rbuf + rdispls[rank] * rext; if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; - err = ompi_ddt_sndrcv(tmpsend, scount, sdtype, + err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, tmprecv, rcounts[rank], rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -166,15 +166,15 @@ int ompi_coll_tuned_allgatherv_intra_bruck(void *sbuf, int scount, new_rcounts[i] = rcounts[tmp_rrank]; new_rdispls[i] = rdispls[tmp_rrank]; } - err = ompi_ddt_create_indexed(blockcount, new_scounts, new_sdispls, + err = ompi_datatype_create_indexed(blockcount, new_scounts, new_sdispls, rdtype, &new_sdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_create_indexed(blockcount, new_rcounts, new_rdispls, + err = ompi_datatype_create_indexed(blockcount, new_rcounts, new_rdispls, rdtype, &new_rdtype); - err = ompi_ddt_commit(&new_sdtype); + err = ompi_datatype_commit(&new_sdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_commit(&new_rdtype); + err = ompi_datatype_commit(&new_rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Sendreceive */ @@ -183,8 +183,8 @@ int ompi_coll_tuned_allgatherv_intra_bruck(void *sbuf, int scount, rbuf, 1, new_rdtype, recvfrom, MCA_COLL_BASE_TAG_ALLGATHERV, comm, MPI_STATUS_IGNORE, rank); - ompi_ddt_destroy(&new_sdtype); - ompi_ddt_destroy(&new_rdtype); + ompi_datatype_destroy(&new_sdtype); + ompi_datatype_destroy(&new_rdtype); } @@ -236,10 +236,10 @@ int ompi_coll_tuned_allgatherv_intra_ring(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:allgatherv_intra_ring rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &slb, &sext); + err = ompi_datatype_get_extent (sdtype, &slb, &sext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &rlb, &rext); + err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Initialization step: @@ -249,7 +249,7 @@ int ompi_coll_tuned_allgatherv_intra_ring(void *sbuf, int scount, tmprecv = (char*) rbuf + rdisps[rank] * rext; if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; - err = ompi_ddt_sndrcv(tmpsend, scount, sdtype, + err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, tmprecv, rcounts[rank], rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -382,10 +382,10 @@ ompi_coll_tuned_allgatherv_intra_neighborexchange(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:allgatherv_intra_neighborexchange rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &slb, &sext); + err = ompi_datatype_get_extent (sdtype, &slb, &sext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &rlb, &rext); + err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Initialization step: @@ -395,7 +395,7 @@ ompi_coll_tuned_allgatherv_intra_neighborexchange(void *sbuf, int scount, tmprecv = (char*) rbuf + rdispls[rank] * rext; if (MPI_IN_PLACE != sbuf) { tmpsend = (char*) sbuf; - err = ompi_ddt_sndrcv(tmpsend, scount, sdtype, + err = ompi_datatype_sndrcv(tmpsend, scount, sdtype, tmprecv, rcounts[rank], rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -457,20 +457,20 @@ ompi_coll_tuned_allgatherv_intra_neighborexchange(void *sbuf, int scount, new_scounts[1] = rcounts[(send_data_from + 1)]; new_sdispls[0] = rdispls[send_data_from]; new_sdispls[1] = rdispls[(send_data_from + 1)]; - err = ompi_ddt_create_indexed(2, new_scounts, new_sdispls, rdtype, + err = ompi_datatype_create_indexed(2, new_scounts, new_sdispls, rdtype, &new_sdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_commit(&new_sdtype); + err = ompi_datatype_commit(&new_sdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } new_rcounts[0] = rcounts[recv_data_from[i_parity]]; new_rcounts[1] = rcounts[(recv_data_from[i_parity] + 1)]; new_rdispls[0] = rdispls[recv_data_from[i_parity]]; new_rdispls[1] = rdispls[(recv_data_from[i_parity] + 1)]; - err = ompi_ddt_create_indexed(2, new_rcounts, new_rdispls, rdtype, + err = ompi_datatype_create_indexed(2, new_rcounts, new_rdispls, rdtype, &new_rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_commit(&new_rdtype); + err = ompi_datatype_commit(&new_rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } tmprecv = (char*)rbuf; @@ -486,8 +486,8 @@ ompi_coll_tuned_allgatherv_intra_neighborexchange(void *sbuf, int scount, send_data_from = recv_data_from[i_parity]; - ompi_ddt_destroy(&new_sdtype); - ompi_ddt_destroy(&new_rdtype); + ompi_datatype_destroy(&new_sdtype); + ompi_datatype_destroy(&new_rdtype); } return OMPI_SUCCESS; @@ -518,10 +518,10 @@ int ompi_coll_tuned_allgatherv_intra_two_procs(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allgatherv_intra_two_procs rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &lb, &sext); + err = ompi_datatype_get_extent (sdtype, &lb, &sext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &lb, &rext); + err = ompi_datatype_get_extent (rdtype, &lb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* Exchange data: @@ -547,7 +547,7 @@ int ompi_coll_tuned_allgatherv_intra_two_procs(void *sbuf, int scount, /* Place your data in correct location if necessary */ if (MPI_IN_PLACE != sbuf) { - err = ompi_ddt_sndrcv((char*)sbuf, scount, sdtype, + err = ompi_datatype_sndrcv((char*)sbuf, scount, sdtype, (char*)rbuf + rdispls[rank] * rext, rcounts[rank], rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -612,7 +612,7 @@ ompi_coll_tuned_allgatherv_intra_basic_default(void *sbuf, int scount, rank)); if (MPI_IN_PLACE == sbuf) { - ompi_ddt_get_extent(rdtype, &lb, &extent); + ompi_datatype_get_extent(rdtype, &lb, &extent); send_type = rdtype; send_buf = (char*)rbuf; for (i = 0; i < rank; ++i) { @@ -644,12 +644,12 @@ ompi_coll_tuned_allgatherv_intra_basic_default(void *sbuf, int scount, * datatype. */ - err = ompi_ddt_create_indexed(size,rcounts,disps,rdtype,&newtype); + err = ompi_datatype_create_indexed(size,rcounts,disps,rdtype,&newtype); if (MPI_SUCCESS != err) { return err; } - err = ompi_ddt_commit(&newtype); + err = ompi_datatype_commit(&newtype); if(MPI_SUCCESS != err) { return err; } @@ -657,7 +657,7 @@ ompi_coll_tuned_allgatherv_intra_basic_default(void *sbuf, int scount, comm->c_coll.coll_bcast(rbuf, 1, newtype, 0, comm, comm->c_coll.coll_bcast_module); - ompi_ddt_destroy (&newtype); + ompi_datatype_destroy (&newtype); return MPI_SUCCESS; } diff --git a/ompi/mca/coll/tuned/coll_tuned_allreduce.c b/ompi/mca/coll/tuned/coll_tuned_allreduce.c index 3e5acc973d..9460ae8eea 100644 --- a/ompi/mca/coll/tuned/coll_tuned_allreduce.c +++ b/ompi/mca/coll/tuned/coll_tuned_allreduce.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -143,26 +143,26 @@ ompi_coll_tuned_allreduce_intra_recursivedoubling(void *sbuf, void *rbuf, /* Special case for size == 1 */ if (1 == size) { if (MPI_IN_PLACE != sbuf) { - ret = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + ret = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); if (ret < 0) { line = __LINE__; goto error_hndl; } } return MPI_SUCCESS; } /* Allocate and initialize temporary send buffer */ - ret = ompi_ddt_get_extent(dtype, &lb, &extent); + ret = ompi_datatype_get_extent(dtype, &lb, &extent); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } - ret = ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ret = ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } inplacebuf = (char*) malloc(true_extent + (count - 1) * extent); if (NULL == inplacebuf) { ret = -1; line = __LINE__; goto error_hndl; } if (MPI_IN_PLACE == sbuf) { - ret = ompi_ddt_copy_content_same_ddt(dtype, count, inplacebuf, (char*)rbuf); + ret = ompi_datatype_copy_content_same_ddt(dtype, count, inplacebuf, (char*)rbuf); if (ret < 0) { line = __LINE__; goto error_hndl; } } else { - ret = ompi_ddt_copy_content_same_ddt(dtype, count, inplacebuf, (char*)sbuf); + ret = ompi_datatype_copy_content_same_ddt(dtype, count, inplacebuf, (char*)sbuf); if (ret < 0) { line = __LINE__; goto error_hndl; } } @@ -258,7 +258,7 @@ ompi_coll_tuned_allreduce_intra_recursivedoubling(void *sbuf, void *rbuf, /* Ensure that the final result is in rbuf */ if (tmpsend != rbuf) { - ret = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, tmpsend); + ret = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, tmpsend); if (ret < 0) { line = __LINE__; goto error_hndl; } } @@ -363,7 +363,7 @@ ompi_coll_tuned_allreduce_intra_ring(void *sbuf, void *rbuf, int count, /* Special case for size == 1 */ if (1 == size) { if (MPI_IN_PLACE != sbuf) { - ret = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + ret = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); if (ret < 0) { line = __LINE__; goto error_hndl; } } return MPI_SUCCESS; @@ -379,11 +379,11 @@ ompi_coll_tuned_allreduce_intra_ring(void *sbuf, void *rbuf, int count, } /* Allocate and initialize temporary buffers */ - ret = ompi_ddt_get_extent(dtype, &lb, &extent); + ret = ompi_datatype_get_extent(dtype, &lb, &extent); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } - ret = ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ret = ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } - ret = ompi_ddt_type_size( dtype, &typelng); + ret = ompi_datatype_type_size( dtype, &typelng); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } /* Determine the number of elements per block and corresponding @@ -408,7 +408,7 @@ ompi_coll_tuned_allreduce_intra_ring(void *sbuf, void *rbuf, int count, /* Handle MPI_IN_PLACE */ if (MPI_IN_PLACE != sbuf) { - ret = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + ret = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); if (ret < 0) { line = __LINE__; goto error_hndl; } } @@ -644,18 +644,18 @@ ompi_coll_tuned_allreduce_intra_ring_segmented(void *sbuf, void *rbuf, int count /* Special case for size == 1 */ if (1 == size) { if (MPI_IN_PLACE != sbuf) { - ret = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + ret = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); if (ret < 0) { line = __LINE__; goto error_hndl; } } return MPI_SUCCESS; } /* Determine segment count based on the suggested segment size */ - ret = ompi_ddt_get_extent(dtype, &lb, &extent); + ret = ompi_datatype_get_extent(dtype, &lb, &extent); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } - ret = ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ret = ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } - ret = ompi_ddt_type_size( dtype, &typelng); + ret = ompi_datatype_type_size( dtype, &typelng); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } segcount = count; COLL_TUNED_COMPUTED_SEGCOUNT(segsize, typelng, segcount) @@ -699,7 +699,7 @@ ompi_coll_tuned_allreduce_intra_ring_segmented(void *sbuf, void *rbuf, int count /* Handle MPI_IN_PLACE */ if (MPI_IN_PLACE != sbuf) { - ret = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); + ret = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); if (ret < 0) { line = __LINE__; goto error_hndl; } } diff --git a/ompi/mca/coll/tuned/coll_tuned_alltoall.c b/ompi/mca/coll/tuned/coll_tuned_alltoall.c index a843c7ed24..d800c610c2 100644 --- a/ompi/mca/coll/tuned/coll_tuned_alltoall.c +++ b/ompi/mca/coll/tuned/coll_tuned_alltoall.c @@ -20,7 +20,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -48,9 +48,9 @@ int ompi_coll_tuned_alltoall_intra_pairwise(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:alltoall_intra_pairwise rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &lb, &sext); + err = ompi_datatype_get_extent (sdtype, &lb, &sext); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &lb, &rext); + err = ompi_datatype_get_extent (rdtype, &lb, &rext); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } @@ -110,13 +110,13 @@ int ompi_coll_tuned_alltoall_intra_bruck(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:alltoall_intra_bruck rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &slb, &sext); + err = ompi_datatype_get_extent (sdtype, &slb, &sext); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_true_extent(sdtype, &tlb, &tsext); + err = ompi_datatype_get_true_extent(sdtype, &tlb, &tsext); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &rlb, &rext); + err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } @@ -146,7 +146,7 @@ int ompi_coll_tuned_alltoall_intra_bruck(void *sbuf, int scount, tmpbuf = tmpbuf_free - slb; /* Step 1 - local rotation - shift up by rank */ - err = ompi_ddt_copy_content_same_ddt (sdtype, + err = ompi_datatype_copy_content_same_ddt (sdtype, (int32_t) ((size - rank) * scount), tmpbuf, ((char*) sbuf) + rank * scount * sext); @@ -155,7 +155,7 @@ int ompi_coll_tuned_alltoall_intra_bruck(void *sbuf, int scount, } if (rank != 0) { - err = ompi_ddt_copy_content_same_ddt (sdtype, (int32_t) (rank * scount), + err = ompi_datatype_copy_content_same_ddt (sdtype, (int32_t) (rank * scount), tmpbuf + (size - rank) * scount* sext, (char*) sbuf); if (err<0) { @@ -179,10 +179,10 @@ int ompi_coll_tuned_alltoall_intra_bruck(void *sbuf, int scount, } } /* Set indexes and displacements */ - err = ompi_ddt_create_indexed(k, blen, displs, sdtype, &new_ddt); + err = ompi_datatype_create_indexed(k, blen, displs, sdtype, &new_ddt); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } /* Commit the new datatype */ - err = ompi_ddt_commit(&new_ddt); + err = ompi_datatype_commit(&new_ddt); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } /* Sendreceive */ @@ -194,18 +194,18 @@ int ompi_coll_tuned_alltoall_intra_bruck(void *sbuf, int scount, if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } /* Copy back new data from recvbuf to tmpbuf */ - err = ompi_ddt_copy_content_same_ddt(new_ddt, 1,tmpbuf, (char *) rbuf); + err = ompi_datatype_copy_content_same_ddt(new_ddt, 1,tmpbuf, (char *) rbuf); if (err < 0) { line = __LINE__; err = -1; goto err_hndl; } /* free ddt */ - err = ompi_ddt_destroy(&new_ddt); + err = ompi_datatype_destroy(&new_ddt); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } } /* end of for (distance = 1... */ /* Step 3 - local rotation - */ for (i = 0; i < size; i++) { - err = ompi_ddt_copy_content_same_ddt (rdtype, (int32_t) rcount, + err = ompi_datatype_copy_content_same_ddt (rdtype, (int32_t) rcount, ((char*)rbuf) + (((rank - i + size) % size) * rcount * rext), tmpbuf + i * rcount * rext); if (err < 0) { line = __LINE__; err = -1; goto err_hndl; } @@ -277,13 +277,13 @@ int ompi_coll_tuned_alltoall_intra_linear_sync(void *sbuf, int scount, "ompi_coll_tuned_alltoall_intra_linear_sync rank %d", rank)); - error = ompi_ddt_get_extent(sdtype, &slb, &sext); + error = ompi_datatype_get_extent(sdtype, &slb, &sext); if (OMPI_SUCCESS != error) { return error; } sext *= scount; - error = ompi_ddt_get_extent(rdtype, &rlb, &rext); + error = ompi_datatype_get_extent(rdtype, &rlb, &rext); if (OMPI_SUCCESS != error) { return error; } @@ -294,7 +294,7 @@ int ompi_coll_tuned_alltoall_intra_linear_sync(void *sbuf, int scount, psnd = ((char *) sbuf) + (rank * sext); prcv = ((char *) rbuf) + (rank * rext); - error = ompi_ddt_sndrcv(psnd, scount, sdtype, prcv, rcount, rdtype); + error = ompi_datatype_sndrcv(psnd, scount, sdtype, prcv, rcount, rdtype); if (MPI_SUCCESS != error) { return error; } @@ -415,10 +415,10 @@ int ompi_coll_tuned_alltoall_intra_two_procs(void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_alltoall_intra_two_procs rank %d", rank)); - err = ompi_ddt_get_extent (sdtype, &lb, &sext); + err = ompi_datatype_get_extent (sdtype, &lb, &sext); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_get_extent (rdtype, &lb, &rext); + err = ompi_datatype_get_extent (rdtype, &lb, &rext); if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } /* exchange data */ @@ -436,7 +436,7 @@ int ompi_coll_tuned_alltoall_intra_two_procs(void *sbuf, int scount, if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; } /* ddt sendrecv your own data */ - err = ompi_ddt_sndrcv((char*) sbuf + rank * sext * scount, + err = ompi_datatype_sndrcv((char*) sbuf + rank * sext * scount, (int32_t) scount, sdtype, (char*) rbuf + rank * rext * rcount, (int32_t) rcount, rdtype); @@ -502,13 +502,13 @@ int ompi_coll_tuned_alltoall_intra_basic_linear(void *sbuf, int scount, "ompi_coll_tuned_alltoall_intra_basic_linear rank %d", rank)); - err = ompi_ddt_get_extent(sdtype, &lb, &sndinc); + err = ompi_datatype_get_extent(sdtype, &lb, &sndinc); if (OMPI_SUCCESS != err) { return err; } sndinc *= scount; - err = ompi_ddt_get_extent(rdtype, &lb, &rcvinc); + err = ompi_datatype_get_extent(rdtype, &lb, &rcvinc); if (OMPI_SUCCESS != err) { return err; } @@ -519,7 +519,7 @@ int ompi_coll_tuned_alltoall_intra_basic_linear(void *sbuf, int scount, psnd = ((char *) sbuf) + (rank * sndinc); prcv = ((char *) rbuf) + (rank * rcvinc); - err = ompi_ddt_sndrcv(psnd, scount, sdtype, prcv, rcount, rdtype); + err = ompi_datatype_sndrcv(psnd, scount, sdtype, prcv, rcount, rdtype); if (MPI_SUCCESS != err) { return err; } diff --git a/ompi/mca/coll/tuned/coll_tuned_alltoallv.c b/ompi/mca/coll/tuned/coll_tuned_alltoallv.c index f65c1c510f..ba98c2864a 100644 --- a/ompi/mca/coll/tuned/coll_tuned_alltoallv.c +++ b/ompi/mca/coll/tuned/coll_tuned_alltoallv.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -50,14 +50,14 @@ ompi_coll_tuned_alltoallv_intra_pairwise(void *sbuf, int *scounts, int *sdisps, OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:alltoallv_intra_pairwise rank %d", rank)); - ompi_ddt_type_extent(sdtype, &sext); - ompi_ddt_type_extent(rdtype, &rext); + ompi_datatype_type_extent(sdtype, &sext); + ompi_datatype_type_extent(rdtype, &rext); psnd = ((char *) sbuf) + (sdisps[rank] * sext); prcv = ((char *) rbuf) + (rdisps[rank] * rext); if (0 != scounts[rank]) { - err = ompi_ddt_sndrcv(psnd, scounts[rank], sdtype, + err = ompi_datatype_sndrcv(psnd, scounts[rank], sdtype, prcv, rcounts[rank], rdtype); if (MPI_SUCCESS != err) { return err; @@ -129,14 +129,14 @@ ompi_coll_tuned_alltoallv_intra_basic_linear(void *sbuf, int *scounts, int *sdis OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:alltoallv_intra_basic_linear rank %d", rank)); - ompi_ddt_type_extent(sdtype, &sext); - ompi_ddt_type_extent(rdtype, &rext); + ompi_datatype_type_extent(sdtype, &sext); + ompi_datatype_type_extent(rdtype, &rext); /* Simple optimization - handle send to self first */ psnd = ((char *) sbuf) + (sdisps[rank] * sext); prcv = ((char *) rbuf) + (rdisps[rank] * rext); if (0 != scounts[rank]) { - err = ompi_ddt_sndrcv(psnd, scounts[rank], sdtype, + err = ompi_datatype_sndrcv(psnd, scounts[rank], sdtype, prcv, rcounts[rank], rdtype); if (MPI_SUCCESS != err) { return err; diff --git a/ompi/mca/coll/tuned/coll_tuned_bcast.c b/ompi/mca/coll/tuned/coll_tuned_bcast.c index d80d35e970..52cab9c42c 100644 --- a/ompi/mca/coll/tuned/coll_tuned_bcast.c +++ b/ompi/mca/coll/tuned/coll_tuned_bcast.c @@ -20,7 +20,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -58,8 +58,8 @@ ompi_coll_tuned_bcast_intra_generic( void* buffer, rank = ompi_comm_rank(comm); assert( size > 1 ); - ompi_ddt_get_extent (datatype, &lb, &extent); - ompi_ddt_type_size( datatype, &type_size ); + ompi_datatype_get_extent (datatype, &lb, &extent); + ompi_datatype_type_size( datatype, &type_size ); num_segments = (original_count + count_by_segment - 1) / count_by_segment; realsegsize = count_by_segment * extent; @@ -272,7 +272,7 @@ ompi_coll_tuned_bcast_intra_bintree ( void* buffer, /** * Determine number of elements sent per operation. */ - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_type_size( datatype, &typelng ); COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount ); OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:bcast_intra_binary rank %d ss %5d typelng %lu segcount %d", @@ -301,7 +301,7 @@ ompi_coll_tuned_bcast_intra_pipeline( void* buffer, /** * Determine number of elements sent per operation. */ - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_type_size( datatype, &typelng ); COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount ); OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:bcast_intra_pipeline rank %d ss %5d typelng %lu segcount %d", @@ -330,7 +330,7 @@ ompi_coll_tuned_bcast_intra_chain( void* buffer, /** * Determine number of elements sent per operation. */ - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_type_size( datatype, &typelng ); COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount ); OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:bcast_intra_chain rank %d fo %d ss %5d typelng %lu segcount %d", @@ -359,7 +359,7 @@ ompi_coll_tuned_bcast_intra_binomial( void* buffer, /** * Determine number of elements sent per operation. */ - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_type_size( datatype, &typelng ); COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount ); OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:bcast_intra_binomial rank %d ss %5d typelng %lu segcount %d", @@ -407,14 +407,14 @@ ompi_coll_tuned_bcast_intra_split_bintree ( void* buffer, COLL_TUNED_UPDATE_BINTREE( comm, tuned_module, root ); tree = data->cached_bintree; - err = ompi_ddt_type_size( datatype, &type_size ); + err = ompi_datatype_type_size( datatype, &type_size ); /* Determine number of segments and number of elements per segment */ counts[0] = count/2; if (count % 2 != 0) counts[0]++; counts[1] = count - counts[0]; if ( segsize > 0 ) { - /* Note that ompi_ddt_type_size() will never return a negative + /* Note that ompi_datatype_type_size() will never return a negative value in typelng; it returns an int [vs. an unsigned type] because of the MPI spec. */ if (segsize < ((uint32_t) type_size)) { @@ -441,7 +441,7 @@ ompi_coll_tuned_bcast_intra_split_bintree ( void* buffer, segsize, 1 )); } - err = ompi_ddt_get_extent (datatype, &lb, &type_extent); + err = ompi_datatype_get_extent (datatype, &lb, &type_extent); /* Determine real segment size */ realsegsize[0] = segcount[0] * type_extent; diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_dynamic.c b/ompi/mca/coll/tuned/coll_tuned_decision_dynamic.c index a45a01aed2..29e457251b 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_dynamic.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_dynamic.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "opal/mca/base/mca_base_param.h" #include "ompi/mca/coll/base/base.h" @@ -69,7 +69,7 @@ ompi_coll_tuned_allreduce_intra_dec_dynamic (void *sbuf, void *rbuf, int count, int alg, faninout, segsize, ignoreme; size_t dsize; - ompi_ddt_type_size (dtype, &dsize); + ompi_datatype_type_size (dtype, &dsize); dsize *= count; alg = ompi_coll_tuned_get_target_method_params (data->com_rules[ALLREDUCE], @@ -118,7 +118,7 @@ int ompi_coll_tuned_alltoall_intra_dec_dynamic(void *sbuf, int scount, int alg, faninout, segsize, max_requests; size_t dsize; - ompi_ddt_type_size (sdtype, &dsize); + ompi_datatype_type_size (sdtype, &dsize); comsize = ompi_comm_size(comm); dsize *= comsize * scount; @@ -242,7 +242,7 @@ int ompi_coll_tuned_bcast_intra_dec_dynamic(void *buff, int count, int alg, faninout, segsize, ignoreme; size_t dsize; - ompi_ddt_type_size (datatype, &dsize); + ompi_datatype_type_size (datatype, &dsize); dsize *= count; alg = ompi_coll_tuned_get_target_method_params (data->com_rules[BCAST], @@ -291,7 +291,7 @@ int ompi_coll_tuned_reduce_intra_dec_dynamic( void *sendbuf, void *recvbuf, int alg, faninout, segsize, max_requests; size_t dsize; - ompi_ddt_type_size (datatype, &dsize); + ompi_datatype_type_size (datatype, &dsize); dsize *= count; alg = ompi_coll_tuned_get_target_method_params (data->com_rules[REDUCE], @@ -347,7 +347,7 @@ int ompi_coll_tuned_reduce_scatter_intra_dec_dynamic(void *sbuf, void *rbuf, size_t dsize; size = ompi_comm_size(comm); for (i = 0, count = 0; i < size; i++) { count += rcounts[i];} - ompi_ddt_type_size (dtype, &dsize); + ompi_datatype_type_size (dtype, &dsize); dsize *= count; alg = ompi_coll_tuned_get_target_method_params (data->com_rules[REDUCESCATTER], @@ -402,7 +402,7 @@ int ompi_coll_tuned_allgather_intra_dec_dynamic(void *sbuf, int scount, int alg, faninout, segsize, ignoreme; size_t dsize; - ompi_ddt_type_size (sdtype, &dsize); + ompi_datatype_type_size (sdtype, &dsize); comsize = ompi_comm_size(comm); dsize *= comsize * scount; @@ -463,7 +463,7 @@ int ompi_coll_tuned_allgatherv_intra_dec_dynamic(void *sbuf, int scount, size_t dsize, total_size; comsize = ompi_comm_size(comm); - ompi_ddt_type_size (sdtype, &dsize); + ompi_datatype_type_size (sdtype, &dsize); total_size = 0; for (i = 0; i < comsize; i++) { total_size += dsize * rcounts[i]; } diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c index 4b53c1c9d0..933d7bb628 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c @@ -20,7 +20,7 @@ #include "ompi_config.h" #include "mpi.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -54,7 +54,7 @@ ompi_coll_tuned_allreduce_intra_dec_fixed (void *sbuf, void *rbuf, int count, * can handle both commutative and non-commutative operations. * Ring algorithm does not support non-commutative operations. */ - ompi_ddt_type_size(dtype, &dsize); + ompi_datatype_type_size(dtype, &dsize); block_dsize = dsize * count; if (block_dsize < intermediate_message) { @@ -114,7 +114,7 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(void *sbuf, int scount, the University of Tennessee (2GB MX) up to 64 nodes. Has better performance for messages of intermediate sizes than the old one */ /* determine block size */ - ompi_ddt_type_size(sdtype, &dsize); + ompi_datatype_type_size(sdtype, &dsize); block_dsize = dsize * scount; if ((block_dsize < 200) && (communicator_size > 12)) { @@ -136,7 +136,7 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(void *sbuf, int scount, /* previous decision */ /* else we need data size for decision function */ - ompi_ddt_type_size(sdtype, &dsize); + ompi_datatype_type_size(sdtype, &dsize); total_dsize = dsize * scount * communicator_size; /* needed for decision */ OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_alltoall_intra_dec_fixed rank %d com_size %d msg_length %ld", @@ -239,7 +239,7 @@ int ompi_coll_tuned_bcast_intra_dec_fixed(void *buff, int count, communicator_size = ompi_comm_size(comm); /* else we need data size for decision function */ - ompi_ddt_type_size(datatype, &dsize); + ompi_datatype_type_size(datatype, &dsize); message_size = dsize * (unsigned long)count; /* needed for decision */ OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_bcast_intra_dec_fixed" @@ -358,7 +358,7 @@ int ompi_coll_tuned_reduce_intra_dec_fixed( void *sendbuf, void *recvbuf, communicator_size = ompi_comm_size(comm); /* need data size for decision function */ - ompi_ddt_type_size(datatype, &dsize); + ompi_datatype_type_size(datatype, &dsize); message_size = dsize * count; /* needed for decision */ /** @@ -471,7 +471,7 @@ int ompi_coll_tuned_reduce_scatter_intra_dec_fixed( void *sbuf, void *rbuf, comm_size = ompi_comm_size(comm); /* We need data size for decision function */ - ompi_ddt_type_size(dtype, &dsize); + ompi_datatype_type_size(dtype, &dsize); total_message_size = 0; for (i = 0; i < comm_size; i++) { total_message_size += rcounts[i]; @@ -533,7 +533,7 @@ int ompi_coll_tuned_allgather_intra_dec_fixed(void *sbuf, int scount, } /* Determine complete data size */ - ompi_ddt_type_size(sdtype, &dsize); + ompi_datatype_type_size(sdtype, &dsize); total_dsize = dsize * scount * communicator_size; OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allgather_intra_dec_fixed" @@ -628,7 +628,7 @@ int ompi_coll_tuned_allgatherv_intra_dec_fixed(void *sbuf, int scount, } /* Determine complete data size */ - ompi_ddt_type_size(sdtype, &dsize); + ompi_datatype_type_size(sdtype, &dsize); total_dsize = 0; for (i = 0; i < communicator_size; i++) { total_dsize += dsize * rcounts[i]; @@ -695,10 +695,10 @@ int ompi_coll_tuned_gather_intra_dec_fixed(void *sbuf, int scount, /* Determine block size */ if (rank == root) { - ompi_ddt_type_size(rdtype, &dsize); + ompi_datatype_type_size(rdtype, &dsize); block_size = dsize * rcount; } else { - ompi_ddt_type_size(sdtype, &dsize); + ompi_datatype_type_size(sdtype, &dsize); block_size = dsize * scount; } @@ -756,10 +756,10 @@ int ompi_coll_tuned_scatter_intra_dec_fixed(void *sbuf, int scount, rank = ompi_comm_rank(comm); /* Determine block size */ if (root == rank) { - ompi_ddt_type_size(sdtype, &dsize); + ompi_datatype_type_size(sdtype, &dsize); block_size = dsize * scount; } else { - ompi_ddt_type_size(rdtype, &dsize); + ompi_datatype_type_size(rdtype, &dsize); block_size = dsize * rcount; } diff --git a/ompi/mca/coll/tuned/coll_tuned_gather.c b/ompi/mca/coll/tuned/coll_tuned_gather.c index ce81caa2e8..d21bb63e0e 100644 --- a/ompi/mca/coll/tuned/coll_tuned_gather.c +++ b/ompi/mca/coll/tuned/coll_tuned_gather.c @@ -20,7 +20,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -67,10 +67,10 @@ ompi_coll_tuned_gather_intra_binomial(void *sbuf, int scount, COLL_TUNED_UPDATE_IN_ORDER_BMTREE( comm, tuned_module, root ); bmtree = data->cached_in_order_bmtree; - ompi_ddt_get_extent(sdtype, &slb, &sextent); - ompi_ddt_get_true_extent(sdtype, &strue_lb, &strue_extent); - ompi_ddt_get_extent(rdtype, &rlb, &rextent); - ompi_ddt_get_true_extent(rdtype, &rtrue_lb, &rtrue_extent); + ompi_datatype_get_extent(sdtype, &slb, &sextent); + ompi_datatype_get_true_extent(sdtype, &strue_lb, &strue_extent); + ompi_datatype_get_extent(rdtype, &rlb, &rextent); + ompi_datatype_get_true_extent(rdtype, &rtrue_lb, &rtrue_extent); vrank = (rank - root + size) % size; @@ -79,7 +79,7 @@ ompi_coll_tuned_gather_intra_binomial(void *sbuf, int scount, /* root on 0, just use the recv buffer */ ptmp = (char *) rbuf; if (sbuf != MPI_IN_PLACE) { - err = ompi_ddt_sndrcv(sbuf, scount, sdtype, + err = ompi_datatype_sndrcv(sbuf, scount, sdtype, ptmp, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -94,12 +94,12 @@ ompi_coll_tuned_gather_intra_binomial(void *sbuf, int scount, ptmp = tempbuf - rlb; if (sbuf != MPI_IN_PLACE) { /* copy from sbuf to temp buffer */ - err = ompi_ddt_sndrcv(sbuf, scount, sdtype, + err = ompi_datatype_sndrcv(sbuf, scount, sdtype, ptmp, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } else { /* copy from rbuf to temp buffer */ - err = ompi_ddt_copy_content_same_ddt(rdtype, rcount, ptmp, + err = ompi_datatype_copy_content_same_ddt(rdtype, rcount, ptmp, (char *) rbuf + rank*rextent*rcount); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -116,7 +116,7 @@ ompi_coll_tuned_gather_intra_binomial(void *sbuf, int scount, ptmp = tempbuf - slb; /* local copy to tempbuf */ - err = ompi_ddt_sndrcv(sbuf, scount, sdtype, + err = ompi_datatype_sndrcv(sbuf, scount, sdtype, ptmp, scount, sdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -173,12 +173,12 @@ ompi_coll_tuned_gather_intra_binomial(void *sbuf, int scount, if (rank == root) { if (root != 0) { /* rotate received data on root if root != 0 */ - err = ompi_ddt_copy_content_same_ddt(rdtype, rcount*(size - root), + err = ompi_datatype_copy_content_same_ddt(rdtype, rcount*(size - root), (char *) rbuf + rextent*root*rcount, ptmp); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_copy_content_same_ddt(rdtype, rcount*root, + err = ompi_datatype_copy_content_same_ddt(rdtype, rcount*root, (char *) rbuf, ptmp + rextent*rcount*(size-root)); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -238,8 +238,8 @@ ompi_coll_tuned_gather_intra_linear_sync(void *sbuf, int scount, - send the second segment of the data. */ - ompi_ddt_type_size(sdtype, &typelng); - ompi_ddt_get_extent(sdtype, &lb, &extent); + ompi_datatype_type_size(sdtype, &typelng); + ompi_datatype_get_extent(sdtype, &lb, &extent); first_segment_count = scount; COLL_TUNED_COMPUTED_SEGCOUNT( (size_t) first_segment_size, typelng, first_segment_count ); @@ -276,8 +276,8 @@ ompi_coll_tuned_gather_intra_linear_sync(void *sbuf, int scount, reqs = (ompi_request_t**) calloc(size, sizeof(ompi_request_t*)); if (NULL == reqs) { ret = -1; line = __LINE__; goto error_hndl; } - ompi_ddt_type_size(rdtype, &typelng); - ompi_ddt_get_extent(rdtype, &lb, &extent); + ompi_datatype_type_size(rdtype, &typelng); + ompi_datatype_get_extent(rdtype, &lb, &extent); first_segment_count = rcount; COLL_TUNED_COMPUTED_SEGCOUNT( (size_t)first_segment_size, typelng, first_segment_count ); @@ -317,7 +317,7 @@ ompi_coll_tuned_gather_intra_linear_sync(void *sbuf, int scount, /* copy local data if necessary */ if (MPI_IN_PLACE != sbuf) { - ret = ompi_ddt_sndrcv(sbuf, scount, sdtype, + ret = ompi_datatype_sndrcv(sbuf, scount, sdtype, (char*)rbuf + rank * rcount * extent, rcount, rdtype); if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; } @@ -393,12 +393,12 @@ ompi_coll_tuned_gather_intra_basic_linear(void *sbuf, int scount, /* I am the root, loop receiving the data. */ - ompi_ddt_get_extent(rdtype, &lb, &extent); + ompi_datatype_get_extent(rdtype, &lb, &extent); incr = extent * rcount; for (i = 0, ptmp = (char *) rbuf; i < size; ++i, ptmp += incr) { if (i == rank) { if (MPI_IN_PLACE != sbuf) { - err = ompi_ddt_sndrcv(sbuf, scount, sdtype, + err = ompi_datatype_sndrcv(sbuf, scount, sdtype, ptmp, rcount, rdtype); } else { err = MPI_SUCCESS; diff --git a/ompi/mca/coll/tuned/coll_tuned_reduce.c b/ompi/mca/coll/tuned/coll_tuned_reduce.c index 13438c91b4..9cdaec127c 100644 --- a/ompi/mca/coll/tuned/coll_tuned_reduce.c +++ b/ompi/mca/coll/tuned/coll_tuned_reduce.c @@ -20,7 +20,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -60,8 +60,8 @@ int ompi_coll_tuned_reduce_generic( void* sendbuf, void* recvbuf, int original_c * Determine number of segments and number of elements * sent per operation */ - ompi_ddt_get_extent( datatype, &lower_bound, &extent ); - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_get_extent( datatype, &lower_bound, &extent ); + ompi_datatype_type_size( datatype, &typelng ); num_segments = (original_count + count_by_segment - 1) / count_by_segment; segment_increment = count_by_segment * extent; @@ -78,7 +78,7 @@ int ompi_coll_tuned_reduce_generic( void* sendbuf, void* recvbuf, int original_c (if needed) */ if( tree->tree_nextsize > 0 ) { ptrdiff_t true_lower_bound, true_extent, real_segment_size; - ompi_ddt_get_true_extent( datatype, &true_lower_bound, + ompi_datatype_get_true_extent( datatype, &true_lower_bound, &true_extent ); /* handle non existant recv buffer (i.e. its NULL) and @@ -97,7 +97,7 @@ int ompi_coll_tuned_reduce_generic( void* sendbuf, void* recvbuf, int original_c /* If this is a non-commutative operation we must copy sendbuf to the accumbuf, in order to simplfy the loops */ if (!ompi_op_is_commute(op)) { - ompi_ddt_copy_content_same_ddt(datatype, original_count, + ompi_datatype_copy_content_same_ddt(datatype, original_count, (char*)accumbuf, (char*)sendtmpbuf); } @@ -362,7 +362,7 @@ int ompi_coll_tuned_reduce_intra_chain( void *sendbuf, void *recvbuf, int count, * Determine number of segments and number of elements * sent per operation */ - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_type_size( datatype, &typelng ); COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount ); return ompi_coll_tuned_reduce_generic( sendbuf, recvbuf, count, datatype, @@ -394,7 +394,7 @@ int ompi_coll_tuned_reduce_intra_pipeline( void *sendbuf, void *recvbuf, * Determine number of segments and number of elements * sent per operation */ - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_type_size( datatype, &typelng ); COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount ); return ompi_coll_tuned_reduce_generic( sendbuf, recvbuf, count, datatype, @@ -425,7 +425,7 @@ int ompi_coll_tuned_reduce_intra_binary( void *sendbuf, void *recvbuf, * Determine number of segments and number of elements * sent per operation */ - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_type_size( datatype, &typelng ); COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount ); return ompi_coll_tuned_reduce_generic( sendbuf, recvbuf, count, datatype, @@ -456,7 +456,7 @@ int ompi_coll_tuned_reduce_intra_binomial( void *sendbuf, void *recvbuf, * Determine number of segments and number of elements * sent per operation */ - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_type_size( datatype, &typelng ); COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount ); return ompi_coll_tuned_reduce_generic( sendbuf, recvbuf, count, datatype, @@ -500,7 +500,7 @@ int ompi_coll_tuned_reduce_intra_in_order_binary( void *sendbuf, void *recvbuf, * Determine number of segments and number of elements * sent per operation */ - ompi_ddt_type_size( datatype, &typelng ); + ompi_datatype_type_size( datatype, &typelng ); COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount ); /* An in-order binary tree must use root (size-1) to preserve the order of @@ -517,15 +517,15 @@ int ompi_coll_tuned_reduce_intra_in_order_binary( void *sendbuf, void *recvbuf, ptrdiff_t tlb, text, lb, ext; char *tmpbuf = NULL; - ompi_ddt_get_extent(datatype, &lb, &ext); - ompi_ddt_get_true_extent(datatype, &tlb, &text); + ompi_datatype_get_extent(datatype, &lb, &ext); + ompi_datatype_get_true_extent(datatype, &tlb, &text); if ((root == rank) && (MPI_IN_PLACE == sendbuf)) { tmpbuf = (char *) malloc(text + (count - 1) * ext); if (NULL == tmpbuf) { return MPI_ERR_INTERN; } - ompi_ddt_copy_content_same_ddt(datatype, count, + ompi_datatype_copy_content_same_ddt(datatype, count, (char*)tmpbuf, (char*)recvbuf); use_this_sendbuf = tmpbuf; @@ -626,8 +626,8 @@ ompi_coll_tuned_reduce_intra_basic_linear(void *sbuf, void *rbuf, int count, extent and true extent */ /* for reducing buffer allocation lengths.... */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); if (MPI_IN_PLACE == sbuf) { sbuf = rbuf; @@ -649,7 +649,7 @@ ompi_coll_tuned_reduce_intra_basic_linear(void *sbuf, void *rbuf, int count, /* Initialize the receive buffer. */ if (rank == (size - 1)) { - err = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)rbuf, + err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)rbuf, (char*)sbuf); } else { err = MCA_PML_CALL(recv(rbuf, count, dtype, size - 1, @@ -687,7 +687,7 @@ ompi_coll_tuned_reduce_intra_basic_linear(void *sbuf, void *rbuf, int count, } if (NULL != inplace_temp) { - err = ompi_ddt_copy_content_same_ddt(dtype, count, (char*)sbuf, + err = ompi_datatype_copy_content_same_ddt(dtype, count, (char*)sbuf, inplace_temp); free(inplace_temp); } diff --git a/ompi/mca/coll/tuned/coll_tuned_reduce_scatter.c b/ompi/mca/coll/tuned/coll_tuned_reduce_scatter.c index 9a6fafb3ba..8a0af44921 100644 --- a/ompi/mca/coll/tuned/coll_tuned_reduce_scatter.c +++ b/ompi/mca/coll/tuned/coll_tuned_reduce_scatter.c @@ -22,7 +22,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -77,8 +77,8 @@ int ompi_coll_tuned_reduce_scatter_intra_nonoverlapping(void *sbuf, void *rbuf, rbuf is big enough */ ptrdiff_t lb, extent, tlb, textent; - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &tlb, &textent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &tlb, &textent); tmprbuf_free = (char*) malloc(textent + (total_count - 1)*extent); tmprbuf = tmprbuf_free - lb; @@ -161,8 +161,8 @@ ompi_coll_tuned_reduce_scatter_intra_basic_recursivehalving(void *sbuf, } /* get datatype information */ - ompi_ddt_get_extent(dtype, &lb, &extent); - ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ompi_datatype_get_extent(dtype, &lb, &extent); + ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); buf_size = true_extent + (count - 1) * extent; /* Handle MPI_IN_PLACE */ @@ -183,7 +183,7 @@ ompi_coll_tuned_reduce_scatter_intra_basic_recursivehalving(void *sbuf, result_buf = result_buf_free - lb; /* copy local buffer into the temporary results */ - err = ompi_ddt_sndrcv(sbuf, count, dtype, result_buf, count, dtype); + err = ompi_datatype_sndrcv(sbuf, count, dtype, result_buf, count, dtype); if (OMPI_SUCCESS != err) goto cleanup; /* figure out power of two mapping: grow until larger than @@ -343,7 +343,7 @@ ompi_coll_tuned_reduce_scatter_intra_basic_recursivehalving(void *sbuf, /* copy local results from results buffer into real receive buffer */ if (0 != rcounts[rank]) { - err = ompi_ddt_sndrcv(result_buf + disps[rank] * extent, + err = ompi_datatype_sndrcv(result_buf + disps[rank] * extent, rcounts[rank], dtype, rbuf, rcounts[rank], dtype); if (OMPI_SUCCESS != err) { @@ -493,7 +493,7 @@ ompi_coll_tuned_reduce_scatter_intra_ring(void *sbuf, void *rbuf, int *rcounts, /* Special case for size == 1 */ if (1 == size) { if (MPI_IN_PLACE != sbuf) { - ret = ompi_ddt_copy_content_same_ddt(dtype, total_count, + ret = ompi_datatype_copy_content_same_ddt(dtype, total_count, (char*)rbuf, (char*)sbuf); if (ret < 0) { line = __LINE__; goto error_hndl; } } @@ -506,11 +506,11 @@ ompi_coll_tuned_reduce_scatter_intra_ring(void *sbuf, void *rbuf, int *rcounts, rbuf can be of rcounts[rank] size. - up to two temporary buffers used for communication/computation overlap. */ - ret = ompi_ddt_get_extent(dtype, &lb, &extent); + ret = ompi_datatype_get_extent(dtype, &lb, &extent); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } - ret = ompi_ddt_get_true_extent(dtype, &true_lb, &true_extent); + ret = ompi_datatype_get_true_extent(dtype, &true_lb, &true_extent); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } - ret = ompi_ddt_type_size( dtype, &typelng); + ret = ompi_datatype_type_size( dtype, &typelng); if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; } max_real_segsize = true_extent + (max_block_count - 1) * extent; @@ -533,7 +533,7 @@ ompi_coll_tuned_reduce_scatter_intra_ring(void *sbuf, void *rbuf, int *rcounts, sbuf = rbuf; } - ret = ompi_ddt_copy_content_same_ddt(dtype, total_count, + ret = ompi_datatype_copy_content_same_ddt(dtype, total_count, accumbuf, (char*)sbuf); if (ret < 0) { line = __LINE__; goto error_hndl; } @@ -607,7 +607,7 @@ ompi_coll_tuned_reduce_scatter_intra_ring(void *sbuf, void *rbuf, int *rcounts, ompi_op_reduce(op, inbuf[inbi], tmprecv, rcounts[rank], dtype); /* Copy result from tmprecv to rbuf */ - ret = ompi_ddt_copy_content_same_ddt(dtype, rcounts[rank], (char *) rbuf, tmprecv); + ret = ompi_datatype_copy_content_same_ddt(dtype, rcounts[rank], (char *) rbuf, tmprecv); if (ret < 0) { line = __LINE__; goto error_hndl; } if (NULL != displs) free(displs); diff --git a/ompi/mca/coll/tuned/coll_tuned_scatter.c b/ompi/mca/coll/tuned/coll_tuned_scatter.c index d2e16d7502..171f4d2198 100644 --- a/ompi/mca/coll/tuned/coll_tuned_scatter.c +++ b/ompi/mca/coll/tuned/coll_tuned_scatter.c @@ -20,7 +20,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/coll_tags.h" @@ -65,10 +65,10 @@ ompi_coll_tuned_scatter_intra_binomial(void *sbuf, int scount, COLL_TUNED_UPDATE_IN_ORDER_BMTREE( comm, tuned_module, root ); bmtree = data->cached_in_order_bmtree; - ompi_ddt_get_extent(sdtype, &slb, &sextent); - ompi_ddt_get_true_extent(sdtype, &strue_lb, &strue_extent); - ompi_ddt_get_extent(rdtype, &rlb, &rextent); - ompi_ddt_get_true_extent(rdtype, &rtrue_lb, &rtrue_extent); + ompi_datatype_get_extent(sdtype, &slb, &sextent); + ompi_datatype_get_true_extent(sdtype, &strue_lb, &strue_extent); + ompi_datatype_get_extent(rdtype, &rlb, &rextent); + ompi_datatype_get_true_extent(rdtype, &rtrue_lb, &rtrue_extent); vrank = (rank - root + size) % size; @@ -78,7 +78,7 @@ ompi_coll_tuned_scatter_intra_binomial(void *sbuf, int scount, ptmp = (char *) sbuf; if (rbuf != MPI_IN_PLACE) { /* local copy to rbuf */ - err = ompi_ddt_sndrcv(sbuf, scount, sdtype, + err = ompi_datatype_sndrcv(sbuf, scount, sdtype, rbuf, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -92,18 +92,18 @@ ompi_coll_tuned_scatter_intra_binomial(void *sbuf, int scount, ptmp = tempbuf - slb; /* and rotate data so they will eventually in the right place */ - err = ompi_ddt_copy_content_same_ddt(sdtype, scount*(size - root), + err = ompi_datatype_copy_content_same_ddt(sdtype, scount*(size - root), ptmp, (char *) sbuf + sextent*root*scount); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_ddt_copy_content_same_ddt(sdtype, scount*root, + err = ompi_datatype_copy_content_same_ddt(sdtype, scount*root, ptmp + sextent*scount*(size - root), (char *) sbuf); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } if (rbuf != MPI_IN_PLACE) { /* local copy to rbuf */ - err = ompi_ddt_sndrcv(ptmp, scount, sdtype, + err = ompi_datatype_sndrcv(ptmp, scount, sdtype, rbuf, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -135,7 +135,7 @@ ompi_coll_tuned_scatter_intra_binomial(void *sbuf, int scount, MCA_COLL_BASE_TAG_SCATTER, comm, &status)); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } /* local copy to rbuf */ - err = ompi_ddt_sndrcv(ptmp, scount, sdtype, + err = ompi_datatype_sndrcv(ptmp, scount, sdtype, rbuf, rcount, rdtype); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } } @@ -227,7 +227,7 @@ ompi_coll_tuned_scatter_intra_basic_linear(void *sbuf, int scount, /* I am the root, loop sending data. */ - err = ompi_ddt_get_extent(sdtype, &lb, &incr); + err = ompi_datatype_get_extent(sdtype, &lb, &incr); if (OMPI_SUCCESS != err) { return OMPI_ERROR; } @@ -240,7 +240,7 @@ ompi_coll_tuned_scatter_intra_basic_linear(void *sbuf, int scount, if (i == rank) { if (MPI_IN_PLACE != rbuf) { err = - ompi_ddt_sndrcv(ptmp, scount, sdtype, rbuf, rcount, + ompi_datatype_sndrcv(ptmp, scount, sdtype, rbuf, rcount, rdtype); } } else { diff --git a/ompi/mca/coll/tuned/coll_tuned_util.c b/ompi/mca/coll/tuned/coll_tuned_util.c index 22ce699e05..5647ef2e91 100644 --- a/ompi/mca/coll/tuned/coll_tuned_util.c +++ b/ompi/mca/coll/tuned/coll_tuned_util.c @@ -21,7 +21,7 @@ #include "mpi.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/pml/pml.h" diff --git a/ompi/mca/coll/tuned/coll_tuned_util.h b/ompi/mca/coll/tuned/coll_tuned_util.h index b1552d2f0e..441fb436d7 100644 --- a/ompi/mca/coll/tuned/coll_tuned_util.h +++ b/ompi/mca/coll/tuned/coll_tuned_util.h @@ -23,7 +23,7 @@ #include "mpi.h" #include "opal/mca/mca.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/request/request.h" #include "ompi/mca/pml/pml.h" @@ -53,7 +53,7 @@ ompi_coll_tuned_sendrecv( void* sendbuf, int scount, ompi_datatype_t* sdatatype, ompi_status_public_t* status, int myid ) { if ((dest == myid) && (source == myid)) { - return (int) ompi_ddt_sndrcv(sendbuf, (int32_t) scount, sdatatype, + return (int) ompi_datatype_sndrcv(sendbuf, (int32_t) scount, sdatatype, recvbuf, (int32_t) rcount, rdatatype); } return ompi_coll_tuned_sendrecv_actual (sendbuf, scount, sdatatype, @@ -86,7 +86,7 @@ ompi_coll_tuned_sendrecv_localcompleted( void* sendbuf, int scount, ompi_status_public_t* status, int myid ) { if ((dest == myid) && (source == myid)) { - return (int) ompi_ddt_sndrcv(sendbuf, (int32_t) scount, sdatatype, + return (int) ompi_datatype_sndrcv(sendbuf, (int32_t) scount, sdatatype, recvbuf, (int32_t) rcount, rdatatype); } return ompi_coll_tuned_sendrecv_actual_localcompleted (sendbuf, scount, diff --git a/ompi/mca/crcp/base/base.h b/ompi/mca/crcp/base/base.h index 069a04dafd..0781bac858 100644 --- a/ompi/mca/crcp/base/base.h +++ b/ompi/mca/crcp/base/base.h @@ -157,7 +157,7 @@ extern "C" { ompi_crcp_base_none_btl_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, size_t reserve, size_t* size, ompi_crcp_base_btl_state_t*); @@ -166,7 +166,7 @@ extern "C" { ompi_crcp_base_none_btl_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, size_t reserve, size_t* size, ompi_crcp_base_btl_state_t*); diff --git a/ompi/mca/crcp/base/crcp_base_fns.c b/ompi/mca/crcp/base/crcp_base_fns.c index 0ae362deee..5e8793504b 100644 --- a/ompi/mca/crcp/base/crcp_base_fns.c +++ b/ompi/mca/crcp/base/crcp_base_fns.c @@ -321,7 +321,7 @@ ompi_crcp_base_btl_state_t* ompi_crcp_base_none_btl_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, size_t reserve, size_t* size, ompi_crcp_base_btl_state_t* btl_state) @@ -334,7 +334,7 @@ ompi_crcp_base_btl_state_t* ompi_crcp_base_none_btl_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, size_t reserve, size_t* size, ompi_crcp_base_btl_state_t* btl_state) diff --git a/ompi/mca/crcp/bkmrk/crcp_bkmrk_btl.c b/ompi/mca/crcp/bkmrk/crcp_bkmrk_btl.c index 8e304486e5..6c757954d9 100644 --- a/ompi/mca/crcp/bkmrk/crcp_bkmrk_btl.c +++ b/ompi/mca/crcp/bkmrk/crcp_bkmrk_btl.c @@ -108,7 +108,7 @@ ompi_crcp_base_btl_state_t* ompi_crcp_base_coord_btl_prepare_src( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, size_t reserve, size_t* size, ompi_crcp_base_btl_state_t* btl_state) @@ -121,7 +121,7 @@ ompi_crcp_base_btl_state_t* ompi_crcp_base_coord_btl_prepare_dst( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, size_t reserve, size_t* size, ompi_crcp_base_btl_state_t* btl_state) diff --git a/ompi/mca/crcp/bkmrk/crcp_bkmrk_btl.h b/ompi/mca/crcp/bkmrk/crcp_bkmrk_btl.h index ad1f5d2b1f..8da473b493 100644 --- a/ompi/mca/crcp/bkmrk/crcp_bkmrk_btl.h +++ b/ompi/mca/crcp/bkmrk/crcp_bkmrk_btl.h @@ -78,7 +78,7 @@ extern "C" { ( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, size_t reserve, size_t* size, ompi_crcp_base_btl_state_t*); @@ -87,7 +87,7 @@ extern "C" { ( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, size_t reserve, size_t* size, ompi_crcp_base_btl_state_t*); diff --git a/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c b/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c index e73ac15c22..13c84d3acd 100644 --- a/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c +++ b/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c @@ -3165,7 +3165,7 @@ static int traffic_message_append(ompi_crcp_bkmrk_pml_peer_ref_t *peer_ref, size_t ddt_size = 0; if( NULL != datatype ) { - ompi_ddt_type_size(datatype, + ompi_datatype_type_size(datatype, &ddt_size); } else { ddt_size = in_ddt_size; @@ -3558,7 +3558,7 @@ static int traffic_message_create_drain_message(bool post_drain, * The post_drained() will properly handle the packed datatype * by changing the count to (count * ddt_size). */ - ompi_ddt_duplicate(&(ompi_mpi_packed.dt), &(drain_msg_ref->datatype)); + ompi_datatype_duplicate(&(ompi_mpi_packed.dt), &(drain_msg_ref->datatype)); /* Create a buffer of the necessary type/size */ if(drain_msg_ref->count > 0 ) { @@ -4042,7 +4042,7 @@ static int drain_message_copy_remove_persistent(ompi_crcp_bkmrk_pml_drain_messag memcpy(&(content_ref->status), &drain_content_ref->status, sizeof(ompi_status_public_t)); - if( 0 != (ret = ompi_ddt_copy_content_same_ddt(drain_msg_ref->datatype, + if( 0 != (ret = ompi_datatype_copy_content_same_ddt(drain_msg_ref->datatype, drain_msg_ref->count, content_ref->buffer, drain_content_ref->buffer) ) ) { @@ -4088,7 +4088,7 @@ static int drain_message_copy_remove(ompi_crcp_bkmrk_pml_drain_message_ref_t *dr /* The buffer could be NULL - More likely when doing a count=0 type of message (e.g., Barrier) */ if( OPAL_LIKELY(NULL != buf) ) { - if( 0 != (ret = ompi_ddt_copy_content_same_ddt(datatype, count, + if( 0 != (ret = ompi_datatype_copy_content_same_ddt(datatype, count, (void*)buf, drain_content_ref->buffer) ) ) { opal_output( mca_crcp_bkmrk_component.super.output_handle, "crcp:bkmrk: drain_message_copy_remove(): Datatype copy failed (%d)", diff --git a/ompi/mca/crcp/crcp.h b/ompi/mca/crcp/crcp.h index 58088e12e8..d4d2ea7202 100644 --- a/ompi/mca/crcp/crcp.h +++ b/ompi/mca/crcp/crcp.h @@ -34,7 +34,7 @@ #include "opal/class/opal_object.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/request/request.h" #include "ompi/class/ompi_free_list.h" @@ -221,7 +221,7 @@ typedef ompi_crcp_base_btl_state_t* (*mca_crcp_base_btl_module_prepare_fn_t) ( struct mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* endpoint, mca_mpool_base_registration_t* registration, - struct ompi_convertor_t* convertor, + struct opal_convertor_t* convertor, size_t reserve, size_t* size, ompi_crcp_base_btl_state_t*); diff --git a/ompi/mca/io/romio/src/io_romio_module.c b/ompi/mca/io/romio/src/io_romio_module.c index 8a6221153a..ce160029d9 100644 --- a/ompi/mca/io/romio/src/io_romio_module.c +++ b/ompi/mca/io/romio/src/io_romio_module.c @@ -20,7 +20,7 @@ #include "ompi_config.h" #include "mpi.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/io/io.h" #include "io_romio.h" @@ -143,5 +143,5 @@ void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag) * gaps in the beginning and at the end. We have to provide * a count of 2 in order to get these gaps taken into acount. */ - *flag = ompi_ddt_is_contiguous_memory_layout(datatype, 2); + *flag = ompi_datatype_is_contiguous_memory_layout(datatype, 2); } diff --git a/ompi/mca/mtl/base/mtl_base_datatype.h b/ompi/mca/mtl/base/mtl_base_datatype.h index 8c15993e45..7fd73ccab5 100644 --- a/ompi/mca/mtl/base/mtl_base_datatype.h +++ b/ompi/mca/mtl/base/mtl_base_datatype.h @@ -22,12 +22,12 @@ #include "ompi/mca/mtl/mtl.h" #include "ompi/mca/mtl/base/base.h" #include "ompi/constants.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" static inline int -ompi_mtl_datatype_pack(struct ompi_convertor_t *convertor, +ompi_mtl_datatype_pack(struct opal_convertor_t *convertor, void **buffer, size_t *buffer_len, bool *freeAfter) @@ -35,7 +35,7 @@ ompi_mtl_datatype_pack(struct ompi_convertor_t *convertor, struct iovec iov; uint32_t iov_count = 1; - ompi_convertor_get_packed_size(convertor, buffer_len); + opal_convertor_get_packed_size(convertor, buffer_len); *freeAfter = false; if( 0 == *buffer_len ) { *buffer = NULL; @@ -43,13 +43,13 @@ ompi_mtl_datatype_pack(struct ompi_convertor_t *convertor, } iov.iov_len = *buffer_len; iov.iov_base = NULL; - if (ompi_convertor_need_buffers(convertor)) { + if (opal_convertor_need_buffers(convertor)) { iov.iov_base = malloc(*buffer_len); if (NULL == iov.iov_base) return OMPI_ERR_OUT_OF_RESOURCE; *freeAfter = true; } - ompi_convertor_pack( convertor, &iov, &iov_count, buffer_len ); + opal_convertor_pack( convertor, &iov, &iov_count, buffer_len ); *buffer = iov.iov_base; @@ -58,42 +58,42 @@ ompi_mtl_datatype_pack(struct ompi_convertor_t *convertor, static inline int -ompi_mtl_datatype_recv_buf(struct ompi_convertor_t *convertor, +ompi_mtl_datatype_recv_buf(struct opal_convertor_t *convertor, void ** buffer, size_t *buffer_len, bool *free_on_error) { - ompi_convertor_get_packed_size(convertor, buffer_len); + opal_convertor_get_packed_size(convertor, buffer_len); *free_on_error = false; if( 0 == *buffer_len ) { *buffer = NULL; *buffer_len = 0; return OMPI_SUCCESS; } - if (ompi_convertor_need_buffers(convertor)) { + if (opal_convertor_need_buffers(convertor)) { *buffer = malloc(*buffer_len); *free_on_error = true; } else { *buffer = convertor->pBaseBuf + - convertor->use_desc->desc[convertor->use_desc->used].end_loop.first_elem_disp;; + convertor->use_desc->desc[convertor->use_desc->used].end_loop.first_elem_disp; } return OMPI_SUCCESS; } static inline int -ompi_mtl_datatype_unpack(struct ompi_convertor_t *convertor, +ompi_mtl_datatype_unpack(struct opal_convertor_t *convertor, void *buffer, size_t buffer_len) { struct iovec iov; uint32_t iov_count = 1; - if (buffer_len > 0 && ompi_convertor_need_buffers(convertor)) { + if (buffer_len > 0 && opal_convertor_need_buffers(convertor)) { iov.iov_len = buffer_len; iov.iov_base = buffer; - ompi_convertor_unpack(convertor, &iov, &iov_count, &buffer_len ); + opal_convertor_unpack(convertor, &iov, &iov_count, &buffer_len ); free(buffer); } diff --git a/ompi/mca/mtl/mtl.h b/ompi/mca/mtl/mtl.h index 8cce73421d..0a78dd1501 100644 --- a/ompi/mca/mtl/mtl.h +++ b/ompi/mca/mtl/mtl.h @@ -43,7 +43,7 @@ extern "C" { #endif struct ompi_request_t; -struct ompi_convertor_t; +struct opal_convertor_t; struct mca_mtl_base_module_t; @@ -212,7 +212,7 @@ typedef int (*mca_mtl_base_module_send_fn_t)( struct ompi_communicator_t *comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode); @@ -261,7 +261,7 @@ typedef int (*mca_mtl_base_module_isend_fn_t)( struct ompi_communicator_t *comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode, bool blocking, mca_mtl_request_t *mtl_request); @@ -303,7 +303,7 @@ typedef int (*mca_mtl_base_module_irecv_fn_t)( struct ompi_communicator_t *comm, int src, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, struct mca_mtl_request_t *mtl_request); diff --git a/ompi/mca/mtl/mx/mtl_mx.h b/ompi/mca/mtl/mx/mtl_mx.h index bdb83ca6b0..6dc47f8899 100644 --- a/ompi/mca/mtl/mx/mtl_mx.h +++ b/ompi/mca/mtl/mx/mtl_mx.h @@ -21,7 +21,7 @@ #include "ompi/mca/mtl/mtl.h" #include "ompi/mca/mtl/base/base.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #if defined(c_plusplus) || defined(__cplusplus) @@ -33,14 +33,14 @@ ompi_mtl_mx_send(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode); extern int ompi_mtl_mx_isend(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode, bool blocking, mca_mtl_request_t * mtl_request); @@ -49,7 +49,7 @@ extern int ompi_mtl_mx_irecv(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t *comm, int src, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, struct mca_mtl_request_t *mtl_request); diff --git a/ompi/mca/mtl/mx/mtl_mx_recv.c b/ompi/mca/mtl/mx/mtl_mx_recv.c index 7014cf3a8a..f031cc8da8 100644 --- a/ompi/mca/mtl/mx/mtl_mx_recv.c +++ b/ompi/mca/mtl/mx/mtl_mx_recv.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mtl/base/mtl_base_datatype.h" #include "mtl_mx.h" @@ -31,7 +31,7 @@ ompi_mtl_mx_irecv(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t *comm, int src, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, struct mca_mtl_request_t *mtl_request) { int ret; diff --git a/ompi/mca/mtl/mx/mtl_mx_request.h b/ompi/mca/mtl/mx/mtl_mx_request.h index 9e337093dd..a92bf69bca 100644 --- a/ompi/mca/mtl/mx/mtl_mx_request.h +++ b/ompi/mca/mtl/mx/mtl_mx_request.h @@ -19,7 +19,7 @@ #ifndef OMPI_MTL_MX_REQUEST_H #define OMPI_MTL_MX_REQUEST_H -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" typedef enum { @@ -31,7 +31,7 @@ struct mca_mtl_mx_request_t { struct mca_mtl_request_t super; mx_request_t mx_request; mx_segment_t mx_segment[1]; - struct ompi_convertor_t *convertor; + struct opal_convertor_t *convertor; bool free_after; mca_mtl_mx_request_type_t type; }; diff --git a/ompi/mca/mtl/mx/mtl_mx_send.c b/ompi/mca/mtl/mx/mtl_mx_send.c index ad9c9e74bf..7e058591b5 100644 --- a/ompi/mca/mtl/mx/mtl_mx_send.c +++ b/ompi/mca/mtl/mx/mtl_mx_send.c @@ -21,7 +21,7 @@ #include "opal/prefetch.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "mtl_mx.h" #include "mtl_mx_types.h" @@ -33,7 +33,7 @@ ompi_mtl_mx_send(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode) { mx_return_t mx_return; @@ -129,7 +129,7 @@ ompi_mtl_mx_isend(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode, bool blocking, mca_mtl_request_t * mtl_request) diff --git a/ompi/mca/mtl/portals/mtl_portals.h b/ompi/mca/mtl/portals/mtl_portals.h index e7adc285ed..b2c27036bf 100644 --- a/ompi/mca/mtl/portals/mtl_portals.h +++ b/ompi/mca/mtl/portals/mtl_portals.h @@ -24,7 +24,7 @@ #include "ompi/class/ompi_free_list.h" #include "ompi/mca/mtl/mtl.h" #include "ompi/mca/mtl/base/base.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/common/portals/common_portals.h" @@ -194,14 +194,14 @@ extern int ompi_mtl_portals_send(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode); extern int ompi_mtl_portals_isend(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode, bool blocking, mca_mtl_request_t *mtl_request); @@ -210,7 +210,7 @@ extern int ompi_mtl_portals_irecv(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t *comm, int src, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_mtl_request_t *mtl_request); extern int ompi_mtl_portals_iprobe(struct mca_mtl_base_module_t* mtl, diff --git a/ompi/mca/mtl/portals/mtl_portals_recv.c b/ompi/mca/mtl/portals/mtl_portals_recv.c index a09594b618..abe3418e26 100644 --- a/ompi/mca/mtl/portals/mtl_portals_recv.c +++ b/ompi/mca/mtl/portals/mtl_portals_recv.c @@ -21,8 +21,8 @@ #include "opal/class/opal_list.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mtl/base/base.h" #include "ompi/mca/mtl/base/mtl_base_datatype.h" @@ -149,7 +149,7 @@ ompi_mtl_portals_recv_progress(ptl_event_t *ev, static int ompi_mtl_portals_get_data(ompi_mtl_portals_event_t *recv_event, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, ompi_mtl_portals_request_t *ptl_request) { int ret; @@ -180,7 +180,7 @@ ompi_mtl_portals_get_data(ompi_mtl_portals_event_t *recv_event, /* pull out the data */ if (iov.iov_len > 0) { - ret = ompi_convertor_unpack(convertor, &iov, &iov_count, + ret = opal_convertor_unpack(convertor, &iov, &iov_count, &max_data ); if (0 > ret) return ret; } @@ -222,7 +222,7 @@ ompi_mtl_portals_get_data(ompi_mtl_portals_event_t *recv_event, /* finished with our buffer space */ ompi_mtl_portals_return_block_part(&ompi_mtl_portals, block); - ompi_convertor_get_packed_size(convertor, &buflen); + opal_convertor_get_packed_size(convertor, &buflen); ptl_request->super.ompi_req->req_status.MPI_SOURCE = PTL_GET_SOURCE(recv_event->ev.match_bits); @@ -458,7 +458,7 @@ ompi_mtl_portals_irecv(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t *comm, int src, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_mtl_request_t *mtl_request) { ptl_match_bits_t match_bits, ignore_bits; diff --git a/ompi/mca/mtl/portals/mtl_portals_request.h b/ompi/mca/mtl/portals/mtl_portals_request.h index e481974cc8..2e56734073 100644 --- a/ompi/mca/mtl/portals/mtl_portals_request.h +++ b/ompi/mca/mtl/portals/mtl_portals_request.h @@ -19,13 +19,13 @@ #ifndef OMPI_MTL_PORTALS_REQUEST_H #define OMPI_MTL_PORTALS_REQUEST_H -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mtl/mtl.h" struct ompi_mtl_portals_request_t { struct mca_mtl_request_t super; bool free_after; - struct ompi_convertor_t *convertor; + struct opal_convertor_t *convertor; volatile bool is_complete; int event_count; diff --git a/ompi/mca/mtl/portals/mtl_portals_send.c b/ompi/mca/mtl/portals/mtl_portals_send.c index 89570d79fb..31ea571b83 100644 --- a/ompi/mca/mtl/portals/mtl_portals_send.c +++ b/ompi/mca/mtl/portals/mtl_portals_send.c @@ -19,7 +19,7 @@ #include "ompi_config.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mtl/base/base.h" #include "ompi/mca/mtl/base/mtl_base_datatype.h" @@ -537,7 +537,7 @@ ompi_mtl_portals_send(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode) { int ret; @@ -573,7 +573,7 @@ ompi_mtl_portals_isend(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode, bool blocking, mca_mtl_request_t *mtl_request) diff --git a/ompi/mca/mtl/psm/mtl_psm.h b/ompi/mca/mtl/psm/mtl_psm.h index eec15aef1d..9cb49106ae 100644 --- a/ompi/mca/mtl/psm/mtl_psm.h +++ b/ompi/mca/mtl/psm/mtl_psm.h @@ -23,7 +23,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/mca/mtl/mtl.h" #include "ompi/mca/mtl/base/base.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include #include @@ -48,14 +48,14 @@ ompi_mtl_psm_send(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode); extern int ompi_mtl_psm_isend(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode, bool blocking, mca_mtl_request_t * mtl_request); @@ -64,7 +64,7 @@ extern int ompi_mtl_psm_irecv(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t *comm, int src, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, struct mca_mtl_request_t *mtl_request); diff --git a/ompi/mca/mtl/psm/mtl_psm_recv.c b/ompi/mca/mtl/psm/mtl_psm_recv.c index d05b8de2fc..c615548ea8 100644 --- a/ompi/mca/mtl/psm/mtl_psm_recv.c +++ b/ompi/mca/mtl/psm/mtl_psm_recv.c @@ -20,7 +20,7 @@ #include "ompi_config.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/mtl/base/mtl_base_datatype.h" #include "mtl_psm.h" @@ -32,7 +32,7 @@ ompi_mtl_psm_irecv(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t *comm, int src, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, struct mca_mtl_request_t *mtl_request) { int ret; diff --git a/ompi/mca/mtl/psm/mtl_psm_request.h b/ompi/mca/mtl/psm/mtl_psm_request.h index 32bdcf33bd..98662e6463 100644 --- a/ompi/mca/mtl/psm/mtl_psm_request.h +++ b/ompi/mca/mtl/psm/mtl_psm_request.h @@ -20,7 +20,7 @@ #ifndef OMPI_MTL_PSM_REQUEST_H #define OMPI_MTL_PSM_REQUEST_H -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" typedef enum { @@ -35,7 +35,7 @@ struct mca_mtl_psm_request_t { /* psm_segment_t psm_segment[1]; */ void *buf; size_t length; - struct ompi_convertor_t *convertor; + struct opal_convertor_t *convertor; bool free_after; }; typedef struct mca_mtl_psm_request_t mca_mtl_psm_request_t; diff --git a/ompi/mca/mtl/psm/mtl_psm_send.c b/ompi/mca/mtl/psm/mtl_psm_send.c index 7c80eeda52..ddc0852ad4 100644 --- a/ompi/mca/mtl/psm/mtl_psm_send.c +++ b/ompi/mca/mtl/psm/mtl_psm_send.c @@ -20,7 +20,7 @@ #include "ompi_config.h" #include "ompi/mca/pml/pml.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "mtl_psm.h" #include "mtl_psm_types.h" @@ -32,7 +32,7 @@ ompi_mtl_psm_send(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode) { psm_error_t err; @@ -84,7 +84,7 @@ ompi_mtl_psm_isend(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t* comm, int dest, int tag, - struct ompi_convertor_t *convertor, + struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode, bool blocking, mca_mtl_request_t * mtl_request) diff --git a/ompi/mca/osc/base/osc_base_obj_convert.c b/ompi/mca/osc/base/osc_base_obj_convert.c index 01b744c6a6..9531f45c2f 100644 --- a/ompi/mca/osc/base/osc_base_obj_convert.c +++ b/ompi/mca/osc/base/osc_base_obj_convert.c @@ -23,12 +23,13 @@ #include "ompi_config.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_convertor_internal.h" +#include "opal/datatype/opal_datatype_prototypes.h" + #include "ompi/op/op.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/convertor_internal.h" -#include "ompi/datatype/datatype_prototypes.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" #include "osc_base_obj_convert.h" #include "ompi/memchecker.h" @@ -42,22 +43,22 @@ ompi_osc_base_get_primitive_type_info(ompi_datatype_t *datatype, uint32_t primitive_count; /* get underlying type... */ - if (ompi_ddt_is_predefined(datatype)) { + if (ompi_datatype_is_predefined(datatype)) { primitive_datatype = datatype; primitive_count = 1; } else { int i, found_index = -1; - uint64_t mask = 1; - for (i = 0 ; i < DT_MAX_PREDEFINED ; ++i) { - if (datatype->bdt_used & mask) { + uint32_t mask = 1; + for (i = 0 ; i < OMPI_DATATYPE_MAX_PREDEFINED ; ++i) { + if (datatype->super.bdt_used & mask) { found_index = i; break; } mask *= 2; } primitive_datatype = (ompi_datatype_t*) - ompi_ddt_basicDatatypes[found_index]; - primitive_count = datatype->nbElems; + ompi_datatype_basicDatatypes[found_index]; + primitive_count = datatype->super.nbElems; } *prim_datatype = primitive_datatype; @@ -68,15 +69,15 @@ ompi_osc_base_get_primitive_type_info(ompi_datatype_t *datatype, struct ompi_osc_base_convertor_t { - ompi_convertor_t convertor; + opal_convertor_t convertor; ompi_op_t *op; ompi_datatype_t *datatype; }; typedef struct ompi_osc_base_convertor_t ompi_osc_base_convertor_t; -static OBJ_CLASS_INSTANCE(ompi_osc_base_convertor_t, ompi_convertor_t, NULL, NULL); +static OBJ_CLASS_INSTANCE(ompi_osc_base_convertor_t, opal_convertor_t, NULL, NULL); #define COPY_TYPE( TYPENAME, TYPE, COUNT ) \ -static int copy_##TYPENAME( ompi_convertor_t *pConvertor, uint32_t count, \ +static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count, \ char* from, size_t from_len, ptrdiff_t from_extent, \ char* to, size_t to_len, ptrdiff_t to_extent, \ ptrdiff_t *advance) \ @@ -110,12 +111,13 @@ COPY_TYPE( long_long, long long, 1 ) COPY_TYPE( float, float, 1 ) COPY_TYPE( double, double, 1 ) COPY_TYPE( long_double, long double, 1 ) -COPY_TYPE( complex_float, ompi_complex_float_t, 1 ) -COPY_TYPE( complex_double, ompi_complex_double_t, 1 ) -COPY_TYPE( complex_long_double, ompi_complex_long_double_t, 1 ) +COPY_TYPE( complex_float, ompi_mpi_cxx_cplex, 1 ) +COPY_TYPE( complex_double, ompi_mpi_cxx_dblcplex, 1 ) +COPY_TYPE( complex_long_double, ompi_mpi_cxx_ldblcplex, 1 ) /* table of predefined copy functions - one for each MPI type */ -static conversion_fct_t ompi_osc_base_copy_functions[DT_MAX_PREDEFINED] = { +/* XXX TODO Adapt to new layout */ +static conversion_fct_t ompi_osc_base_copy_functions[OMPI_DATATYPE_MAX_PREDEFINED] = { (conversion_fct_t)NULL, /* DT_LOOP */ (conversion_fct_t)NULL, /* DT_END_LOOP */ (conversion_fct_t)NULL, /* DT_LB */ @@ -128,10 +130,10 @@ static conversion_fct_t ompi_osc_base_copy_functions[DT_MAX_PREDEFINED] = { (conversion_fct_t)copy_short, /* DT_SHORT */ (conversion_fct_t)copy_short, /* DT_UNSIGNED_SHORT */ (conversion_fct_t)copy_int, /* DT_INT */ - (conversion_fct_t)copy_int, /* DT_UNSIGNED_INT */ + (conversion_fct_t)copy_int, /* DT_UNSIGNED */ (conversion_fct_t)copy_long, /* DT_LONG */ (conversion_fct_t)copy_long, /* DT_UNSIGNED_LONG */ - (conversion_fct_t)copy_long_long, /* DT_LONG_LONG_INT */ + (conversion_fct_t)copy_long_long, /* DT_LONG_LONG */ (conversion_fct_t)copy_long_long, /* DT_UNSIGNED_LONG_LONG */ (conversion_fct_t)copy_float, /* DT_FLOAT */ (conversion_fct_t)copy_double, /* DT_DOUBLE */ @@ -192,7 +194,7 @@ ompi_osc_base_process_op(void *outbuf, return OMPI_ERR_NOT_SUPPORTED; } - if (ompi_ddt_is_predefined(datatype)) { + if (ompi_datatype_is_predefined(datatype)) { ompi_op_reduce(op, inbuf, outbuf, count, datatype); } else { struct ompi_datatype_t *primitive_datatype = NULL; @@ -201,20 +203,11 @@ ompi_osc_base_process_op(void *outbuf, struct iovec iov; uint32_t iov_count = 1; size_t max_data; - struct ompi_convertor_master_t master = {NULL, 0, 0, 0, {0, }, NULL}; - int i, found_index = -1; - uint64_t mask = 1; + struct opal_convertor_master_t master = {NULL, 0, 0, 0, {0, }, NULL}; - for (i = 0 ; i < DT_MAX_PREDEFINED ; ++i) { - if (datatype->bdt_used & mask) { - found_index = i; - break; - } - mask *= 2; - } - primitive_datatype = (ompi_datatype_t*) - ompi_ddt_basicDatatypes[found_index]; - primitive_count = datatype->nbElems; + ompi_osc_base_get_primitive_type_info( datatype, + &primitive_datatype, + &primitive_count ); /* create convertor */ OBJ_CONSTRUCT(&convertor, ompi_osc_base_convertor_t); @@ -222,18 +215,18 @@ ompi_osc_base_process_op(void *outbuf, convertor.datatype = primitive_datatype; /* initialize convertor */ - ompi_convertor_copy_and_prepare_for_recv(ompi_proc_local()->proc_convertor, - datatype, + opal_convertor_copy_and_prepare_for_recv(ompi_proc_local()->proc_convertor, + &(datatype->super), count, outbuf, 0, &convertor.convertor); - memcpy(&master, convertor.convertor.master, sizeof(struct ompi_convertor_master_t)); + memcpy(&master, convertor.convertor.master, sizeof(struct opal_convertor_master_t)); master.next = convertor.convertor.master; master.pFunctions = (conversion_fct_t*) &ompi_osc_base_copy_functions; convertor.convertor.master = &master; - convertor.convertor.fAdvance = ompi_unpack_general; + convertor.convertor.fAdvance = opal_unpack_general; iov.iov_len = inbuflen; iov.iov_base = (IOVBASE_TYPE*) inbuf; @@ -242,7 +235,7 @@ ompi_osc_base_process_op(void *outbuf, memchecker_convertor_call(&opal_memchecker_base_mem_defined, &convertor.convertor); ); - ompi_convertor_unpack(&convertor.convertor, + opal_convertor_unpack(&convertor.convertor, &iov, &iov_count, &max_data); diff --git a/ompi/mca/osc/base/osc_base_obj_convert.h b/ompi/mca/osc/base/osc_base_obj_convert.h index 2b618db5c2..d5b587791e 100644 --- a/ompi/mca/osc/base/osc_base_obj_convert.h +++ b/ompi/mca/osc/base/osc_base_obj_convert.h @@ -24,7 +24,7 @@ */ #include "ompi_config.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/proc/proc.h" #include "ompi/op/op.h" @@ -50,9 +50,9 @@ struct ompi_datatype_t* ompi_osc_base_datatype_create(ompi_proc_t *remote_proc, void **payload) { struct ompi_datatype_t *datatype = - ompi_ddt_create_from_packed_description(payload, remote_proc); + ompi_datatype_create_from_packed_description(payload, remote_proc); if (NULL == datatype) return NULL; - if (ompi_ddt_is_predefined(datatype)) OBJ_RETAIN(datatype); + if (ompi_datatype_is_predefined(datatype)) OBJ_RETAIN(datatype); return datatype; } diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_comm.c b/ompi/mca/osc/pt2pt/osc_pt2pt_comm.c index 6dc99f7f83..f6c670bf49 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_comm.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_comm.c @@ -25,7 +25,7 @@ #include "osc_pt2pt_sendreq.h" #include "osc_pt2pt_header.h" #include "osc_pt2pt_data_move.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/win/win.h" #include "ompi/memchecker.h" diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c b/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c index 4405262f1d..15f8fd138b 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c @@ -27,7 +27,7 @@ #include "opal/util/output.h" #include "opal/sys/atomic.h" #include "ompi/mca/pml/pml.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/mca/osc/base/base.h" #include "ompi/mca/osc/base/osc_base_obj_convert.h" @@ -165,7 +165,7 @@ ompi_osc_pt2pt_sendreq_send(ompi_osc_pt2pt_module_t *module, size_t written_data = 0; size_t needed_len = sizeof(ompi_osc_pt2pt_send_header_t); const void *packed_ddt; - size_t packed_ddt_len = ompi_ddt_pack_description_length(sendreq->req_target_datatype); + size_t packed_ddt_len = ompi_datatype_pack_description_length(sendreq->req_target_datatype); /* we always need to send the ddt */ needed_len += packed_ddt_len; @@ -225,7 +225,7 @@ ompi_osc_pt2pt_sendreq_send(ompi_osc_pt2pt_module_t *module, } /* Set datatype id and / or pack datatype */ - ret = ompi_ddt_get_pack_description(sendreq->req_target_datatype, &packed_ddt); + ret = ompi_datatype_get_pack_description(sendreq->req_target_datatype, &packed_ddt); if (OMPI_SUCCESS != ret) goto cleanup; memcpy((unsigned char*) buffer->payload + written_data, packed_ddt, packed_ddt_len); @@ -245,7 +245,7 @@ ompi_osc_pt2pt_sendreq_send(ompi_osc_pt2pt_module_t *module, memchecker_convertor_call(&opal_memchecker_base_mem_defined, &sendreq->req_origin_convertor); ); - ret = ompi_convertor_pack(&sendreq->req_origin_convertor, &iov, &iov_count, + ret = opal_convertor_pack(&sendreq->req_origin_convertor, &iov, &iov_count, &max_data ); MEMCHECKER( memchecker_convertor_call(&opal_memchecker_base_mem_noaccess, @@ -448,7 +448,7 @@ ompi_osc_pt2pt_replyreq_send(ompi_osc_pt2pt_module_t *module, memchecker_convertor_call(&opal_memchecker_base_mem_defined, &replyreq->rep_target_convertor); ); - ret = ompi_convertor_pack(&replyreq->rep_target_convertor, &iov, &iov_count, + ret = opal_convertor_pack(&replyreq->rep_target_convertor, &iov, &iov_count, &max_data ); /* Copy finished, make the target buffer unaccessable. */ MEMCHECKER( @@ -573,19 +573,19 @@ ompi_osc_pt2pt_sendreq_recv_put(ompi_osc_pt2pt_module_t *module, } if (header->hdr_msg_length > 0) { - ompi_convertor_t convertor; + opal_convertor_t convertor; struct iovec iov; uint32_t iov_count = 1; size_t max_data; ompi_proc_t *proc; /* create convertor */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); /* initialize convertor */ proc = ompi_comm_peer_lookup(module->p2p_comm, header->hdr_origin); - ompi_convertor_copy_and_prepare_for_recv(proc->proc_convertor, - datatype, + opal_convertor_copy_and_prepare_for_recv(proc->proc_convertor, + &(datatype->super), header->hdr_target_count, target, 0, @@ -601,7 +601,7 @@ ompi_osc_pt2pt_sendreq_recv_put(ompi_osc_pt2pt_module_t *module, memchecker_convertor_call(&opal_memchecker_base_mem_defined, &convertor); ); - ompi_convertor_unpack(&convertor, + opal_convertor_unpack(&convertor, &iov, &iov_count, &max_data ); @@ -663,17 +663,17 @@ ompi_osc_pt2pt_sendreq_recv_accum_long_cb(ompi_osc_pt2pt_mpireq_t *mpireq) OPAL_THREAD_LOCK(&longreq->req_module->p2p_acc_lock); if (longreq->req_op == &ompi_mpi_op_replace.op) { - ompi_convertor_t convertor; + opal_convertor_t convertor; struct iovec iov; uint32_t iov_count = 1; size_t max_data; /* create convertor */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); /* initialize convertor */ - ompi_convertor_copy_and_prepare_for_recv(ompi_proc_local()->proc_convertor, - longreq->req_datatype, + opal_convertor_copy_and_prepare_for_recv(ompi_proc_local()->proc_convertor, + &(longreq->req_datatype->super), header->hdr_target_count, target, 0, @@ -682,7 +682,7 @@ ompi_osc_pt2pt_sendreq_recv_accum_long_cb(ompi_osc_pt2pt_mpireq_t *mpireq) iov.iov_len = header->hdr_msg_length; iov.iov_base = (IOVBASE_TYPE*) payload; max_data = iov.iov_len; - ompi_convertor_unpack(&convertor, + opal_convertor_unpack(&convertor, &iov, &iov_count, &max_data); @@ -753,17 +753,17 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module, OPAL_THREAD_LOCK(&module->p2p_acc_lock); if (op == &ompi_mpi_op_replace.op) { - ompi_convertor_t convertor; + opal_convertor_t convertor; struct iovec iov; uint32_t iov_count = 1; size_t max_data; /* create convertor */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); /* initialize convertor */ - ompi_convertor_copy_and_prepare_for_recv(proc->proc_convertor, - datatype, + opal_convertor_copy_and_prepare_for_recv(proc->proc_convertor, + &(datatype->super), header->hdr_target_count, target, 0, @@ -772,7 +772,7 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module, iov.iov_len = header->hdr_msg_length; iov.iov_base = (IOVBASE_TYPE*)payload; max_data = iov.iov_len; - ompi_convertor_unpack(&convertor, + opal_convertor_unpack(&convertor, &iov, &iov_count, &max_data); @@ -782,7 +782,7 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module, #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT if (proc->proc_arch != ompi_proc_local()->proc_arch) { - ompi_convertor_t convertor; + opal_convertor_t convertor; struct iovec iov; uint32_t iov_count = 1; size_t max_data; @@ -794,18 +794,18 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module, primitive_count *= header->hdr_target_count; /* figure out how big a buffer we need */ - ompi_ddt_type_size(primitive_datatype, &buflen); + ompi_datatype_type_size(primitive_datatype, &buflen); buflen *= primitive_count; /* create convertor */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); buffer = (void*) malloc(buflen); if (NULL == buffer) return OMPI_ERR_TEMP_OUT_OF_RESOURCE; /* initialize convertor */ - ompi_convertor_copy_and_prepare_for_recv(proc->proc_convertor, - primitive_datatype, + opal_convertor_copy_and_prepare_for_recv(proc->proc_convertor, + &(primitive_datatype->super), primitive_count, buffer, 0, @@ -814,7 +814,7 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module, iov.iov_len = header->hdr_msg_length; iov.iov_base = (IOVBASE_TYPE*)payload; max_data = iov.iov_len; - ompi_convertor_unpack(&convertor, + opal_convertor_unpack(&convertor, &iov, &iov_count, &max_data); @@ -875,7 +875,7 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module, primitive_count *= header->hdr_target_count; /* figure out how big a buffer we need */ - ompi_ddt_type_size(primitive_datatype, &buflen); + ompi_datatype_type_size(primitive_datatype, &buflen); buflen *= primitive_count; /* get a longreq and fill it in */ @@ -972,7 +972,7 @@ ompi_osc_pt2pt_replyreq_recv(ompi_osc_pt2pt_module_t *module, memchecker_convertor_call(&opal_memchecker_base_mem_defined, &sendreq->req_origin_convertor); ); - ompi_convertor_unpack(&sendreq->req_origin_convertor, + opal_convertor_unpack(&sendreq->req_origin_convertor, &iov, &iov_count, &max_data ); diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_replyreq.c b/ompi/mca/osc/pt2pt/osc_pt2pt_replyreq.c index c7f5be12e2..3d92d293b3 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_replyreq.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_replyreq.c @@ -19,7 +19,7 @@ #include "osc_pt2pt_replyreq.h" #include "opal/class/opal_list.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" int ompi_osc_pt2pt_replyreq_alloc_init(ompi_osc_pt2pt_module_t *module, @@ -65,7 +65,7 @@ ompi_osc_pt2pt_replyreq_alloc_init(ompi_osc_pt2pt_module_t *module, static void ompi_osc_pt2pt_replyreq_construct(ompi_osc_pt2pt_replyreq_t *replyreq) { - OBJ_CONSTRUCT(&(replyreq->rep_target_convertor), ompi_convertor_t); + OBJ_CONSTRUCT(&(replyreq->rep_target_convertor), opal_convertor_t); } static void ompi_osc_pt2pt_replyreq_destruct(ompi_osc_pt2pt_replyreq_t *replyreq) diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_replyreq.h b/ompi/mca/osc/pt2pt/osc_pt2pt_replyreq.h index f20b0332bf..6fd8ea5a94 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_replyreq.h +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_replyreq.h @@ -22,8 +22,8 @@ #include "opal/types.h" #include "opal/class/opal_list.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/communicator/communicator.h" #include "ompi/proc/proc.h" #include "ompi/memchecker.h" @@ -38,7 +38,7 @@ struct ompi_osc_pt2pt_replyreq_t { /** Datatype for the target side of the operation */ struct ompi_datatype_t *rep_target_datatype; /** Convertor for the target. Always setup for send. */ - ompi_convertor_t rep_target_convertor; + opal_convertor_t rep_target_convertor; /** packed size of message on the target side */ size_t rep_target_bytes_packed; @@ -99,13 +99,13 @@ ompi_osc_pt2pt_replyreq_init_target(ompi_osc_pt2pt_replyreq_t *replyreq, OBJ_RETAIN(target_dt); replyreq->rep_target_datatype = target_dt; - ompi_convertor_copy_and_prepare_for_send(replyreq->rep_origin_proc->proc_convertor, - target_dt, + opal_convertor_copy_and_prepare_for_send(replyreq->rep_origin_proc->proc_convertor, + &(target_dt->super), target_count, target_addr, 0, &(replyreq->rep_target_convertor)); - ompi_convertor_get_packed_size(&replyreq->rep_target_convertor, + opal_convertor_get_packed_size(&replyreq->rep_target_convertor, &replyreq->rep_target_bytes_packed); return OMPI_SUCCESS; @@ -129,7 +129,7 @@ ompi_osc_pt2pt_replyreq_free(ompi_osc_pt2pt_replyreq_t *replyreq) memchecker_convertor_call(&opal_memchecker_base_mem_defined, &replyreq->rep_target_convertor); ); - ompi_convertor_cleanup(&replyreq->rep_target_convertor); + opal_convertor_cleanup(&replyreq->rep_target_convertor); OBJ_RELEASE(replyreq->rep_target_datatype); diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_sendreq.c b/ompi/mca/osc/pt2pt/osc_pt2pt_sendreq.c index fec0742df4..b0d887b092 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_sendreq.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_sendreq.c @@ -19,7 +19,7 @@ #include "osc_pt2pt_sendreq.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" int @@ -68,7 +68,7 @@ static void ompi_osc_pt2pt_sendreq_construct(ompi_osc_pt2pt_sendreq_t *req) req->super.req_type = OMPI_REQUEST_WIN; req->super.req_free = NULL; req->super.req_cancel = NULL; - OBJ_CONSTRUCT(&(req->req_origin_convertor), ompi_convertor_t); + OBJ_CONSTRUCT(&(req->req_origin_convertor), opal_convertor_t); } diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_sendreq.h b/ompi/mca/osc/pt2pt/osc_pt2pt_sendreq.h index 95c1e7ac69..2039032181 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_sendreq.h +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_sendreq.h @@ -21,8 +21,8 @@ #include "osc_pt2pt_longreq.h" #include "opal/class/opal_list.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/communicator/communicator.h" #include "ompi/proc/proc.h" #include "ompi/memchecker.h" @@ -46,7 +46,7 @@ struct ompi_osc_pt2pt_sendreq_t { struct ompi_datatype_t *req_origin_datatype; /** Convertor for the origin side of the operation. Setup for either send (Put / Accumulate) or receive (Get) */ - ompi_convertor_t req_origin_convertor; + opal_convertor_t req_origin_convertor; /** packed size of message on the origin side */ size_t req_origin_bytes_packed; @@ -117,22 +117,22 @@ ompi_osc_pt2pt_sendreq_init_origin(ompi_osc_pt2pt_sendreq_t *sendreq, sendreq->req_type = req_type; if (req_type != OMPI_OSC_PT2PT_GET) { - ompi_convertor_copy_and_prepare_for_send(sendreq->req_target_proc->proc_convertor, - origin_dt, + opal_convertor_copy_and_prepare_for_send(sendreq->req_target_proc->proc_convertor, + &(origin_dt->super), origin_count, origin_addr, 0, &(sendreq->req_origin_convertor)); - ompi_convertor_get_packed_size(&sendreq->req_origin_convertor, + opal_convertor_get_packed_size(&sendreq->req_origin_convertor, &sendreq->req_origin_bytes_packed); } else { - ompi_convertor_copy_and_prepare_for_recv(sendreq->req_target_proc->proc_convertor, - origin_dt, + opal_convertor_copy_and_prepare_for_recv(sendreq->req_target_proc->proc_convertor, + &(origin_dt->super), origin_count, origin_addr, 0, &(sendreq->req_origin_convertor)); - ompi_convertor_get_packed_size(&sendreq->req_origin_convertor, + opal_convertor_get_packed_size(&sendreq->req_origin_convertor, &sendreq->req_origin_bytes_packed); } @@ -163,7 +163,7 @@ ompi_osc_pt2pt_sendreq_free(ompi_osc_pt2pt_sendreq_t *sendreq) memchecker_convertor_call(&opal_memchecker_base_mem_defined, &sendreq->req_origin_convertor); ); - ompi_convertor_cleanup(&sendreq->req_origin_convertor); + opal_convertor_cleanup(&sendreq->req_origin_convertor); OBJ_RELEASE(sendreq->req_target_datatype); OBJ_RELEASE(sendreq->req_origin_datatype); diff --git a/ompi/mca/osc/rdma/osc_rdma_comm.c b/ompi/mca/osc/rdma/osc_rdma_comm.c index 810a19f697..e075604a70 100644 --- a/ompi/mca/osc/rdma/osc_rdma_comm.c +++ b/ompi/mca/osc/rdma/osc_rdma_comm.c @@ -93,9 +93,9 @@ ompi_osc_rdma_module_accumulate(void *origin_addr, int origin_count, expensive with the extra copies. Put a shortcut in for the common case. */ if (target == ompi_comm_rank(sendreq->req_module->m_comm) && - ompi_ddt_is_contiguous_memory_layout(sendreq->req_target_datatype, + ompi_datatype_is_contiguous_memory_layout(sendreq->req_target_datatype, sendreq->req_target_count) && - !ompi_convertor_need_buffers(&sendreq->req_origin_convertor) && + !opal_convertor_need_buffers(&sendreq->req_origin_convertor) && 0 == OPAL_THREAD_TRYLOCK(&module->m_acc_lock)) { void *target_buffer = (unsigned char*) module->m_win->w_baseptr + ((unsigned long) target_disp * @@ -107,7 +107,7 @@ ompi_osc_rdma_module_accumulate(void *origin_addr, int origin_count, iov.iov_len = max_data; iov.iov_base = NULL; - ret = ompi_convertor_pack(&sendreq->req_origin_convertor, + ret = opal_convertor_pack(&sendreq->req_origin_convertor, &iov, &iov_count, &max_data); if (ret < 0) { diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index b9a62ad7d4..d09eab652a 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -1169,7 +1169,7 @@ setup_rdma(ompi_osc_rdma_module_t *module) int num_avail = mca_bml_base_btl_array_get_size(&endpoint->btl_rdma); size_t j, size; - ompi_convertor_t convertor; + opal_convertor_t convertor; /* skip peer if heterogeneous */ if (ompi_proc_local()->proc_arch != proc->proc_arch) { @@ -1214,7 +1214,7 @@ setup_rdma(ompi_osc_rdma_module_t *module) memset(peer_info->local_descriptors, 0, sizeof(mca_btl_base_descriptor_t*) * num_avail); - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); /* Find all useable btls, try to do the descriptor thing for them, and store all that information */ @@ -1239,8 +1239,8 @@ setup_rdma(ompi_osc_rdma_module_t *module) size = module->m_win->w_size; - ompi_convertor_copy_and_prepare_for_send(proc->proc_convertor, - MPI_BYTE, + opal_convertor_copy_and_prepare_for_send(proc->proc_convertor, + &(ompi_mpi_byte.dt.super), module->m_win->w_size, module->m_win->w_baseptr, 0, @@ -1256,13 +1256,13 @@ setup_rdma(ompi_osc_rdma_module_t *module) btl_mpool->mpool_deregister(btl_mpool, peer_info->local_registrations[index]); } - ompi_convertor_cleanup(&convertor); + opal_convertor_cleanup(&convertor); continue; } peer_info->local_btls[index] = bml_btl; - ompi_convertor_cleanup(&convertor); + opal_convertor_cleanup(&convertor); peer_info->local_num_btls++; module->m_setup_info->num_btls_outgoing++; diff --git a/ompi/mca/osc/rdma/osc_rdma_data_move.c b/ompi/mca/osc/rdma/osc_rdma_data_move.c index 1049f21bf8..5f00f6a056 100644 --- a/ompi/mca/osc/rdma/osc_rdma_data_move.c +++ b/ompi/mca/osc/rdma/osc_rdma_data_move.c @@ -34,7 +34,7 @@ #include "ompi/mca/btl/btl.h" #include "ompi/mca/osc/base/base.h" #include "ompi/mca/osc/base/osc_base_obj_convert.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" @@ -364,7 +364,7 @@ ompi_osc_rdma_sendreq_send_cb(struct mca_btl_base_module_t* btl, header = (ompi_osc_rdma_send_header_t*) (((char*) header) + sizeof(ompi_osc_rdma_send_header_t) + - ompi_ddt_pack_description_length(sendreq->req_target_datatype) + + ompi_datatype_pack_description_length(sendreq->req_target_datatype) + header->hdr_msg_length); if (header->hdr_base.hdr_type == OMPI_OSC_RDMA_HDR_MULTI_END) { done = true; @@ -422,16 +422,16 @@ ompi_osc_rdma_sendreq_send(ompi_osc_rdma_module_t *module, if ((module->m_eager_send_active) && (module->m_use_rdma) && - (ompi_ddt_is_contiguous_memory_layout(sendreq->req_target_datatype, + (ompi_datatype_is_contiguous_memory_layout(sendreq->req_target_datatype, sendreq->req_target_count)) && - (!ompi_convertor_need_buffers(&sendreq->req_origin_convertor)) && + (!opal_convertor_need_buffers(&sendreq->req_origin_convertor)) && (sendreq->req_type != OMPI_OSC_RDMA_ACC)) { ret = ompi_osc_rdma_sendreq_rdma(module, sendreq); if (OPAL_LIKELY(OMPI_SUCCESS == ret)) return ret; } /* we always need to send the ddt */ - packed_ddt_len = ompi_ddt_pack_description_length(sendreq->req_target_datatype); + packed_ddt_len = ompi_datatype_pack_description_length(sendreq->req_target_datatype); needed_len += packed_ddt_len; if (OMPI_OSC_RDMA_GET != sendreq->req_type) { needed_len += sendreq->req_origin_bytes_packed; @@ -519,7 +519,7 @@ ompi_osc_rdma_sendreq_send(ompi_osc_rdma_module_t *module, } /* Set datatype id and / or pack datatype */ - ret = ompi_ddt_get_pack_description(sendreq->req_target_datatype, &packed_ddt); + ret = ompi_datatype_get_pack_description(sendreq->req_target_datatype, &packed_ddt); if (OMPI_SUCCESS != ret) goto cleanup; memcpy((unsigned char*) descriptor->des_src[0].seg_addr.pval + descriptor->des_src[0].seg_len + written_data, packed_ddt, packed_ddt_len); @@ -535,7 +535,7 @@ ompi_osc_rdma_sendreq_send(ompi_osc_rdma_module_t *module, iov.iov_len = max_data; iov.iov_base = (IOVBASE_TYPE*)((unsigned char*) descriptor->des_src[0].seg_addr.pval + descriptor->des_src[0].seg_len + written_data); - ret = ompi_convertor_pack(&sendreq->req_origin_convertor, &iov, &iov_count, + ret = opal_convertor_pack(&sendreq->req_origin_convertor, &iov, &iov_count, &max_data ); if (ret < 0) { ret = OMPI_ERR_FATAL; @@ -742,7 +742,7 @@ ompi_osc_rdma_replyreq_send(ompi_osc_rdma_module_t *module, memchecker_convertor_call(&opal_memchecker_base_mem_defined, &replyreq->rep_target_convertor); ); - ret = ompi_convertor_pack(&replyreq->rep_target_convertor, &iov, &iov_count, + ret = opal_convertor_pack(&replyreq->rep_target_convertor, &iov, &iov_count, &max_data ); MEMCHECKER( memchecker_convertor_call(&opal_memchecker_base_mem_noaccess, @@ -826,19 +826,19 @@ ompi_osc_rdma_sendreq_recv_put(ompi_osc_rdma_module_t *module, } if (header->hdr_msg_length > 0) { - ompi_convertor_t convertor; + opal_convertor_t convertor; struct iovec iov; uint32_t iov_count = 1; size_t max_data; ompi_proc_t *proc; /* create convertor */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); /* initialize convertor */ proc = ompi_comm_peer_lookup(module->m_comm, header->hdr_origin); - ompi_convertor_copy_and_prepare_for_recv(proc->proc_convertor, - datatype, + opal_convertor_copy_and_prepare_for_recv(proc->proc_convertor, + &(datatype->super), header->hdr_target_count, target, 0, @@ -849,7 +849,7 @@ ompi_osc_rdma_sendreq_recv_put(ompi_osc_rdma_module_t *module, MEMCHECKER( memchecker_convertor_call(&opal_memchecker_base_mem_defined, &convertor); ); - ompi_convertor_unpack(&convertor, + opal_convertor_unpack(&convertor, &iov, &iov_count, &max_data ); @@ -925,17 +925,17 @@ ompi_osc_rdma_sendreq_recv_accum_long_cb(ompi_osc_rdma_longreq_t *longreq) OPAL_THREAD_LOCK(&longreq->req_module->m_acc_lock); if (longreq->req_op == &ompi_mpi_op_replace.op) { - ompi_convertor_t convertor; + opal_convertor_t convertor; struct iovec iov; uint32_t iov_count = 1; size_t max_data; /* create convertor */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); /* initialize convertor */ - ompi_convertor_copy_and_prepare_for_recv(ompi_proc_local()->proc_convertor, - longreq->req_datatype, + opal_convertor_copy_and_prepare_for_recv(ompi_proc_local()->proc_convertor, + &(longreq->req_datatype->super), header->hdr_target_count, target_buffer, 0, @@ -948,7 +948,7 @@ ompi_osc_rdma_sendreq_recv_accum_long_cb(ompi_osc_rdma_longreq_t *longreq) memchecker_convertor_call(&opal_memchecker_base_mem_defined, &convertor); ); - ompi_convertor_unpack(&convertor, + opal_convertor_unpack(&convertor, &iov, &iov_count, &max_data); @@ -1015,17 +1015,17 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module, OPAL_THREAD_LOCK(&module->m_acc_lock); if (op == &ompi_mpi_op_replace.op) { - ompi_convertor_t convertor; + opal_convertor_t convertor; struct iovec iov; uint32_t iov_count = 1; size_t max_data; /* create convertor */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); /* initialize convertor */ - ompi_convertor_copy_and_prepare_for_recv(proc->proc_convertor, - datatype, + opal_convertor_copy_and_prepare_for_recv(proc->proc_convertor, + &(datatype->super), header->hdr_target_count, target_buffer, 0, @@ -1037,7 +1037,7 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module, MEMCHECKER( memchecker_convertor_call(&opal_memchecker_base_mem_defined, &convertor); ); - ompi_convertor_unpack(&convertor, + opal_convertor_unpack(&convertor, &iov, &iov_count, &max_data); @@ -1050,11 +1050,11 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module, #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT if (proc->proc_arch != ompi_proc_local()->proc_arch) { - ompi_convertor_t convertor; + opal_convertor_t convertor; struct iovec iov; uint32_t iov_count = 1; size_t max_data; - struct ompi_datatype_t *primitive_datatype = NULL; + ompi_datatype_t *primitive_datatype = NULL; uint32_t primitive_count; size_t buflen; @@ -1062,17 +1062,17 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module, primitive_count *= header->hdr_target_count; /* figure out how big a buffer we need */ - ompi_ddt_type_size(primitive_datatype, &buflen); + ompi_datatype_type_size(primitive_datatype, &buflen); buflen *= primitive_count; /* create convertor */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&convertor, opal_convertor_t); payload = (void*) malloc(buflen); /* initialize convertor */ - ompi_convertor_copy_and_prepare_for_recv(proc->proc_convertor, - primitive_datatype, + opal_convertor_copy_and_prepare_for_recv(proc->proc_convertor, + &(primitive_datatype->super), primitive_count, buffer, 0, @@ -1084,7 +1084,7 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module, MEMCHECKER( memchecker_convertor_call(&opal_memchecker_base_mem_defined, &convertor); ); - ompi_convertor_unpack(&convertor, + opal_convertor_unpack(&convertor, &iov, &iov_count, &max_data); @@ -1139,7 +1139,7 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module, primitive_count *= header->hdr_target_count; /* figure out how big a buffer we need */ - ompi_ddt_type_size(primitive_datatype, &buflen); + ompi_datatype_type_size(primitive_datatype, &buflen); buflen *= primitive_count; /* get a longreq and fill it in */ @@ -1231,7 +1231,7 @@ ompi_osc_rdma_replyreq_recv(ompi_osc_rdma_module_t *module, memchecker_convertor_call(&opal_memchecker_base_mem_defined, &sendreq->req_origin_convertor); ); - ompi_convertor_unpack(&sendreq->req_origin_convertor, + opal_convertor_unpack(&sendreq->req_origin_convertor, &iov, &iov_count, &max_data ); diff --git a/ompi/mca/osc/rdma/osc_rdma_longreq.h b/ompi/mca/osc/rdma/osc_rdma_longreq.h index 970fe37c88..ce4b62c290 100644 --- a/ompi/mca/osc/rdma/osc_rdma_longreq.h +++ b/ompi/mca/osc/rdma/osc_rdma_longreq.h @@ -22,7 +22,7 @@ #include "osc_rdma.h" #include "opal/class/opal_free_list.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/request/request.h" #include "ompi/op/op.h" diff --git a/ompi/mca/osc/rdma/osc_rdma_replyreq.c b/ompi/mca/osc/rdma/osc_rdma_replyreq.c index b833833fcc..bbd9d2de58 100644 --- a/ompi/mca/osc/rdma/osc_rdma_replyreq.c +++ b/ompi/mca/osc/rdma/osc_rdma_replyreq.c @@ -19,7 +19,7 @@ #include "osc_rdma_replyreq.h" #include "opal/class/opal_list.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" int ompi_osc_rdma_replyreq_alloc_init(ompi_osc_rdma_module_t *module, @@ -65,7 +65,7 @@ ompi_osc_rdma_replyreq_alloc_init(ompi_osc_rdma_module_t *module, static void ompi_osc_rdma_replyreq_construct(ompi_osc_rdma_replyreq_t *replyreq) { - OBJ_CONSTRUCT(&(replyreq->rep_target_convertor), ompi_convertor_t); + OBJ_CONSTRUCT(&(replyreq->rep_target_convertor), opal_convertor_t); } static void ompi_osc_rdma_replyreq_destruct(ompi_osc_rdma_replyreq_t *replyreq) diff --git a/ompi/mca/osc/rdma/osc_rdma_replyreq.h b/ompi/mca/osc/rdma/osc_rdma_replyreq.h index 4ab54b3f20..5d92d5ce47 100644 --- a/ompi/mca/osc/rdma/osc_rdma_replyreq.h +++ b/ompi/mca/osc/rdma/osc_rdma_replyreq.h @@ -23,8 +23,8 @@ #include "osc_rdma_longreq.h" #include "opal/class/opal_list.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/communicator/communicator.h" #include "ompi/proc/proc.h" #include "ompi/memchecker.h" @@ -39,7 +39,7 @@ struct ompi_osc_rdma_replyreq_t { /** Datatype for the target side of the operation */ struct ompi_datatype_t *rep_target_datatype; /** Convertor for the target. Always setup for send. */ - ompi_convertor_t rep_target_convertor; + opal_convertor_t rep_target_convertor; /** packed size of message on the target side */ size_t rep_target_bytes_packed; @@ -100,13 +100,13 @@ ompi_osc_rdma_replyreq_init_target(ompi_osc_rdma_replyreq_t *replyreq, OBJ_RETAIN(target_dt); replyreq->rep_target_datatype = target_dt; - ompi_convertor_copy_and_prepare_for_send(replyreq->rep_origin_proc->proc_convertor, - target_dt, + opal_convertor_copy_and_prepare_for_send(replyreq->rep_origin_proc->proc_convertor, + &(target_dt->super), target_count, target_addr, 0, &(replyreq->rep_target_convertor)); - ompi_convertor_get_packed_size(&replyreq->rep_target_convertor, + opal_convertor_get_packed_size(&replyreq->rep_target_convertor, &replyreq->rep_target_bytes_packed); return OMPI_SUCCESS; @@ -130,7 +130,7 @@ ompi_osc_rdma_replyreq_free(ompi_osc_rdma_replyreq_t *replyreq) memchecker_convertor_call(&opal_memchecker_base_mem_defined, &replyreq->rep_target_convertor); ); - ompi_convertor_cleanup(&replyreq->rep_target_convertor); + opal_convertor_cleanup(&replyreq->rep_target_convertor); OBJ_RELEASE(replyreq->rep_target_datatype); diff --git a/ompi/mca/osc/rdma/osc_rdma_sendreq.c b/ompi/mca/osc/rdma/osc_rdma_sendreq.c index 1385f58c50..c4ebf4e53e 100644 --- a/ompi/mca/osc/rdma/osc_rdma_sendreq.c +++ b/ompi/mca/osc/rdma/osc_rdma_sendreq.c @@ -19,7 +19,7 @@ #include "osc_rdma_sendreq.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" int @@ -68,7 +68,7 @@ static void ompi_osc_rdma_sendreq_construct(ompi_osc_rdma_sendreq_t *req) req->super.req_type = OMPI_REQUEST_WIN; req->super.req_free = NULL; req->super.req_cancel = NULL; - OBJ_CONSTRUCT(&(req->req_origin_convertor), ompi_convertor_t); + OBJ_CONSTRUCT(&(req->req_origin_convertor), opal_convertor_t); } diff --git a/ompi/mca/osc/rdma/osc_rdma_sendreq.h b/ompi/mca/osc/rdma/osc_rdma_sendreq.h index a216ccc3c1..1d82584e7f 100644 --- a/ompi/mca/osc/rdma/osc_rdma_sendreq.h +++ b/ompi/mca/osc/rdma/osc_rdma_sendreq.h @@ -23,8 +23,8 @@ #include "osc_rdma_longreq.h" #include "opal/class/opal_list.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/communicator/communicator.h" #include "ompi/proc/proc.h" #include "ompi/memchecker.h" @@ -50,7 +50,7 @@ struct ompi_osc_rdma_sendreq_t { struct ompi_datatype_t *req_origin_datatype; /** Convertor for the origin side of the operation. Setup for either send (Put / Accumulate) or receive (Get) */ - ompi_convertor_t req_origin_convertor; + opal_convertor_t req_origin_convertor; /** packed size of message on the origin side */ size_t req_origin_bytes_packed; @@ -124,22 +124,22 @@ ompi_osc_rdma_sendreq_init_origin(ompi_osc_rdma_sendreq_t *sendreq, sendreq->req_type = req_type; if (req_type != OMPI_OSC_RDMA_GET) { - ompi_convertor_copy_and_prepare_for_send(sendreq->req_target_proc->proc_convertor, - origin_dt, + opal_convertor_copy_and_prepare_for_send(sendreq->req_target_proc->proc_convertor, + &(origin_dt->super), origin_count, origin_addr, 0, &(sendreq->req_origin_convertor)); - ompi_convertor_get_packed_size(&sendreq->req_origin_convertor, + opal_convertor_get_packed_size(&sendreq->req_origin_convertor, &sendreq->req_origin_bytes_packed); } else { - ompi_convertor_copy_and_prepare_for_recv(sendreq->req_target_proc->proc_convertor, - origin_dt, + opal_convertor_copy_and_prepare_for_recv(sendreq->req_target_proc->proc_convertor, + &(origin_dt->super), origin_count, origin_addr, 0, &(sendreq->req_origin_convertor)); - ompi_convertor_get_packed_size(&sendreq->req_origin_convertor, + opal_convertor_get_packed_size(&sendreq->req_origin_convertor, &sendreq->req_origin_bytes_packed); } @@ -171,7 +171,7 @@ ompi_osc_rdma_sendreq_free(ompi_osc_rdma_sendreq_t *sendreq) memchecker_convertor_call(&opal_memchecker_base_mem_defined, &sendreq->req_origin_convertor); ); - ompi_convertor_cleanup(&sendreq->req_origin_convertor); + opal_convertor_cleanup(&sendreq->req_origin_convertor); OBJ_RELEASE(sendreq->req_target_datatype); OBJ_RELEASE(sendreq->req_origin_datatype); diff --git a/ompi/mca/pml/base/pml_base_bsend.c b/ompi/mca/pml/base/pml_base_bsend.c index d0a803f87b..f9585a1fcd 100644 --- a/ompi/mca/pml/base/pml_base_bsend.c +++ b/ompi/mca/pml/base/pml_base_bsend.c @@ -20,6 +20,7 @@ #include "ompi_config.h" #include "opal/threads/mutex.h" #include "opal/threads/condition.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/allocator/base/base.h" #include "ompi/mca/allocator/allocator.h" #include "opal/mca/base/mca_base_param.h" @@ -252,7 +253,7 @@ int mca_pml_base_bsend_request_start(ompi_request_t* request) iov.iov_len = sendreq->req_bytes_packed; iov_count = 1; max_data = iov.iov_len; - if((rc = ompi_convertor_pack( &sendreq->req_base.req_convertor, + if((rc = opal_convertor_pack( &sendreq->req_base.req_convertor, &iov, &iov_count, &max_data )) < 0) { @@ -260,7 +261,7 @@ int mca_pml_base_bsend_request_start(ompi_request_t* request) } /* setup convertor to point to packed buffer (at position zero) */ - ompi_convertor_prepare_for_send( &sendreq->req_base.req_convertor, MPI_PACKED, + opal_convertor_prepare_for_send( &sendreq->req_base.req_convertor, &(ompi_mpi_packed.dt.super), max_data, sendreq->req_addr ); /* increment count of pending requests */ mca_pml_bsend_count++; diff --git a/ompi/mca/pml/base/pml_base_recvreq.c b/ompi/mca/pml/base/pml_base_recvreq.c index bdf23f4fdb..6ad6fa3dc2 100644 --- a/ompi/mca/pml/base/pml_base_recvreq.c +++ b/ompi/mca/pml/base/pml_base_recvreq.c @@ -39,7 +39,7 @@ static void mca_pml_base_recv_request_construct(mca_pml_base_recv_request_t* req { /* no need to reinit for every recv -- never changes */ request->req_base.req_type = MCA_PML_REQUEST_RECV; - OBJ_CONSTRUCT(&request->req_base.req_convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&request->req_base.req_convertor, opal_convertor_t); } diff --git a/ompi/mca/pml/base/pml_base_recvreq.h b/ompi/mca/pml/base/pml_base_recvreq.h index a33c4efa0b..de94546d2d 100644 --- a/ompi/mca/pml/base/pml_base_recvreq.h +++ b/ompi/mca/pml/base/pml_base_recvreq.h @@ -24,7 +24,7 @@ #include "ompi_config.h" #include "ompi/mca/pml/base/pml_base_request.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/peruse/peruse-internal.h" BEGIN_C_DECLS @@ -114,7 +114,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_pml_base_recv_request_t); OMPI_REQUEST_FINI(&(request)->req_base.req_ompi); \ OBJ_RELEASE( (request)->req_base.req_comm); \ OBJ_RELEASE( (request)->req_base.req_datatype ); \ - ompi_convertor_cleanup( &((request)->req_base.req_convertor) ); \ + opal_convertor_cleanup( &((request)->req_base.req_convertor) ); \ } while (0) END_C_DECLS diff --git a/ompi/mca/pml/base/pml_base_request.h b/ompi/mca/pml/base/pml_base_request.h index d1399b48bd..be7669c7f6 100644 --- a/ompi/mca/pml/base/pml_base_request.h +++ b/ompi/mca/pml/base/pml_base_request.h @@ -27,7 +27,7 @@ #include "ompi/class/ompi_free_list.h" #include "ompi/communicator/communicator.h" #include "ompi/request/request.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" BEGIN_C_DECLS @@ -63,7 +63,7 @@ struct mca_pml_base_request_t { struct ompi_communicator_t *req_comm; /**< communicator pointer */ struct ompi_datatype_t *req_datatype; /**< pointer to data type */ volatile bool req_free_called; /**< flag indicating if the user has freed this request */ - ompi_convertor_t req_convertor; /**< always need the convertor */ + opal_convertor_t req_convertor; /**< always need the convertor */ /* END: These field have to match the definition of the mca_pml_cm_request_t */ void *req_addr; /**< pointer to application buffer */ diff --git a/ompi/mca/pml/base/pml_base_sendreq.c b/ompi/mca/pml/base/pml_base_sendreq.c index 510e34896e..d7a4ffcf11 100644 --- a/ompi/mca/pml/base/pml_base_sendreq.c +++ b/ompi/mca/pml/base/pml_base_sendreq.c @@ -36,7 +36,7 @@ static void mca_pml_base_send_request_construct(mca_pml_base_send_request_t* req { /* no need to reinit for every send -- never changes */ request->req_base.req_type = MCA_PML_REQUEST_SEND; - OBJ_CONSTRUCT(&request->req_base.req_convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&request->req_base.req_convertor, opal_convertor_t); } static void mca_pml_base_send_request_destruct(mca_pml_base_send_request_t* req) diff --git a/ompi/mca/pml/base/pml_base_sendreq.h b/ompi/mca/pml/base/pml_base_sendreq.h index ffd0e94b61..f4d1980e41 100644 --- a/ompi/mca/pml/base/pml_base_sendreq.h +++ b/ompi/mca/pml/base/pml_base_sendreq.h @@ -25,7 +25,7 @@ #include "ompi_config.h" #include "ompi/mca/pml/pml.h" #include "ompi/mca/pml/base/pml_base_request.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/peruse/peruse-internal.h" BEGIN_C_DECLS @@ -96,14 +96,14 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION( mca_pml_base_send_request_t ); OBJ_RETAIN(datatype); \ /* We will create a convertor specialized for the */ \ /* remote architecture and prepared with the datatype. */ \ - ompi_convertor_copy_and_prepare_for_send( \ + opal_convertor_copy_and_prepare_for_send( \ (request)->req_base.req_proc->proc_convertor, \ - (request)->req_base.req_datatype, \ + &((request)->req_base.req_datatype->super), \ (request)->req_base.req_count, \ (request)->req_base.req_addr, \ convertor_flags, \ &(request)->req_base.req_convertor ); \ - ompi_convertor_get_packed_size( &(request)->req_base.req_convertor, \ + opal_convertor_get_packed_size( &(request)->req_base.req_convertor, \ &((request)->req_bytes_packed) );\ } \ } @@ -134,7 +134,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION( mca_pml_base_send_request_t ); OBJ_RELEASE((request)->req_base.req_comm); \ if( 0 != (request)->req_base.req_count ) \ OBJ_RELEASE((request)->req_base.req_datatype); \ - ompi_convertor_cleanup( &((request)->req_base.req_convertor) ); \ + opal_convertor_cleanup( &((request)->req_base.req_convertor) ); \ } while (0) diff --git a/ompi/mca/pml/cm/pml_cm.h b/ompi/mca/pml/cm/pml_cm.h index f669aa2b6d..1e5466fcae 100644 --- a/ompi/mca/pml/cm/pml_cm.h +++ b/ompi/mca/pml/cm/pml_cm.h @@ -18,7 +18,7 @@ #include "ompi/request/request.h" #include "ompi/mca/pml/pml.h" #include "ompi/mca/pml/base/base.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "ompi/request/request.h" #include "ompi/mca/mtl/mtl.h" diff --git a/ompi/mca/pml/cm/pml_cm_recv.c b/ompi/mca/pml/cm/pml_cm_recv.c index 3a79d1acf5..5ea33ffc5b 100644 --- a/ompi/mca/pml/cm/pml_cm_recv.c +++ b/ompi/mca/pml/cm/pml_cm_recv.c @@ -14,7 +14,7 @@ #include "opal/prefetch.h" #include "ompi/request/request.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "pml_cm.h" diff --git a/ompi/mca/pml/cm/pml_cm_recvreq.c b/ompi/mca/pml/cm/pml_cm_recvreq.c index 3eaf45f71d..a2eeac13d6 100644 --- a/ompi/mca/pml/cm/pml_cm_recvreq.c +++ b/ompi/mca/pml/cm/pml_cm_recvreq.c @@ -61,7 +61,7 @@ mca_pml_cm_recv_request_construct(mca_pml_cm_thin_recv_request_t* recvreq) { recvreq->req_base.req_ompi.req_free = mca_pml_cm_recv_request_free; recvreq->req_base.req_ompi.req_cancel = mca_pml_cm_cancel; - OBJ_CONSTRUCT( &(recvreq->req_base.req_convertor), ompi_convertor_t ); + OBJ_CONSTRUCT( &(recvreq->req_base.req_convertor), opal_convertor_t ); } diff --git a/ompi/mca/pml/cm/pml_cm_recvreq.h b/ompi/mca/pml/cm/pml_cm_recvreq.h index c3a6fe0748..ab1fa11d84 100644 --- a/ompi/mca/pml/cm/pml_cm_recvreq.h +++ b/ompi/mca/pml/cm/pml_cm_recvreq.h @@ -107,9 +107,9 @@ do { \ } else { \ ompi_proc = ompi_comm_peer_lookup( comm, src ); \ } \ - ompi_convertor_copy_and_prepare_for_recv( \ + opal_convertor_copy_and_prepare_for_recv( \ ompi_proc->proc_convertor, \ - datatype, \ + &(datatype->super), \ count, \ addr, \ 0, \ @@ -144,9 +144,9 @@ do { \ } else { \ ompi_proc = ompi_comm_peer_lookup( comm, src ); \ } \ - ompi_convertor_copy_and_prepare_for_recv( \ + opal_convertor_copy_and_prepare_for_recv( \ ompi_proc->proc_convertor, \ - datatype, \ + &(datatype->super), \ count, \ addr, \ 0, \ @@ -259,7 +259,7 @@ do { \ if(recvreq->req_base.req_ompi.req_persistent) { \ /* rewind convertor */ \ size_t offset = 0; \ - ompi_convertor_set_position(&recvreq->req_base.req_convertor, &offset); \ + opal_convertor_set_position(&recvreq->req_base.req_convertor, &offset); \ } \ recvreq->req_base.req_pml_complete = true; \ ompi_request_complete( &(recvreq->req_base.req_ompi), true ); \ @@ -276,7 +276,7 @@ do { \ OBJ_RELEASE((recvreq)->req_base.req_comm); \ OBJ_RELEASE((recvreq)->req_base.req_datatype); \ OMPI_REQUEST_FINI(&(recvreq)->req_base.req_ompi); \ - ompi_convertor_cleanup( &((recvreq)->req_base.req_convertor) ); \ + opal_convertor_cleanup( &((recvreq)->req_base.req_convertor) ); \ OMPI_FREE_LIST_RETURN( &mca_pml_base_recv_requests, \ (ompi_free_list_item_t*)(recvreq)); \ } @@ -289,7 +289,7 @@ do { \ OBJ_RELEASE((recvreq)->req_base.req_comm); \ OBJ_RELEASE((recvreq)->req_base.req_datatype); \ OMPI_REQUEST_FINI(&(recvreq)->req_base.req_ompi); \ - ompi_convertor_cleanup( &((recvreq)->req_base.req_convertor) ); \ + opal_convertor_cleanup( &((recvreq)->req_base.req_convertor) ); \ OMPI_FREE_LIST_RETURN( &mca_pml_base_recv_requests, \ (ompi_free_list_item_t*)(recvreq)); \ } diff --git a/ompi/mca/pml/cm/pml_cm_request.c b/ompi/mca/pml/cm/pml_cm_request.c index 88598be6e8..feab34e23f 100644 --- a/ompi/mca/pml/cm/pml_cm_request.c +++ b/ompi/mca/pml/cm/pml_cm_request.c @@ -23,7 +23,7 @@ static void mca_pml_cm_request_construct( mca_pml_cm_request_t* req) { - OBJ_CONSTRUCT(&req->req_convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&req->req_convertor, opal_convertor_t); req->req_ompi.req_type = OMPI_REQUEST_PML; } diff --git a/ompi/mca/pml/cm/pml_cm_request.h b/ompi/mca/pml/cm/pml_cm_request.h index 628f0596f9..3451da375b 100644 --- a/ompi/mca/pml/cm/pml_cm_request.h +++ b/ompi/mca/pml/cm/pml_cm_request.h @@ -47,7 +47,7 @@ struct mca_pml_cm_request_t { struct ompi_communicator_t *req_comm; /**< communicator pointer */ struct ompi_datatype_t *req_datatype; /**< pointer to data type */ volatile bool req_free_called; /**< flag indicating if the user has freed this request */ - ompi_convertor_t req_convertor; /**< convertor that describes the memory layout */ + opal_convertor_t req_convertor; /**< convertor that describes the memory layout */ /* END: These fields have to match the definition of the mca_pml_base_request_t */ }; typedef struct mca_pml_cm_request_t mca_pml_cm_request_t; diff --git a/ompi/mca/pml/cm/pml_cm_send.c b/ompi/mca/pml/cm/pml_cm_send.c index 2a167d8607..50de9b7416 100644 --- a/ompi/mca/pml/cm/pml_cm_send.c +++ b/ompi/mca/pml/cm/pml_cm_send.c @@ -12,7 +12,7 @@ #include "opal/prefetch.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/communicator/communicator.h" #include "pml_cm.h" diff --git a/ompi/mca/pml/cm/pml_cm_sendreq.h b/ompi/mca/pml/cm/pml_cm_sendreq.h index 918b4aa7be..c2f3186593 100644 --- a/ompi/mca/pml/cm/pml_cm_sendreq.h +++ b/ompi/mca/pml/cm/pml_cm_sendreq.h @@ -110,9 +110,9 @@ do { \ OBJ_RETAIN(datatype); \ (req_send)->req_base.req_comm = comm; \ (req_send)->req_base.req_datatype = datatype; \ - ompi_convertor_copy_and_prepare_for_send( \ + opal_convertor_copy_and_prepare_for_send( \ ompi_proc->proc_convertor, \ - datatype, \ + &(datatype->super), \ count, \ buf, \ 0, \ @@ -152,7 +152,7 @@ do { \ sendmode, \ buf, \ count); \ - ompi_convertor_get_packed_size( \ + opal_convertor_get_packed_size( \ &sendreq->req_send.req_base.req_convertor, \ &sendreq->req_count ); \ \ @@ -230,11 +230,12 @@ do { \ iov.iov_base = (IOVBASE_TYPE*)sendreq->req_buff; \ max_data = iov.iov_len = sendreq->req_count; \ iov_count = 1; \ - ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, \ + opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, \ &iov, \ &iov_count, \ &max_data ); \ - ompi_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, MPI_PACKED, \ + opal_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, \ + &(ompi_mpi_packed.dt.super), \ max_data, sendreq->req_buff ); \ } \ } \ @@ -294,7 +295,7 @@ do { if(sendreq->req_send.req_base.req_ompi.req_persistent) { \ /* rewind convertor */ \ size_t offset = 0; \ - ompi_convertor_set_position(&sendreq->req_send.req_base.req_convertor, \ + opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, \ &offset); \ } \ } \ @@ -311,7 +312,7 @@ do { OBJ_RELEASE(sendreq->req_send.req_base.req_datatype); \ OBJ_RELEASE(sendreq->req_send.req_base.req_comm); \ OMPI_REQUEST_FINI(&sendreq->req_send.req_base.req_ompi); \ - ompi_convertor_cleanup( &(sendreq->req_send.req_base.req_convertor) ); \ + opal_convertor_cleanup( &(sendreq->req_send.req_base.req_convertor) ); \ OMPI_FREE_LIST_RETURN( &mca_pml_base_send_requests, \ (ompi_free_list_item_t*)sendreq); \ } @@ -350,7 +351,7 @@ do { \ OBJ_RELEASE(sendreq->req_send.req_base.req_datatype); \ OBJ_RELEASE(sendreq->req_send.req_base.req_comm); \ OMPI_REQUEST_FINI(&sendreq->req_send.req_base.req_ompi); \ - ompi_convertor_cleanup( &(sendreq->req_send.req_base.req_convertor) ); \ + opal_convertor_cleanup( &(sendreq->req_send.req_base.req_convertor) ); \ OMPI_FREE_LIST_RETURN( &mca_pml_base_send_requests, \ (ompi_free_list_item_t*)sendreq); \ } diff --git a/ompi/mca/pml/crcpw/pml_crcpw.h b/ompi/mca/pml/crcpw/pml_crcpw.h index d771eff29c..e9b4f51f28 100644 --- a/ompi/mca/pml/crcpw/pml_crcpw.h +++ b/ompi/mca/pml/crcpw/pml_crcpw.h @@ -31,7 +31,7 @@ #include "ompi/mca/pml/base/pml_base_request.h" #include "ompi/mca/pml/base/pml_base_bsend.h" #include "ompi/mca/pml/base/pml_base_sendreq.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mca/crcp/crcp.h" #include "ompi/mca/crcp/base/base.h" diff --git a/ompi/mca/pml/csum/pml_csum.h b/ompi/mca/pml/csum/pml_csum.h index 0792950227..50bec55680 100644 --- a/ompi/mca/pml/csum/pml_csum.h +++ b/ompi/mca/pml/csum/pml_csum.h @@ -32,7 +32,7 @@ #include "ompi/mca/pml/base/pml_base_request.h" #include "ompi/mca/pml/base/pml_base_bsend.h" #include "ompi/mca/pml/base/pml_base_sendreq.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "pml_csum_hdr.h" #include "ompi/mca/bml/base/base.h" #include "ompi/proc/proc.h" diff --git a/ompi/mca/pml/csum/pml_csum_rdmafrag.h b/ompi/mca/pml/csum/pml_csum_rdmafrag.h index c0e5c55df1..0226f8aaf1 100644 --- a/ompi/mca/pml/csum/pml_csum_rdmafrag.h +++ b/ompi/mca/pml/csum/pml_csum_rdmafrag.h @@ -41,7 +41,7 @@ struct mca_pml_csum_rdma_frag_t { mca_btl_base_segment_t rdma_segs[MCA_BTL_DES_MAX_SEGMENTS]; void *rdma_req; struct mca_bml_base_endpoint_t* rdma_ep; - ompi_convertor_t convertor; + opal_convertor_t convertor; mca_mpool_base_registration_t* reg; uint32_t retries; }; diff --git a/ompi/mca/pml/csum/pml_csum_recvfrag.c b/ompi/mca/pml/csum/pml_csum_recvfrag.c index 9e1f8b792b..1dbaba5540 100644 --- a/ompi/mca/pml/csum/pml_csum_recvfrag.c +++ b/ompi/mca/pml/csum/pml_csum_recvfrag.c @@ -245,7 +245,7 @@ void mca_pml_csum_recv_frag_callback_match(mca_btl_base_module_t* btl, iov[iov_count].iov_base = (IOVBASE_TYPE*)((unsigned char*)segments[iov_count].seg_addr.pval); iov_count++; } - ompi_convertor_unpack( &match->req_recv.req_base.req_convertor, + opal_convertor_unpack( &match->req_recv.req_base.req_convertor, iov, &iov_count, &bytes_received ); diff --git a/ompi/mca/pml/csum/pml_csum_recvreq.c b/ompi/mca/pml/csum/pml_csum_recvreq.c index 38c6f521dd..2245008795 100644 --- a/ompi/mca/pml/csum/pml_csum_recvreq.c +++ b/ompi/mca/pml/csum/pml_csum_recvreq.c @@ -277,11 +277,11 @@ static int mca_pml_csum_recv_request_ack( * registered. */ - if(ompi_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == 0 && + if(opal_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == 0 && hdr->hdr_match.hdr_common.hdr_flags & MCA_PML_CSUM_HDR_FLAGS_CONTIG && rdma_num != 0) { unsigned char *base; - ompi_convertor_get_current_pointer( &recvreq->req_recv.req_base.req_convertor, (void**)&(base) ); + opal_convertor_get_current_pointer( &recvreq->req_recv.req_base.req_convertor, (void**)&(base) ); if(hdr->hdr_match.hdr_common.hdr_flags & MCA_PML_CSUM_HDR_FLAGS_PIN) recvreq->req_rdma_cnt = mca_pml_csum_rdma_btls(bml_endpoint, @@ -304,7 +304,7 @@ static int mca_pml_csum_recv_request_ack( /* use converter to figure out the rdma offset for this * request */ - ompi_convertor_set_position(&recvreq->req_recv.req_base.req_convertor, + opal_convertor_set_position(&recvreq->req_recv.req_base.req_convertor, &recvreq->req_send_offset); recvreq->req_rdma_cnt = @@ -512,7 +512,7 @@ void mca_pml_csum_recv_request_progress_rget( mca_pml_csum_recv_request_t* recvr * fall back to copy in/out protocol. It is a pity because buffer on the * sender side is already registered. We need to be smarter here, perhaps * do couple of RDMA reads */ - if(ompi_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == true) { + if(opal_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == true) { mca_pml_csum_recv_request_ack(recvreq, &hdr->hdr_rndv, 0); return; } @@ -803,7 +803,7 @@ int mca_pml_csum_recv_request_schedule_once( mca_pml_csum_recv_request_t* recvre /* take lock to protect converter against concurrent access * from unpack */ OPAL_THREAD_LOCK(&recvreq->lock); - ompi_convertor_set_position( &recvreq->req_recv.req_base.req_convertor, + opal_convertor_set_position( &recvreq->req_recv.req_base.req_convertor, &recvreq->req_rdma_offset ); /* prepare a descriptor for RDMA */ diff --git a/ompi/mca/pml/csum/pml_csum_recvreq.h b/ompi/mca/pml/csum/pml_csum_recvreq.h index 4fcf966de5..85f91d78a8 100644 --- a/ompi/mca/pml/csum/pml_csum_recvreq.h +++ b/ompi/mca/pml/csum/pml_csum_recvreq.h @@ -197,15 +197,15 @@ extern void mca_pml_csum_recv_req_start(mca_pml_csum_recv_request_t *req); static inline void prepare_recv_req_converter(mca_pml_csum_recv_request_t *req) { - if( req->req_recv.req_base.req_datatype->size | req->req_recv.req_base.req_count ) { - ompi_convertor_copy_and_prepare_for_recv( + if( req->req_recv.req_base.req_datatype->super.size | req->req_recv.req_base.req_count ) { + opal_convertor_copy_and_prepare_for_recv( req->req_recv.req_base.req_proc->proc_convertor, - req->req_recv.req_base.req_datatype, + &(req->req_recv.req_base.req_datatype->super), req->req_recv.req_base.req_count, req->req_recv.req_base.req_addr, CONVERTOR_WITH_CHECKSUM, &req->req_recv.req_base.req_convertor); - ompi_convertor_get_unpacked_size(&req->req_recv.req_base.req_convertor, + opal_convertor_get_unpacked_size(&req->req_recv.req_base.req_convertor, &req->req_bytes_delivered); } } @@ -270,9 +270,9 @@ do { PERUSE_TRACE_COMM_OMPI_EVENT (PERUSE_COMM_REQ_XFER_CONTINUE, \ &(recvreq->req_recv.req_base), max_data, \ PERUSE_RECV); \ - ompi_convertor_set_position( &(request->req_recv.req_base.req_convertor), \ + opal_convertor_set_position( &(request->req_recv.req_base.req_convertor), \ &data_offset ); \ - ompi_convertor_unpack( &(request)->req_recv.req_base.req_convertor, \ + opal_convertor_unpack( &(request)->req_recv.req_base.req_convertor, \ iov, \ &iov_count, \ &max_data ); \ diff --git a/ompi/mca/pml/csum/pml_csum_sendreq.c b/ompi/mca/pml/csum/pml_csum_sendreq.c index c3379540d9..9fd6eee89f 100644 --- a/ompi/mca/pml/csum/pml_csum_sendreq.c +++ b/ompi/mca/pml/csum/pml_csum_sendreq.c @@ -364,7 +364,7 @@ int mca_pml_csum_send_request_start_buffered( iov.iov_len = size; iov_count = 1; max_data = size; - if((rc = ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, + if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, &iov, &iov_count, &max_data)) < 0) { @@ -412,7 +412,7 @@ int mca_pml_csum_send_request_start_buffered( iov.iov_base = (IOVBASE_TYPE*)(((unsigned char*)sendreq->req_send.req_addr) + max_data); iov.iov_len = max_data = sendreq->req_send.req_bytes_packed - max_data; - if((rc = ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, + if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, &iov, &iov_count, &max_data)) < 0) { @@ -421,8 +421,8 @@ int mca_pml_csum_send_request_start_buffered( } /* re-init convertor for packed data */ - ompi_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, - MPI_BYTE, + opal_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, + &(ompi_mpi_byte.dt.super), sendreq->req_send.req_bytes_packed, sendreq->req_send.req_addr ); @@ -530,7 +530,7 @@ int mca_pml_csum_send_request_start_copy( mca_pml_csum_send_request_t* sendreq, sendreq->req_send.req_base.req_count, sendreq->req_send.req_base.req_datatype); ); - (void)ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, + (void)opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, &iov, &iov_count, &max_data ); /* * Packing finished, make the user buffer unaccessable. @@ -718,7 +718,7 @@ int mca_pml_csum_send_request_start_rdma( mca_pml_csum_send_request_t* sendreq, sendreq->req_send.req_base.req_datatype); ); if( OPAL_UNLIKELY(NULL == src) ) { - ompi_convertor_set_position(&sendreq->req_send.req_base.req_convertor, + opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, &old_position); return OMPI_ERR_OUT_OF_RESOURCE; } @@ -731,7 +731,7 @@ int mca_pml_csum_send_request_start_rdma( mca_pml_csum_send_request_t* sendreq, (sizeof(mca_btl_base_segment_t) * (src->des_src_cnt-1)), MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); if( OPAL_UNLIKELY(NULL == des) ) { - ompi_convertor_set_position( &sendreq->req_send.req_base.req_convertor, + opal_convertor_set_position( &sendreq->req_send.req_base.req_convertor, &old_position ); mca_bml_base_free(bml_btl, src); return OMPI_ERR_OUT_OF_RESOURCE; @@ -1074,7 +1074,7 @@ cannot_pack: /* pack into a descriptor */ offset = (size_t)range->range_send_offset; - ompi_convertor_set_position(&sendreq->req_send.req_base.req_convertor, + opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, &offset); range->range_send_offset = (uint64_t)offset; @@ -1215,7 +1215,7 @@ int mca_pml_csum_send_request_put_frag( mca_pml_csum_rdma_frag_t* frag ) if(frag->retries < mca_pml_csum.rdma_put_retries_limit) { size_t offset = (size_t)frag->rdma_hdr.hdr_rdma.hdr_rdma_offset; frag->rdma_length = save_size; - ompi_convertor_set_position(&frag->convertor, &offset); + opal_convertor_set_position(&frag->convertor, &offset); OPAL_THREAD_LOCK(&mca_pml_csum.lock); opal_list_append(&mca_pml_csum.rdma_pending, (opal_list_item_t*)frag); OPAL_THREAD_UNLOCK(&mca_pml_csum.lock); @@ -1331,7 +1331,7 @@ void mca_pml_csum_send_request_put( mca_pml_csum_send_request_t* sendreq, * create clone of the convertor for each RDMA fragment */ size = hdr->hdr_rdma_offset; - ompi_convertor_clone_with_position(&sendreq->req_send.req_base.req_convertor, + opal_convertor_clone_with_position(&sendreq->req_send.req_base.req_convertor, &frag->convertor, 0, &size); mca_pml_csum_send_request_put_frag(frag); diff --git a/ompi/mca/pml/csum/pml_csum_sendreq.h b/ompi/mca/pml/csum/pml_csum_sendreq.h index 70f8fbf6cb..20931538c6 100644 --- a/ompi/mca/pml/csum/pml_csum_sendreq.h +++ b/ompi/mca/pml/csum/pml_csum_sendreq.h @@ -29,7 +29,7 @@ #include "pml_csum_hdr.h" #include "pml_csum_rdma.h" #include "pml_csum_rdmafrag.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/bml/bml.h" BEGIN_C_DECLS @@ -375,9 +375,9 @@ mca_pml_csum_send_request_start_btl( mca_pml_csum_send_request_t* sendreq, if(sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { rc = mca_pml_csum_send_request_start_buffered(sendreq, bml_btl, size); } else if - (ompi_convertor_need_buffers(&sendreq->req_send.req_base.req_convertor) == false) { + (opal_convertor_need_buffers(&sendreq->req_send.req_base.req_convertor) == false) { unsigned char *base; - ompi_convertor_get_current_pointer( &sendreq->req_send.req_base.req_convertor, (void**)&base ); + opal_convertor_get_current_pointer( &sendreq->req_send.req_base.req_convertor, (void**)&base ); if( 0 != (sendreq->req_rdma_cnt = (uint32_t)mca_pml_csum_rdma_btls( sendreq->req_endpoint, diff --git a/ompi/mca/pml/csum/pml_csum_start.c b/ompi/mca/pml/csum/pml_csum_start.c index 47949ffeeb..497ea7f1cf 100644 --- a/ompi/mca/pml/csum/pml_csum_start.c +++ b/ompi/mca/pml/csum/pml_csum_start.c @@ -119,7 +119,7 @@ int mca_pml_csum_start(size_t count, ompi_request_t** requests) * Reset the convertor in case we're dealing with the original * request, which when completed do not reset the convertor. */ - ompi_convertor_set_position( &sendreq->req_send.req_base.req_convertor, + opal_convertor_set_position( &sendreq->req_send.req_base.req_convertor, &offset ); } MCA_PML_CSUM_SEND_REQUEST_START(sendreq, rc); diff --git a/ompi/mca/pml/dr/pml_dr.h b/ompi/mca/pml/dr/pml_dr.h index 61428d9093..8922498653 100644 --- a/ompi/mca/pml/dr/pml_dr.h +++ b/ompi/mca/pml/dr/pml_dr.h @@ -32,7 +32,7 @@ #include "ompi/mca/pml/base/pml_base_bsend.h" #include "ompi/mca/pml/base/pml_base_sendreq.h" #include "opal/class/opal_pointer_array.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #if defined(c_plusplus) || defined(__cplusplus) extern "C" { diff --git a/ompi/mca/pml/dr/pml_dr_recvreq.h b/ompi/mca/pml/dr/pml_dr_recvreq.h index 31da08c8ef..899211401a 100644 --- a/ompi/mca/pml/dr/pml_dr_recvreq.h +++ b/ompi/mca/pml/dr/pml_dr_recvreq.h @@ -250,12 +250,12 @@ do { (request)->req_recv.req_bytes_packed = bytes_packed; \ if((request)->req_recv.req_bytes_packed != 0) { \ ompi_proc_t *proc = (request)->req_proc->ompi_proc; \ - ompi_convertor_copy_and_prepare_for_recv( proc->proc_convertor, \ - (request)->req_recv.req_base.req_datatype, \ - (request)->req_recv.req_base.req_count, \ - (request)->req_recv.req_base.req_addr, \ - (do_csum ? CONVERTOR_WITH_CHECKSUM: 0), \ - &(request)->req_recv.req_base.req_convertor ); \ + opal_convertor_copy_and_prepare_for_recv( proc->proc_convertor, \ + &((request)->req_recv.req_base.req_datatype->super), \ + (request)->req_recv.req_base.req_count, \ + (request)->req_recv.req_base.req_addr, \ + (do_csum ? CONVERTOR_WITH_CHECKSUM: 0), \ + &(request)->req_recv.req_base.req_convertor ); \ } \ } while (0) @@ -293,10 +293,10 @@ do { iov_count++; \ } \ } \ - ompi_convertor_set_position( &(request->req_recv.req_base.req_convertor), \ + opal_convertor_set_position( &(request->req_recv.req_base.req_convertor), \ &data_offset); \ assert((request->req_recv.req_base.req_convertor.flags & CONVERTOR_COMPLETED) == 0); \ - ompi_convertor_unpack( &(request)->req_recv.req_base.req_convertor, \ + opal_convertor_unpack( &(request)->req_recv.req_base.req_convertor, \ iov, \ &iov_count, \ &max_data); \ diff --git a/ompi/mca/pml/dr/pml_dr_sendreq.c b/ompi/mca/pml/dr/pml_dr_sendreq.c index 54a2ff0296..2082fdbea7 100644 --- a/ompi/mca/pml/dr/pml_dr_sendreq.c +++ b/ompi/mca/pml/dr/pml_dr_sendreq.c @@ -397,7 +397,7 @@ int mca_pml_dr_send_request_start_buffered( iov.iov_len = size; iov_count = 1; max_data = size; - if((rc = ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, + if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, &iov, &iov_count, &max_data)) < 0) { @@ -428,7 +428,7 @@ int mca_pml_dr_send_request_start_buffered( iov.iov_len = sendreq->req_send.req_bytes_packed - max_data; max_data = iov.iov_len; - if((rc = ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, + if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, &iov, &iov_count, &max_data)) < 0) { @@ -455,8 +455,8 @@ int mca_pml_dr_send_request_start_buffered( OPAL_CSUM_ZERO); /* re-init convertor for packed data (it keep the flags) */ - ompi_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, - MPI_BYTE, + opal_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, + &(ompi_mpi_byte.dt.super), sendreq->req_send.req_bytes_packed, sendreq->req_send.req_addr ); @@ -512,7 +512,7 @@ int mca_pml_dr_send_request_start_copy( iov_count = 1; max_data = size; if(size > 0) { - if((rc = ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, + if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, &iov, &iov_count, &max_data)) < 0) { @@ -772,7 +772,7 @@ int mca_pml_dr_send_request_schedule(mca_pml_dr_send_request_t* sendreq) } /* pack into a descriptor */ - ompi_convertor_set_position(&sendreq->req_send.req_base.req_convertor, &offset_in_msg); + opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, &offset_in_msg); mca_bml_base_prepare_src( bml_btl, NULL, &sendreq->req_send.req_base.req_convertor, @@ -896,7 +896,7 @@ int mca_pml_dr_send_request_schedule(mca_pml_dr_send_request_t* sendreq) } /* pack into a descriptor */ - ompi_convertor_set_position(&sendreq->req_send.req_base.req_convertor, &sendreq->req_send_offset); + opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, &sendreq->req_send_offset); mca_bml_base_prepare_src( bml_btl, NULL, &sendreq->req_send.req_base.req_convertor, diff --git a/ompi/mca/pml/dr/pml_dr_sendreq.h b/ompi/mca/pml/dr/pml_dr_sendreq.h index 6c58adf373..556ddabfc5 100644 --- a/ompi/mca/pml/dr/pml_dr_sendreq.h +++ b/ompi/mca/pml/dr/pml_dr_sendreq.h @@ -23,7 +23,7 @@ #include "opal/util/crc.h" #include "ompi_config.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/btl/btl.h" #include "ompi/mca/pml/base/pml_base_sendreq.h" #include "ompi/mca/mpool/base/base.h" @@ -116,7 +116,7 @@ do { (sendreq)->req_send.req_base.req_peer = (int32_t)peer; \ (sendreq)->req_send.req_base.req_tag = (int32_t)tag; \ (sendreq)->req_send.req_base.req_comm = comm; \ - (sendreq)->req_send.req_base.req_pml_complete = OPAL_INT_TO_BOOL(persistent); \ + (sendreq)->req_send.req_base.req_pml_complete = OPAL_INT_TO_BOOL(persistent); \ (sendreq)->req_send.req_base.req_free_called = false; \ (sendreq)->req_send.req_base.req_ompi.req_status._cancelled = 0; \ \ @@ -124,14 +124,14 @@ do { /* if(count > 0) { */ \ /* We will create a convertor specialized for the */ \ /* remote architecture and prepared with the datatype. */ \ - ompi_convertor_copy_and_prepare_for_send( \ + opal_convertor_copy_and_prepare_for_send( \ (sendreq)->req_send.req_base.req_proc->proc_convertor, \ - (sendreq)->req_send.req_base.req_datatype, \ + &((sendreq)->req_send.req_base.req_datatype->super), \ (sendreq)->req_send.req_base.req_count, \ (sendreq)->req_send.req_base.req_addr, \ (do_csum ? CONVERTOR_WITH_CHECKSUM: 0), \ &(sendreq)->req_send.req_base.req_convertor ); \ - ompi_convertor_get_packed_size(&(sendreq)->req_send.req_base.req_convertor, \ + opal_convertor_get_packed_size(&(sendreq)->req_send.req_base.req_convertor, \ &((sendreq)->req_send.req_bytes_packed) ); \ /* } else { */ \ /* (sendreq)->req_send.req_bytes_packed = 0; */ \ @@ -254,7 +254,7 @@ do { (0 != sendreq->req_send.req_bytes_packed) ) { \ /* rewind convertor */ \ size_t offset = 0; \ - ompi_convertor_set_position(&sendreq->req_send.req_base.req_convertor, \ + opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, \ &offset); \ } \ } \ diff --git a/ompi/mca/pml/ob1/pml_ob1.h b/ompi/mca/pml/ob1/pml_ob1.h index 4aaac2bb13..f0d3a97cbc 100644 --- a/ompi/mca/pml/ob1/pml_ob1.h +++ b/ompi/mca/pml/ob1/pml_ob1.h @@ -29,7 +29,7 @@ #include "ompi/mca/pml/base/pml_base_request.h" #include "ompi/mca/pml/base/pml_base_bsend.h" #include "ompi/mca/pml/base/pml_base_sendreq.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "pml_ob1_hdr.h" #include "ompi/mca/bml/base/base.h" #include "ompi/proc/proc.h" diff --git a/ompi/mca/pml/ob1/pml_ob1_rdmafrag.h b/ompi/mca/pml/ob1/pml_ob1_rdmafrag.h index 1ff5ce58f6..38d8e028da 100644 --- a/ompi/mca/pml/ob1/pml_ob1_rdmafrag.h +++ b/ompi/mca/pml/ob1/pml_ob1_rdmafrag.h @@ -43,7 +43,7 @@ struct mca_pml_ob1_rdma_frag_t { mca_btl_base_segment_t rdma_segs[MCA_BTL_DES_MAX_SEGMENTS]; void *rdma_req; struct mca_bml_base_endpoint_t* rdma_ep; - ompi_convertor_t convertor; + opal_convertor_t convertor; mca_mpool_base_registration_t* reg; uint32_t retries; }; diff --git a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c index 2d47a9fe4d..3ed7465678 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c @@ -212,7 +212,7 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl, iov[iov_count].iov_base = (IOVBASE_TYPE*)((unsigned char*)segments[iov_count].seg_addr.pval); iov_count++; } - ompi_convertor_unpack( &match->req_recv.req_base.req_convertor, + opal_convertor_unpack( &match->req_recv.req_base.req_convertor, iov, &iov_count, &bytes_received ); diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.c b/ompi/mca/pml/ob1/pml_ob1_recvreq.c index 01f737b080..f7f6690dc5 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.c @@ -261,11 +261,11 @@ static int mca_pml_ob1_recv_request_ack( * registered. */ - if(ompi_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == 0 && + if(opal_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == 0 && hdr->hdr_match.hdr_common.hdr_flags & MCA_PML_OB1_HDR_FLAGS_CONTIG && rdma_num != 0) { unsigned char *base; - ompi_convertor_get_current_pointer( &recvreq->req_recv.req_base.req_convertor, (void**)&(base) ); + opal_convertor_get_current_pointer( &recvreq->req_recv.req_base.req_convertor, (void**)&(base) ); if(hdr->hdr_match.hdr_common.hdr_flags & MCA_PML_OB1_HDR_FLAGS_PIN) recvreq->req_rdma_cnt = mca_pml_ob1_rdma_btls(bml_endpoint, @@ -288,7 +288,7 @@ static int mca_pml_ob1_recv_request_ack( /* use converter to figure out the rdma offset for this * request */ - ompi_convertor_set_position(&recvreq->req_recv.req_base.req_convertor, + opal_convertor_set_position(&recvreq->req_recv.req_base.req_convertor, &recvreq->req_send_offset); recvreq->req_rdma_cnt = @@ -484,7 +484,7 @@ void mca_pml_ob1_recv_request_progress_rget( mca_pml_ob1_recv_request_t* recvreq * fall back to copy in/out protocol. It is a pity because buffer on the * sender side is already registered. We need to be smarter here, perhaps * do couple of RDMA reads */ - if(ompi_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == true) { + if(opal_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == true) { mca_pml_ob1_recv_request_ack(recvreq, &hdr->hdr_rndv, 0); return; } @@ -751,7 +751,7 @@ int mca_pml_ob1_recv_request_schedule_once( mca_pml_ob1_recv_request_t* recvreq, /* take lock to protect converter against concurrent access * from unpack */ OPAL_THREAD_LOCK(&recvreq->lock); - ompi_convertor_set_position( &recvreq->req_recv.req_base.req_convertor, + opal_convertor_set_position( &recvreq->req_recv.req_base.req_convertor, &recvreq->req_rdma_offset ); /* prepare a descriptor for RDMA */ diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.h b/ompi/mca/pml/ob1/pml_ob1_recvreq.h index caec03c35a..2fa9a3c5fd 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.h +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.h @@ -197,15 +197,15 @@ extern void mca_pml_ob1_recv_req_start(mca_pml_ob1_recv_request_t *req); static inline void prepare_recv_req_converter(mca_pml_ob1_recv_request_t *req) { - if( req->req_recv.req_base.req_datatype->size | req->req_recv.req_base.req_count ) { - ompi_convertor_copy_and_prepare_for_recv( + if( req->req_recv.req_base.req_datatype->super.size | req->req_recv.req_base.req_count ) { + opal_convertor_copy_and_prepare_for_recv( req->req_recv.req_base.req_proc->proc_convertor, - req->req_recv.req_base.req_datatype, + &(req->req_recv.req_base.req_datatype->super), req->req_recv.req_base.req_count, req->req_recv.req_base.req_addr, 0, &req->req_recv.req_base.req_convertor); - ompi_convertor_get_unpacked_size(&req->req_recv.req_base.req_convertor, + opal_convertor_get_unpacked_size(&req->req_recv.req_base.req_convertor, &req->req_bytes_expected); } } @@ -270,9 +270,9 @@ do { PERUSE_TRACE_COMM_OMPI_EVENT (PERUSE_COMM_REQ_XFER_CONTINUE, \ &(recvreq->req_recv.req_base), max_data, \ PERUSE_RECV); \ - ompi_convertor_set_position( &(request->req_recv.req_base.req_convertor), \ + opal_convertor_set_position( &(request->req_recv.req_base.req_convertor), \ &data_offset ); \ - ompi_convertor_unpack( &(request)->req_recv.req_base.req_convertor, \ + opal_convertor_unpack( &(request)->req_recv.req_base.req_convertor, \ iov, \ &iov_count, \ &max_data ); \ diff --git a/ompi/mca/pml/ob1/pml_ob1_sendreq.c b/ompi/mca/pml/ob1/pml_ob1_sendreq.c index 41f1eef8be..515bce3871 100644 --- a/ompi/mca/pml/ob1/pml_ob1_sendreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_sendreq.c @@ -352,7 +352,7 @@ int mca_pml_ob1_send_request_start_buffered( iov.iov_len = size; iov_count = 1; max_data = size; - if((rc = ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, + if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, &iov, &iov_count, &max_data)) < 0) { @@ -391,7 +391,7 @@ int mca_pml_ob1_send_request_start_buffered( iov.iov_base = (IOVBASE_TYPE*)(((unsigned char*)sendreq->req_send.req_addr) + max_data); iov.iov_len = max_data = sendreq->req_send.req_bytes_packed - max_data; - if((rc = ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, + if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, &iov, &iov_count, &max_data)) < 0) { @@ -400,8 +400,8 @@ int mca_pml_ob1_send_request_start_buffered( } /* re-init convertor for packed data */ - ompi_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, - MPI_BYTE, + opal_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, + &(ompi_mpi_byte.dt.super), sendreq->req_send.req_bytes_packed, sendreq->req_send.req_addr ); @@ -500,7 +500,7 @@ int mca_pml_ob1_send_request_start_copy( mca_pml_ob1_send_request_t* sendreq, sendreq->req_send.req_base.req_count, sendreq->req_send.req_base.req_datatype); ); - (void)ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor, + (void)opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, &iov, &iov_count, &max_data ); /* * Packing finished, make the user buffer unaccessable. @@ -663,7 +663,7 @@ int mca_pml_ob1_send_request_start_rdma( mca_pml_ob1_send_request_t* sendreq, sendreq->req_send.req_base.req_datatype); ); if( OPAL_UNLIKELY(NULL == src) ) { - ompi_convertor_set_position(&sendreq->req_send.req_base.req_convertor, + opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, &old_position); return OMPI_ERR_OUT_OF_RESOURCE; } @@ -676,7 +676,7 @@ int mca_pml_ob1_send_request_start_rdma( mca_pml_ob1_send_request_t* sendreq, (sizeof(mca_btl_base_segment_t) * (src->des_src_cnt-1)), MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); if( OPAL_UNLIKELY(NULL == des) ) { - ompi_convertor_set_position( &sendreq->req_send.req_base.req_convertor, + opal_convertor_set_position( &sendreq->req_send.req_base.req_convertor, &old_position ); mca_bml_base_free(bml_btl, src); return OMPI_ERR_OUT_OF_RESOURCE; @@ -1004,7 +1004,7 @@ cannot_pack: /* pack into a descriptor */ offset = (size_t)range->range_send_offset; - ompi_convertor_set_position(&sendreq->req_send.req_base.req_convertor, + opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, &offset); range->range_send_offset = (uint64_t)offset; @@ -1137,7 +1137,7 @@ int mca_pml_ob1_send_request_put_frag( mca_pml_ob1_rdma_frag_t* frag ) if(frag->retries < mca_pml_ob1.rdma_put_retries_limit) { size_t offset = (size_t)frag->rdma_hdr.hdr_rdma.hdr_rdma_offset; frag->rdma_length = save_size; - ompi_convertor_set_position(&frag->convertor, &offset); + opal_convertor_set_position(&frag->convertor, &offset); OPAL_THREAD_LOCK(&mca_pml_ob1.lock); opal_list_append(&mca_pml_ob1.rdma_pending, (opal_list_item_t*)frag); OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock); @@ -1253,7 +1253,7 @@ void mca_pml_ob1_send_request_put( mca_pml_ob1_send_request_t* sendreq, * create clone of the convertor for each RDMA fragment */ size = hdr->hdr_rdma_offset; - ompi_convertor_clone_with_position(&sendreq->req_send.req_base.req_convertor, + opal_convertor_clone_with_position(&sendreq->req_send.req_base.req_convertor, &frag->convertor, 0, &size); mca_pml_ob1_send_request_put_frag(frag); diff --git a/ompi/mca/pml/ob1/pml_ob1_sendreq.h b/ompi/mca/pml/ob1/pml_ob1_sendreq.h index 0c17819619..c886d39fb6 100644 --- a/ompi/mca/pml/ob1/pml_ob1_sendreq.h +++ b/ompi/mca/pml/ob1/pml_ob1_sendreq.h @@ -26,7 +26,7 @@ #include "pml_ob1_hdr.h" #include "pml_ob1_rdma.h" #include "pml_ob1_rdmafrag.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/bml/bml.h" BEGIN_C_DECLS @@ -374,9 +374,9 @@ mca_pml_ob1_send_request_start_btl( mca_pml_ob1_send_request_t* sendreq, if(sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { rc = mca_pml_ob1_send_request_start_buffered(sendreq, bml_btl, size); } else if - (ompi_convertor_need_buffers(&sendreq->req_send.req_base.req_convertor) == false) { + (opal_convertor_need_buffers(&sendreq->req_send.req_base.req_convertor) == false) { unsigned char *base; - ompi_convertor_get_current_pointer( &sendreq->req_send.req_base.req_convertor, (void**)&base ); + opal_convertor_get_current_pointer( &sendreq->req_send.req_base.req_convertor, (void**)&base ); if( 0 != (sendreq->req_rdma_cnt = (uint32_t)mca_pml_ob1_rdma_btls( sendreq->req_endpoint, diff --git a/ompi/mca/pml/ob1/pml_ob1_start.c b/ompi/mca/pml/ob1/pml_ob1_start.c index ee8ef48a90..627d899cb3 100644 --- a/ompi/mca/pml/ob1/pml_ob1_start.c +++ b/ompi/mca/pml/ob1/pml_ob1_start.c @@ -119,7 +119,7 @@ int mca_pml_ob1_start(size_t count, ompi_request_t** requests) * Reset the convertor in case we're dealing with the original * request, which when completed do not reset the convertor. */ - ompi_convertor_set_position( &sendreq->req_send.req_base.req_convertor, + opal_convertor_set_position( &sendreq->req_send.req_base.req_convertor, &offset ); } MCA_PML_OB1_SEND_REQUEST_START(sendreq, rc); diff --git a/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist.h b/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist.h index 44e75c74ab..b7c3f4d884 100644 --- a/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist.h +++ b/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist.h @@ -14,6 +14,7 @@ #include "ompi_config.h" #include "../vprotocol.h" #include "ompi/communicator/communicator.h" +#include "ompi/datatype/ompi_datatype.h" #include "vprotocol_pessimist_event.h" #include "vprotocol_pessimist_sender_based_types.h" diff --git a/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist_sender_based.c b/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist_sender_based.c index 65c5d6bc70..f27ee35d31 100644 --- a/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist_sender_based.c +++ b/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist_sender_based.c @@ -19,7 +19,7 @@ #endif #include #include -#include "ompi/datatype/datatype_memcpy.h" +#include "opal/datatype/opal_datatype_memcpy.h" #include #include "orte/util/proc_info.h" @@ -190,7 +190,7 @@ void vprotocol_pessimist_sender_based_alloc(size_t len) #undef sb #ifdef SB_USE_CONVERTOR_METHOD -int32_t vprotocol_pessimist_sender_based_convertor_advance(ompi_convertor_t* pConvertor, +int32_t vprotocol_pessimist_sender_based_convertor_advance(opal_convertor_t* pConvertor, struct iovec* iov, uint32_t* out_size, size_t* max_data) { @@ -202,7 +202,7 @@ int32_t vprotocol_pessimist_sender_based_convertor_advance(ompi_convertor_t* pCo ftreq = VPESSIMIST_CONV_REQ(pConvertor); pConvertor->flags = ftreq->sb.conv_flags; pConvertor->fAdvance = ftreq->sb.conv_advance; - ret = ompi_convertor_pack(pConvertor, iov, out_size, max_data); + ret = opal_convertor_pack(pConvertor, iov, out_size, max_data); V_OUTPUT_VERBOSE(39, "pessimist:\tsb\tpack\t%"PRIsize_t, *max_data); for(i = 0, pending_length = *max_data; pending_length > 0; i++) { diff --git a/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist_sender_based.h b/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist_sender_based.h index 3f2abce3b5..c1a21c9ca7 100644 --- a/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist_sender_based.h +++ b/ompi/mca/pml/v/mca/vprotocol/pessimist/vprotocol_pessimist_sender_based.h @@ -42,7 +42,7 @@ static inline void __SENDER_BASED_METHOD_COPY(mca_pml_base_send_request_t *pmlre { if(0 != pmlreq->req_bytes_packed) { - ompi_convertor_t conv; + opal_convertor_t conv; size_t max_data; size_t zero = 0; unsigned int iov_count = 1; @@ -50,9 +50,9 @@ static inline void __SENDER_BASED_METHOD_COPY(mca_pml_base_send_request_t *pmlre max_data = iov.iov_len = pmlreq->req_bytes_packed; iov.iov_base = (IOVBASE_TYPE *) VPESSIMIST_SEND_FTREQ(pmlreq)->sb.cursor; - ompi_convertor_clone_with_position( &pmlreq->req_base.req_convertor, + opal_convertor_clone_with_position( &pmlreq->req_base.req_convertor, &conv, 0, &zero ); - ompi_convertor_pack(&conv, &iov, &iov_count, &max_data); + opal_convertor_pack(&conv, &iov, &iov_count, &max_data); } } @@ -63,13 +63,13 @@ static inline void __SENDER_BASED_METHOD_COPY(mca_pml_base_send_request_t *pmlre * Convertor replacement (non blocking) method (under testing) */ #elif defined(SB_USE_CONVERTOR_METHOD) -int32_t vprotocol_pessimist_sender_based_convertor_advance(ompi_convertor_t*, +int32_t vprotocol_pessimist_sender_based_convertor_advance(opal_convertor_t*, struct iovec*, uint32_t*, size_t*); #define __SENDER_BASED_METHOD_COPY(REQ) do { \ - ompi_convertor_t *pConv; \ + opal_convertor_t *pConv; \ mca_vprotocol_pessimist_send_request_t *ftreq; \ \ pConv = & (REQ)->req_base.req_convertor; \ @@ -110,7 +110,7 @@ static inline int vprotocol_pessimist_sb_progress_req(mca_pml_base_send_request_ if(ftreq->sb.bytes_progressed < req->req_bytes_packed) { - ompi_convertor_t conv; + opal_convertor_t conv; unsigned int iov_count = 1; struct iovec iov; uintptr_t position = ftreq->sb.bytes_progressed; @@ -119,9 +119,9 @@ static inline int vprotocol_pessimist_sb_progress_req(mca_pml_base_send_request_ iov.iov_base = (IOVBASE_TYPE *) (ftreq->sb.cursor + position); V_OUTPUT_VERBOSE(80, "pessimist:\tsb\tprgress\t%"PRIpclock"\tsize %lu from position %lu", ftreq->reqid, max_data, position); - ompi_convertor_clone_with_position(&req->req_base.req_convertor, + opal_convertor_clone_with_position(&req->req_base.req_convertor, &conv, 0, &position ); - ompi_convertor_pack(&conv, &iov, &iov_count, &max_data); + opal_convertor_pack(&conv, &iov, &iov_count, &max_data); ftreq->sb.bytes_progressed += max_data; } return max_data; diff --git a/ompi/mpi/c/accumulate.c b/ompi/mpi/c/accumulate.c index d3841da21b..99b4bb0375 100644 --- a/ompi/mpi/c/accumulate.c +++ b/ompi/mpi/c/accumulate.c @@ -25,8 +25,8 @@ #include "ompi/win/win.h" #include "ompi/mca/osc/osc.h" #include "ompi/op/op.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -39,7 +39,6 @@ static const char FUNC_NAME[] = "MPI_Accumlate"; - int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win) @@ -88,14 +87,14 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data ompi_datatype_t *op_check_dt, *origin_check_dt; char *msg; - if (ompi_ddt_is_predefined(origin_datatype)) { + if (opal_datatype_is_predefined(&(origin_datatype->super))) { origin_check_dt = origin_datatype; } else { int i, found_index = -1, num_found = 0; - uint64_t mask = 1; + uint32_t mask = 1; - for (i = 0 ; i < DT_MAX_PREDEFINED ; ++i) { - if (origin_datatype->bdt_used & mask) { + for (i = 0 ; i < OMPI_DATATYPE_MAX_PREDEFINED ; ++i) { + if (origin_datatype->super.bdt_used & mask) { num_found++; found_index = i; } @@ -107,7 +106,8 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data OMPI_ERRHANDLER_RETURN(MPI_ERR_TYPE, win, MPI_ERR_TYPE, FUNC_NAME); } else { origin_check_dt = (ompi_datatype_t*) - ompi_ddt_basicDatatypes[found_index]; +/* XXX TODO This is not needed, I hope... */ + ompi_datatype_basicDatatypes[found_index]; } } @@ -121,14 +121,14 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data predefined, then make sure it's composed of only one datatype, and check that datatype against ompi_op_is_valid(). */ - if (ompi_ddt_is_predefined(target_datatype)) { + if (opal_datatype_is_predefined(&(target_datatype->super))) { op_check_dt = target_datatype; } else { int i, found_index = -1, num_found = 0; - uint64_t mask = 1; + uint32_t mask = 1; - for (i = 0 ; i < DT_MAX_PREDEFINED ; ++i) { - if (target_datatype->bdt_used & mask) { + for (i = 0 ; i < OMPI_DATATYPE_MAX_PREDEFINED ; ++i) { + if (target_datatype->super.bdt_used & mask) { num_found++; found_index = i; } @@ -144,7 +144,7 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data op? Unfortunately have to cast away constness... */ op_check_dt = (ompi_datatype_t*) - ompi_ddt_basicDatatypes[found_index]; + ompi_datatype_basicDatatypes[found_index]; } } @@ -186,14 +186,14 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data predefined, then make sure it's composed of only one datatype, and check that datatype against ompi_op_is_valid(). */ - if (ompi_ddt_is_predefined(target_datatype)) { + if (opal_datatype_is_predefined(&(target_datatype->super))) { op_check_dt = target_datatype; } else { int i, found_index = -1, num_found = 0; - uint64_t mask = 1; + uint32_t mask = 1; - for (i = 0 ; i < DT_MAX_PREDEFINED ; ++i) { - if (target_datatype->bdt_used & mask) { + for (i = 0 ; i < OMPI_DATATYPE_MAX_PREDEFINED ; ++i) { + if (target_datatype->super.bdt_used & mask) { num_found++; found_index = i; } @@ -209,7 +209,7 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data op? Unfortunately have to cast away constness... */ op_check_dt = (ompi_datatype_t*) - ompi_ddt_basicDatatypes[found_index]; + ompi_datatype_basicDatatypes[found_index]; } } if (!ompi_op_is_valid(op, op_check_dt, &msg, FUNC_NAME)) { diff --git a/ompi/mpi/c/allgather.c b/ompi/mpi/c/allgather.c index 6bf767099d..2391fa76c8 100644 --- a/ompi/mpi/c/allgather.c +++ b/ompi/mpi/c/allgather.c @@ -24,7 +24,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -49,7 +49,7 @@ int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, ptrdiff_t ext; rank = ompi_comm_rank(comm); - ompi_ddt_type_extent(recvtype, &ext); + ompi_datatype_type_extent(recvtype, &ext); memchecker_datatype(recvtype); memchecker_comm(comm); diff --git a/ompi/mpi/c/allgatherv.c b/ompi/mpi/c/allgatherv.c index d11865489a..f3f8aa6955 100644 --- a/ompi/mpi/c/allgatherv.c +++ b/ompi/mpi/c/allgatherv.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -49,7 +49,7 @@ int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, rank = ompi_comm_rank(comm); size = ompi_comm_size(comm); - ompi_ddt_type_extent(recvtype, &ext); + ompi_datatype_type_extent(recvtype, &ext); memchecker_datatype(recvtype); memchecker_comm (comm); diff --git a/ompi/mpi/c/allreduce.c b/ompi/mpi/c/allreduce.c index 260795dc15..f6a569624d 100644 --- a/ompi/mpi/c/allreduce.c +++ b/ompi/mpi/c/allreduce.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" diff --git a/ompi/mpi/c/alltoall.c b/ompi/mpi/c/alltoall.c index bb08ac55be..00b5fa718c 100644 --- a/ompi/mpi/c/alltoall.c +++ b/ompi/mpi/c/alltoall.c @@ -24,7 +24,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/alltoallv.c b/ompi/mpi/c/alltoallv.c index c61d7d8f5a..99b1e0eae8 100644 --- a/ompi/mpi/c/alltoallv.c +++ b/ompi/mpi/c/alltoallv.c @@ -24,7 +24,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -50,8 +50,8 @@ int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *sdispls, ptrdiff_t send_ext; size = ompi_comm_size(comm); - ompi_ddt_type_extent(recvtype, &recv_ext); - ompi_ddt_type_extent(sendtype, &send_ext); + ompi_datatype_type_extent(recvtype, &recv_ext); + ompi_datatype_type_extent(sendtype, &send_ext); memchecker_datatype(sendtype); memchecker_datatype(recvtype); diff --git a/ompi/mpi/c/alltoallw.c b/ompi/mpi/c/alltoallw.c index 9a3b54aa2b..a3612e871e 100644 --- a/ompi/mpi/c/alltoallw.c +++ b/ompi/mpi/c/alltoallw.c @@ -24,7 +24,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -56,8 +56,8 @@ int MPI_Alltoallw(void *sendbuf, int *sendcounts, int *sdispls, memchecker_datatype(sendtypes[i]); memchecker_datatype(recvtypes[i]); - ompi_ddt_type_extent(sendtypes[i], &send_ext); - ompi_ddt_type_extent(recvtypes[i], &recv_ext); + ompi_datatype_type_extent(sendtypes[i], &send_ext); + ompi_datatype_type_extent(recvtypes[i], &recv_ext); memchecker_call(&opal_memchecker_base_isdefined, (char *)(sendbuf)+sdispls[i]*send_ext, diff --git a/ompi/mpi/c/attr_fn.c b/ompi/mpi/c/attr_fn.c index dfb077af7a..95da43f211 100644 --- a/ompi/mpi/c/attr_fn.c +++ b/ompi/mpi/c/attr_fn.c @@ -20,7 +20,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/win/win.h" /* diff --git a/ompi/mpi/c/bcast.c b/ompi/mpi/c/bcast.c index 76cf1f38a3..8044862d66 100644 --- a/ompi/mpi/c/bcast.c +++ b/ompi/mpi/c/bcast.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/bindings.h b/ompi/mpi/c/bindings.h index a5d8eb9dca..1292c57ce8 100644 --- a/ompi/mpi/c/bindings.h +++ b/ompi/mpi/c/bindings.h @@ -21,16 +21,14 @@ #include "ompi_config.h" #include "mpi.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" /* This library needs to be here so that we can define * the OPAL_CR_* checks */ #include "opal/runtime/opal_cr.h" -#if defined(c_plusplus) || defined(__cplusplus) -extern "C" { -#endif +BEGIN_C_DECLS /* If compiling in the profile directory, then we don't have weak symbols and therefore we need the defines to map from MPI->PMPI. @@ -48,8 +46,8 @@ extern "C" { /* (RC) = MPI_SUCCESS; */ \ if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ - else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \ - else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \ + else if( !opal_datatype_is_committed(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \ + else if( !opal_datatype_is_valid(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \ } while (0) #define OMPI_CHECK_DATATYPE_FOR_RECV( RC, DDT, COUNT ) \ @@ -57,20 +55,20 @@ extern "C" { /* (RC) = MPI_SUCCESS; */ \ if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ - else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \ - /* XXX Fix flags else if( ompi_ddt_is_overlapped((DDT)) ) (RC) = MPI_ERR_TYPE; */ \ - else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \ + else if( !opal_datatype_is_committed(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \ + /* XXX Fix flags else if( ompi_datatype_is_overlapped((DDT)) ) (RC) = MPI_ERR_TYPE; */ \ + else if( !opal_datatype_is_valid(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \ } while (0) -#define OMPI_CHECK_DATATYPE_FOR_ONE_SIDED( RC, DDT, COUNT ) \ - do { \ - /*(RC) = MPI_SUCCESS; */ \ - if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ - else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ - else if( !ompi_ddt_is_committed((DDT)) ) (RC) = MPI_ERR_TYPE; \ - else if( ompi_ddt_is_overlapped((DDT)) ) (RC) = MPI_ERR_TYPE; \ - else if( !ompi_ddt_is_acceptable_for_one_sided((DDT)) ) (RC) = MPI_ERR_TYPE; \ - else if( !ompi_ddt_is_valid((DDT)) ) (RC) = MPI_ERR_TYPE; \ +#define OMPI_CHECK_DATATYPE_FOR_ONE_SIDED( RC, DDT, COUNT ) \ + do { \ + /*(RC) = MPI_SUCCESS; */ \ + if( NULL == (DDT) || MPI_DATATYPE_NULL == (DDT) ) (RC) = MPI_ERR_TYPE; \ + else if( (COUNT) < 0 ) (RC) = MPI_ERR_COUNT; \ + else if( !opal_datatype_is_committed(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \ + else if( opal_datatype_is_overlapped(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \ + else if( !ompi_datatype_is_acceptable_for_one_sided(DDT)) (RC) = MPI_ERR_TYPE; \ + else if( !opal_datatype_is_valid(&((DDT)->super)) ) (RC) = MPI_ERR_TYPE; \ } while(0) @@ -80,14 +78,14 @@ extern "C" { #define OMPI_CHECK_USER_BUFFER(RC, BUFFER, DDT, COUNT) \ do { \ if ( NULL == (BUFFER) && 0 < (COUNT) && MPI_SUCCESS == (RC) ) { \ - if ( (DDT)->flags & DT_FLAG_PREDEFINED ) { \ + if ( (DDT)->super.flags & OPAL_DATATYPE_FLAG_PREDEFINED ) { \ (RC) = MPI_ERR_BUFFER; \ } else { \ size_t size = 0; \ ptrdiff_t true_lb = 0; \ ptrdiff_t true_extended = 0; \ - ompi_ddt_type_size((DDT), &size); \ - ompi_ddt_get_true_extent((DDT), &true_lb, &true_extended); \ + ompi_datatype_type_size((DDT), &size); \ + ompi_datatype_get_true_extent((DDT), &true_lb, &true_extended); \ if ( 0 < size && 0 == true_lb ) { \ (RC) = MPI_ERR_BUFFER; \ } \ @@ -95,8 +93,6 @@ extern "C" { } \ } while (0) -#if defined(c_plusplus) || defined(__cplusplus) -} -#endif +END_C_DECLS #endif /* OMPI_C_BINDINGS_H */ diff --git a/ompi/mpi/c/exscan.c b/ompi/mpi/c/exscan.c index ee371b83f9..9f389088cd 100644 --- a/ompi/mpi/c/exscan.c +++ b/ompi/mpi/c/exscan.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" diff --git a/ompi/mpi/c/file_iread.c b/ompi/mpi/c/file_iread.c index 072cfd3ad4..cd0c6d98f8 100644 --- a/ompi/mpi/c/file_iread.c +++ b/ompi/mpi/c/file_iread.c @@ -22,7 +22,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/file/file.h" #include "ompi/mca/io/io.h" #include "ompi/mca/io/base/io_base_request.h" diff --git a/ompi/mpi/c/file_iread_at.c b/ompi/mpi/c/file_iread_at.c index 13b1d18a44..e04ca6c356 100644 --- a/ompi/mpi/c/file_iread_at.c +++ b/ompi/mpi/c/file_iread_at.c @@ -22,7 +22,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/file/file.h" #include "ompi/mca/io/io.h" #include "ompi/mca/io/base/io_base_request.h" diff --git a/ompi/mpi/c/file_iread_shared.c b/ompi/mpi/c/file_iread_shared.c index b4b08f7778..811a070523 100644 --- a/ompi/mpi/c/file_iread_shared.c +++ b/ompi/mpi/c/file_iread_shared.c @@ -22,7 +22,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/file/file.h" #include "ompi/mca/io/io.h" #include "ompi/mca/io/base/io_base_request.h" diff --git a/ompi/mpi/c/file_iwrite.c b/ompi/mpi/c/file_iwrite.c index c60fa34207..b28f5feed4 100644 --- a/ompi/mpi/c/file_iwrite.c +++ b/ompi/mpi/c/file_iwrite.c @@ -22,7 +22,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/file/file.h" #include "ompi/mca/io/io.h" #include "ompi/mca/io/base/io_base_request.h" diff --git a/ompi/mpi/c/file_iwrite_at.c b/ompi/mpi/c/file_iwrite_at.c index baaf06b646..4bdea93359 100644 --- a/ompi/mpi/c/file_iwrite_at.c +++ b/ompi/mpi/c/file_iwrite_at.c @@ -22,7 +22,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/file/file.h" #include "ompi/mca/io/io.h" #include "ompi/mca/io/base/io_base_request.h" diff --git a/ompi/mpi/c/file_iwrite_shared.c b/ompi/mpi/c/file_iwrite_shared.c index 2e840fd5d0..ce37567793 100644 --- a/ompi/mpi/c/file_iwrite_shared.c +++ b/ompi/mpi/c/file_iwrite_shared.c @@ -22,7 +22,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/file/file.h" #include "ompi/mca/io/io.h" #include "ompi/mca/io/base/io_base_request.h" diff --git a/ompi/mpi/c/file_read.c b/ompi/mpi/c/file_read.c index 489ab9f307..df8eeed62c 100644 --- a/ompi/mpi/c/file_read.c +++ b/ompi/mpi/c/file_read.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_read_all.c b/ompi/mpi/c/file_read_all.c index 2cc45f6745..b6fbe84f5a 100644 --- a/ompi/mpi/c/file_read_all.c +++ b/ompi/mpi/c/file_read_all.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_read_all_begin.c b/ompi/mpi/c/file_read_all_begin.c index 6267970deb..9ba2781b47 100644 --- a/ompi/mpi/c/file_read_all_begin.c +++ b/ompi/mpi/c/file_read_all_begin.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_read_at.c b/ompi/mpi/c/file_read_at.c index 7e7f271c0a..8ada29e79f 100644 --- a/ompi/mpi/c/file_read_at.c +++ b/ompi/mpi/c/file_read_at.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_read_at_all.c b/ompi/mpi/c/file_read_at_all.c index f3068808fb..6f13146d17 100644 --- a/ompi/mpi/c/file_read_at_all.c +++ b/ompi/mpi/c/file_read_at_all.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_read_at_all_begin.c b/ompi/mpi/c/file_read_at_all_begin.c index bdc1c96843..9a1c1f1e2e 100644 --- a/ompi/mpi/c/file_read_at_all_begin.c +++ b/ompi/mpi/c/file_read_at_all_begin.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_read_ordered.c b/ompi/mpi/c/file_read_ordered.c index ba0ded0a05..5cd29e66ae 100644 --- a/ompi/mpi/c/file_read_ordered.c +++ b/ompi/mpi/c/file_read_ordered.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES #pragma weak MPI_File_read_ordered = PMPI_File_read_ordered diff --git a/ompi/mpi/c/file_read_ordered_begin.c b/ompi/mpi/c/file_read_ordered_begin.c index abd918da5f..eb925672ba 100644 --- a/ompi/mpi/c/file_read_ordered_begin.c +++ b/ompi/mpi/c/file_read_ordered_begin.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_read_shared.c b/ompi/mpi/c/file_read_shared.c index c9c577c5f9..76ccc732bc 100644 --- a/ompi/mpi/c/file_read_shared.c +++ b/ompi/mpi/c/file_read_shared.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_set_view.c b/ompi/mpi/c/file_set_view.c index 23436e9786..fea3187b4c 100644 --- a/ompi/mpi/c/file_set_view.c +++ b/ompi/mpi/c/file_set_view.c @@ -22,7 +22,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/info/info.h" #include "ompi/file/file.h" #include "ompi/memchecker.h" diff --git a/ompi/mpi/c/file_write.c b/ompi/mpi/c/file_write.c index 8ccd982da3..f05af56c18 100644 --- a/ompi/mpi/c/file_write.c +++ b/ompi/mpi/c/file_write.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_write_all.c b/ompi/mpi/c/file_write_all.c index d32b5a9fb7..40508cc998 100644 --- a/ompi/mpi/c/file_write_all.c +++ b/ompi/mpi/c/file_write_all.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_write_all_begin.c b/ompi/mpi/c/file_write_all_begin.c index 256f67dc70..c7744cebda 100644 --- a/ompi/mpi/c/file_write_all_begin.c +++ b/ompi/mpi/c/file_write_all_begin.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_write_at.c b/ompi/mpi/c/file_write_at.c index 326a5be55e..f900c01a27 100644 --- a/ompi/mpi/c/file_write_at.c +++ b/ompi/mpi/c/file_write_at.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_write_at_all.c b/ompi/mpi/c/file_write_at_all.c index 75820baff5..d8318acdf0 100644 --- a/ompi/mpi/c/file_write_at_all.c +++ b/ompi/mpi/c/file_write_at_all.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_write_at_all_begin.c b/ompi/mpi/c/file_write_at_all_begin.c index d091c06d33..7d25760caf 100644 --- a/ompi/mpi/c/file_write_at_all_begin.c +++ b/ompi/mpi/c/file_write_at_all_begin.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_write_ordered.c b/ompi/mpi/c/file_write_ordered.c index 601ac89563..f5b656d4ea 100644 --- a/ompi/mpi/c/file_write_ordered.c +++ b/ompi/mpi/c/file_write_ordered.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_write_ordered_begin.c b/ompi/mpi/c/file_write_ordered_begin.c index 2321564e63..e93129a3b8 100644 --- a/ompi/mpi/c/file_write_ordered_begin.c +++ b/ompi/mpi/c/file_write_ordered_begin.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/file_write_shared.c b/ompi/mpi/c/file_write_shared.c index 5dd1d90d09..e5184e450c 100644 --- a/ompi/mpi/c/file_write_shared.c +++ b/ompi/mpi/c/file_write_shared.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/file/file.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/gather.c b/ompi/mpi/c/gather.c index 0a358a6316..cc70d21e60 100644 --- a/ompi/mpi/c/gather.c +++ b/ompi/mpi/c/gather.c @@ -25,7 +25,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -50,7 +50,7 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, ptrdiff_t ext; rank = ompi_comm_rank(comm); - ompi_ddt_type_extent(recvtype, &ext); + ompi_datatype_type_extent(recvtype, &ext); memchecker_comm(comm); if(OMPI_COMM_IS_INTRA(comm)) { diff --git a/ompi/mpi/c/gatherv.c b/ompi/mpi/c/gatherv.c index 717729553b..968342de89 100644 --- a/ompi/mpi/c/gatherv.c +++ b/ompi/mpi/c/gatherv.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -49,7 +49,7 @@ int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); - ompi_ddt_type_extent(recvtype, &ext); + ompi_datatype_type_extent(recvtype, &ext); memchecker_comm(comm); if(OMPI_COMM_IS_INTRA(comm)) { diff --git a/ompi/mpi/c/get.c b/ompi/mpi/c/get.c index 8fe7a96ea8..6e1435b066 100644 --- a/ompi/mpi/c/get.c +++ b/ompi/mpi/c/get.c @@ -24,7 +24,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/win/win.h" #include "ompi/mca/osc/osc.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES #pragma weak MPI_Get = PMPI_Get diff --git a/ompi/mpi/c/get_count.c b/ompi/mpi/c/get_count.c index 8787b0b267..bdee0c9970 100644 --- a/ompi/mpi/c/get_count.c +++ b/ompi/mpi/c/get_count.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -62,7 +62,7 @@ int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count) OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME); } - if( ompi_ddt_type_size( datatype, &size ) == MPI_SUCCESS ) { + if( ompi_datatype_type_size( datatype, &size ) == MPI_SUCCESS ) { if( size == 0 ) { *count = 0; } else { diff --git a/ompi/mpi/c/get_elements.c b/ompi/mpi/c/get_elements.c index 0c5fa5209f..02262016fb 100644 --- a/ompi/mpi/c/get_elements.c +++ b/ompi/mpi/c/get_elements.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -70,7 +70,7 @@ int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count) } *count = 0; - if( ompi_ddt_type_size( datatype, &size ) == MPI_SUCCESS ) { + if( ompi_datatype_type_size( datatype, &size ) == MPI_SUCCESS ) { if( size == 0 ) { /* If the size of the datatype is zero let's return a count of zero */ return MPI_SUCCESS; @@ -78,7 +78,7 @@ int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count) *count = (int)(status->_count / size); size = status->_count - (*count) * size; /* if basic type we should return the same result as MPI_Get_count */ - if( ompi_ddt_is_predefined(datatype) ) { + if( ompi_datatype_is_predefined(datatype) ) { if( size != 0 ) { *count = MPI_UNDEFINED; } @@ -86,12 +86,12 @@ int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count) } if( (*count) != 0 ) { int total; /* count the basic elements in the datatype */ - for( i = 4, total = 0; i < DT_MAX_PREDEFINED; i++ ) - total += datatype->btypes[i]; + for( i = 4, total = 0; i < OMPI_DATATYPE_MAX_PREDEFINED; i++ ) + total += datatype->super.btypes[i]; *count = total * (*count); } if( size > 0 ) { - if( (i = ompi_ddt_get_element_count( datatype, size )) != -1 ) + if( (i = ompi_datatype_get_element_count( datatype, size )) != -1 ) *count += i; else *count = MPI_UNDEFINED; diff --git a/ompi/mpi/c/pack.c b/ompi/mpi/c/pack.c index 9e01081906..df73bf7c4b 100644 --- a/ompi/mpi/c/pack.c +++ b/ompi/mpi/c/pack.c @@ -25,8 +25,8 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -44,7 +44,7 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, int outsize, int *position, MPI_Comm comm) { int rc; - ompi_convertor_t local_convertor; + opal_convertor_t local_convertor; struct iovec invec; unsigned int iov_count; size_t size; @@ -72,13 +72,13 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype, OPAL_CR_ENTER_LIBRARY(); - OBJ_CONSTRUCT( &local_convertor, ompi_convertor_t ); + OBJ_CONSTRUCT( &local_convertor, opal_convertor_t ); /* the resulting convertor will be set to the position ZERO */ - ompi_convertor_copy_and_prepare_for_send( ompi_mpi_local_convertor, datatype, + opal_convertor_copy_and_prepare_for_send( ompi_mpi_local_convertor, &(datatype->super), incount, inbuf, 0, &local_convertor ); /* Check for truncation */ - ompi_convertor_get_packed_size( &local_convertor, &size ); + opal_convertor_get_packed_size( &local_convertor, &size ); if( (*position + size) > (unsigned int)outsize ) { /* we can cast as we already checked for < 0 */ OBJ_DESTRUCT( &local_convertor ); OPAL_CR_EXIT_LIBRARY(); @@ -91,7 +91,7 @@ int MPI_Pack(void *inbuf, int incount, MPI_Datatype datatype, /* Do the actual packing */ iov_count = 1; - rc = ompi_convertor_pack( &local_convertor, &invec, &iov_count, &size ); + rc = opal_convertor_pack( &local_convertor, &invec, &iov_count, &size ); *position += size; OBJ_DESTRUCT( &local_convertor ); diff --git a/ompi/mpi/c/pack_external.c b/ompi/mpi/c/pack_external.c index 4a95761d8f..95b47c3db5 100644 --- a/ompi/mpi/c/pack_external.c +++ b/ompi/mpi/c/pack_external.c @@ -23,8 +23,8 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -43,7 +43,7 @@ int MPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Aint outsize, MPI_Aint *position) { int rc; - ompi_convertor_t local_convertor; + opal_convertor_t local_convertor; struct iovec invec; unsigned int iov_count; size_t size; @@ -68,19 +68,19 @@ int MPI_Pack_external(char *datarep, void *inbuf, int incount, OPAL_CR_ENTER_LIBRARY(); - OBJ_CONSTRUCT(&local_convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&local_convertor, opal_convertor_t); /* The resulting convertor will be set to the position zero. We have to use * CONVERTOR_SEND_CONVERSION in order to force the convertor to do anything * more than just packing the data. */ - ompi_convertor_copy_and_prepare_for_send( ompi_mpi_external32_convertor, - datatype, incount, inbuf, + opal_convertor_copy_and_prepare_for_send( ompi_mpi_external32_convertor, + &(datatype->super), incount, inbuf, CONVERTOR_SEND_CONVERSION, &local_convertor ); /* Check for truncation */ - ompi_convertor_get_packed_size( &local_convertor, &size ); + opal_convertor_get_packed_size( &local_convertor, &size ); if( (*position + size) > (size_t)outsize ) { /* we can cast as we already checked for < 0 */ OBJ_DESTRUCT( &local_convertor ); OPAL_CR_EXIT_LIBRARY(); @@ -93,7 +93,7 @@ int MPI_Pack_external(char *datarep, void *inbuf, int incount, /* Do the actual packing */ iov_count = 1; - rc = ompi_convertor_pack( &local_convertor, &invec, &iov_count, &size ); + rc = opal_convertor_pack( &local_convertor, &invec, &iov_count, &size ); *position += size; OBJ_DESTRUCT( &local_convertor ); diff --git a/ompi/mpi/c/pack_external_size.c b/ompi/mpi/c/pack_external_size.c index 5a3f354a65..e62db7a6bf 100644 --- a/ompi/mpi/c/pack_external_size.c +++ b/ompi/mpi/c/pack_external_size.c @@ -23,8 +23,8 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -41,7 +41,7 @@ static const char FUNC_NAME[] = "MPI_Pack_external_size"; int MPI_Pack_external_size(char *datarep, int incount, MPI_Datatype datatype, MPI_Aint *size) { - ompi_convertor_t local_convertor; + opal_convertor_t local_convertor; size_t length; MEMCHECKER( @@ -59,15 +59,15 @@ int MPI_Pack_external_size(char *datarep, int incount, OPAL_CR_ENTER_LIBRARY(); - OBJ_CONSTRUCT(&local_convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&local_convertor, opal_convertor_t); /* the resulting convertor will be set to the position ZERO */ - ompi_convertor_copy_and_prepare_for_send( ompi_mpi_external32_convertor, - datatype, incount, NULL, + opal_convertor_copy_and_prepare_for_send( ompi_mpi_external32_convertor, + &(datatype->super), incount, NULL, CONVERTOR_SEND_CONVERSION, &local_convertor ); - ompi_convertor_get_packed_size( &local_convertor, &length ); + opal_convertor_get_packed_size( &local_convertor, &length ); *size = (MPI_Aint)length; OBJ_DESTRUCT( &local_convertor ); diff --git a/ompi/mpi/c/pack_size.c b/ompi/mpi/c/pack_size.c index 66168607cc..ed53356765 100644 --- a/ompi/mpi/c/pack_size.c +++ b/ompi/mpi/c/pack_size.c @@ -23,8 +23,8 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -40,7 +40,7 @@ static const char FUNC_NAME[] = "MPI_Pack_size"; int MPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int *size) { - ompi_convertor_t local_convertor; + opal_convertor_t local_convertor; size_t length; MEMCHECKER( @@ -62,11 +62,12 @@ int MPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, OPAL_CR_ENTER_LIBRARY(); - OBJ_CONSTRUCT( &local_convertor, ompi_convertor_t ); + OBJ_CONSTRUCT( &local_convertor, opal_convertor_t ); /* the resulting convertor will be set to the position ZERO */ - ompi_convertor_copy_and_prepare_for_send( ompi_mpi_local_convertor, datatype, incount, NULL, 0, &local_convertor ); + opal_convertor_copy_and_prepare_for_send( ompi_mpi_local_convertor, &(datatype->super), + incount, NULL, 0, &local_convertor ); - ompi_convertor_get_packed_size( &local_convertor, &length ); + opal_convertor_get_packed_size( &local_convertor, &length ); *size = (int)length; OBJ_DESTRUCT( &local_convertor ); diff --git a/ompi/mpi/c/put.c b/ompi/mpi/c/put.c index 0963224f41..8c4d68b8ca 100644 --- a/ompi/mpi/c/put.c +++ b/ompi/mpi/c/put.c @@ -25,7 +25,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/win/win.h" #include "ompi/mca/osc/osc.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES #pragma weak MPI_Put = PMPI_Put diff --git a/ompi/mpi/c/reduce.c b/ompi/mpi/c/reduce.c index 2706fb01a0..9a8cc97010 100644 --- a/ompi/mpi/c/reduce.c +++ b/ompi/mpi/c/reduce.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" diff --git a/ompi/mpi/c/reduce_local.c b/ompi/mpi/c/reduce_local.c index e055250922..13f56eca7d 100644 --- a/ompi/mpi/c/reduce_local.c +++ b/ompi/mpi/c/reduce_local.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" diff --git a/ompi/mpi/c/reduce_scatter.c b/ompi/mpi/c/reduce_scatter.c index 16fbe365f3..fbfff14c84 100644 --- a/ompi/mpi/c/reduce_scatter.c +++ b/ompi/mpi/c/reduce_scatter.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" diff --git a/ompi/mpi/c/scan.c b/ompi/mpi/c/scan.c index 3220597a17..11d3a6d16c 100644 --- a/ompi/mpi/c/scan.c +++ b/ompi/mpi/c/scan.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" diff --git a/ompi/mpi/c/scatter.c b/ompi/mpi/c/scatter.c index 489883c53f..5f697cb4be 100644 --- a/ompi/mpi/c/scatter.c +++ b/ompi/mpi/c/scatter.c @@ -25,7 +25,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/scatterv.c b/ompi/mpi/c/scatterv.c index 7820c06f9a..d8448d988c 100644 --- a/ompi/mpi/c/scatterv.c +++ b/ompi/mpi/c/scatterv.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -47,7 +47,7 @@ int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, ptrdiff_t ext; size = ompi_comm_size(comm); - ompi_ddt_type_extent(recvtype, &ext); + ompi_datatype_type_extent(recvtype, &ext); memchecker_comm(comm); if(OMPI_COMM_IS_INTRA(comm)) { diff --git a/ompi/mpi/c/send.c b/ompi/mpi/c/send.c index 832749a591..aeb682f474 100644 --- a/ompi/mpi/c/send.c +++ b/ompi/mpi/c/send.c @@ -23,7 +23,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/mca/pml/pml.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/sendrecv_replace.c b/ompi/mpi/c/sendrecv_replace.c index 9b4c577517..7a0df0eb94 100644 --- a/ompi/mpi/c/sendrecv_replace.c +++ b/ompi/mpi/c/sendrecv_replace.c @@ -21,8 +21,8 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/mca/pml/pml.h" #include "ompi/proc/proc.h" #include "ompi/memchecker.h" @@ -80,7 +80,7 @@ int MPI_Sendrecv_replace(void * buf, int count, MPI_Datatype datatype, return rc; } else { - ompi_convertor_t convertor; + opal_convertor_t convertor; struct iovec iov; unsigned char recv_data[2048]; size_t packed_size, max_data; @@ -93,12 +93,12 @@ int MPI_Sendrecv_replace(void * buf, int count, MPI_Datatype datatype, } /* initialize convertor to unpack recv buffer */ - OBJ_CONSTRUCT(&convertor, ompi_convertor_t); - ompi_convertor_copy_and_prepare_for_recv( proc->proc_convertor, datatype, + OBJ_CONSTRUCT(&convertor, opal_convertor_t); + opal_convertor_copy_and_prepare_for_recv( proc->proc_convertor, &(datatype->super), count, buf, 0, &convertor ); /* setup a buffer for recv */ - ompi_convertor_get_packed_size( &convertor, &packed_size ); + opal_convertor_get_packed_size( &convertor, &packed_size ); if( packed_size > sizeof(recv_data) ) { rc = MPI_Alloc_mem(packed_size, MPI_INFO_NULL, &iov.iov_base); if(OMPI_SUCCESS != rc) { @@ -122,7 +122,7 @@ int MPI_Sendrecv_replace(void * buf, int count, MPI_Datatype datatype, iov.iov_len = recv_status._count; iov_count = 1; max_data = recv_status._count; - ompi_convertor_unpack(&convertor, &iov, &iov_count, &max_data ); + opal_convertor_unpack(&convertor, &iov, &iov_count, &max_data ); /* return status to user */ if(status != MPI_STATUS_IGNORE) { diff --git a/ompi/mpi/c/status_set_elements.c b/ompi/mpi/c/status_set_elements.c index 3352877ca3..2d600240f8 100644 --- a/ompi/mpi/c/status_set_elements.c +++ b/ompi/mpi/c/status_set_elements.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -73,11 +73,11 @@ int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, return MPI_SUCCESS; } - if( ompi_ddt_is_predefined(datatype) ) { - ompi_ddt_type_size( datatype, &size ); + if( ompi_datatype_is_predefined(datatype) ) { + ompi_datatype_type_size( datatype, &size ); status->_count = (int)(count * size); } else { - ompi_ddt_set_element_count( datatype, count, &size ); + ompi_datatype_set_element_count( datatype, count, &size ); status->_count = (int)size; } return MPI_SUCCESS; diff --git a/ompi/mpi/c/type_c2f.c b/ompi/mpi/c/type_c2f.c index 532327383b..90a26a6cf9 100644 --- a/ompi/mpi/c/type_c2f.c +++ b/ompi/mpi/c/type_c2f.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/mpi/f77/fint_2_int.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/type_commit.c b/ompi/mpi/c/type_commit.c index 42068ce555..7c1d940240 100644 --- a/ompi/mpi/c/type_commit.c +++ b/ompi/mpi/c/type_commit.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -54,6 +54,6 @@ int MPI_Type_commit(MPI_Datatype *type) OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_commit( type ); + rc = ompi_datatype_commit( type ); OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } diff --git a/ompi/mpi/c/type_contiguous.c b/ompi/mpi/c/type_contiguous.c index f14226f6c6..a568970135 100644 --- a/ompi/mpi/c/type_contiguous.c +++ b/ompi/mpi/c/type_contiguous.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -59,14 +59,14 @@ int MPI_Type_contiguous(int count, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_create_contiguous( count, oldtype, newtype ); + rc = ompi_datatype_create_contiguous( count, oldtype, newtype ); OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME ); /* data description */ { int* a_i[1]; a_i[0] = &count; - ompi_ddt_set_args( *newtype, 1, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_CONTIGUOUS ); + ompi_datatype_set_args( *newtype, 1, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_CONTIGUOUS ); } OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME ); diff --git a/ompi/mpi/c/type_create_darray.c b/ompi/mpi/c/type_create_darray.c index b4820478d8..0624166733 100644 --- a/ompi/mpi/c/type_create_darray.c +++ b/ompi/mpi/c/type_create_darray.c @@ -5,7 +5,7 @@ * Copyright (c) 2004-2005 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, + * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. @@ -13,9 +13,9 @@ * reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * $COPYRIGHT$ - * + * * Additional copyrights may follow - * + * * $HEADER$ */ @@ -25,7 +25,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -68,7 +68,7 @@ int MPI_Type_create_darray(int size, MEMCHECKER( memchecker_datatype(oldtype); ); - + if (MPI_PARAM_CHECK) { int prod_psize = 1; OMPI_ERR_INIT_FINALIZE(FUNC_NAME); @@ -80,13 +80,13 @@ int MPI_Type_create_darray(int size, return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); } else if (NULL == newtype) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME); - } else if( !(DT_FLAG_DATA & oldtype ->flags) ) { + } else if( !(OPAL_DATATYPE_FLAG_DATA & oldtype->super.flags) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME); } else if( (MPI_ORDER_C != order) && (MPI_ORDER_FORTRAN != order) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); } for( i = 0; i < ndims; i++ ) { - if( (MPI_DISTRIBUTE_BLOCK != distrib_array[i]) && + if( (MPI_DISTRIBUTE_BLOCK != distrib_array[i]) && (MPI_DISTRIBUTE_CYCLIC != distrib_array[i]) && (MPI_DISTRIBUTE_NONE != distrib_array[i]) ) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); @@ -111,13 +111,13 @@ int MPI_Type_create_darray(int size, if (ndims < 1) { /* Don't just return MPI_DATATYPE_NULL as that can't be MPI_TYPE_FREE()ed, and that seems bad */ - *newtype = ompi_ddt_create(0); - ompi_ddt_add(*newtype, &ompi_mpi_datatype_null.dt, 0, 0, 0); + *newtype = ompi_datatype_create(0); + ompi_datatype_add(*newtype, &ompi_mpi_datatype_null.dt, 0, 0, 0); OPAL_CR_EXIT_LIBRARY(); return MPI_SUCCESS; } - rc = ompi_ddt_type_extent(oldtype, &orig_extent); + rc = ompi_datatype_type_extent(oldtype, &orig_extent); if (MPI_SUCCESS != rc) goto cleanup; /* calculate position in grid using row-major ordering */ @@ -137,7 +137,7 @@ int MPI_Type_create_darray(int size, /* duplicate type to here to 1) deal with constness without casting and 2) eliminate need to for conditional destroy below. Lame, yes. But cleaner code all around. */ - rc = ompi_ddt_duplicate(oldtype, &lastType); + rc = ompi_datatype_duplicate(oldtype, &lastType); if (OMPI_SUCCESS != rc) goto cleanup; /* figure out ordering issues */ @@ -153,13 +153,13 @@ int MPI_Type_create_darray(int size, switch(distrib_array[i]) { case MPI_DISTRIBUTE_BLOCK: - rc = block(gsize_array, i, ndims, psize_array[i], coords[i], - darg_array[i], order, orig_extent, - lastType, newtype, st_offsets+i); + rc = block(gsize_array, i, ndims, psize_array[i], coords[i], + darg_array[i], order, orig_extent, + lastType, newtype, st_offsets+i); break; case MPI_DISTRIBUTE_CYCLIC: - rc = cyclic(gsize_array, i, ndims, psize_array[i], coords[i], - darg_array[i], order, orig_extent, + rc = cyclic(gsize_array, i, ndims, psize_array[i], coords[i], + darg_array[i], order, orig_extent, lastType, newtype, st_offsets+i); break; case MPI_DISTRIBUTE_NONE: @@ -171,13 +171,13 @@ int MPI_Type_create_darray(int size, } rc = block(gsize_array, i, ndims, nprocs, tmp_rank, - MPI_DISTRIBUTE_DFLT_DARG, order, orig_extent, - lastType, newtype, st_offsets+i); + MPI_DISTRIBUTE_DFLT_DARG, order, orig_extent, + lastType, newtype, st_offsets+i); break; default: rc = MPI_ERR_ARG; } - ompi_ddt_destroy(&lastType); + ompi_datatype_destroy(&lastType); /* need to destroy the old type even in error condition, so don't check return code from above until after cleanup. */ if (MPI_SUCCESS != rc) goto cleanup; @@ -187,7 +187,7 @@ int MPI_Type_create_darray(int size, /* set displacement and UB correctly. Use struct instead of resized for same reason as subarray */ - { + { ptrdiff_t displs[3]; ompi_datatype_t *types[3]; int tmp_size, blength[3] = { 1, 1, 1}; @@ -199,7 +199,7 @@ int MPI_Type_create_darray(int size, displs[1] += tmp_size * st_offsets[i]; } - displs[0] = 0; + displs[0] = 0; displs[1] *= orig_extent; displs[2] = orig_extent; for (i = 0 ; i < ndims ; i++) { @@ -207,8 +207,8 @@ int MPI_Type_create_darray(int size, } types[0] = MPI_LB; types[1] = lastType; types[2] = MPI_UB; - rc = ompi_ddt_create_struct(3, blength, displs, types, newtype); - ompi_ddt_destroy(&lastType); + rc = ompi_datatype_create_struct(3, blength, displs, types, newtype); + ompi_datatype_destroy(&lastType); /* need to destroy the old type even in error condition, so don't check return code from above until after cleanup. */ if (MPI_SUCCESS != rc) goto cleanup; @@ -226,7 +226,7 @@ int MPI_Type_create_darray(int size, a_i[6] = psize_array; a_i[7] = ℴ - ompi_ddt_set_args( *newtype, 4 * ndims + 4, a_i, 0, NULL, 1, &oldtype, + ompi_datatype_set_args( *newtype, 4 * ndims + 4, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_DARRAY ); } @@ -244,7 +244,7 @@ static int block(const int *gsize_array, int dim, int ndims, int nprocs, int rank, int darg, int order, ptrdiff_t orig_extent, ompi_datatype_t *type_old, ompi_datatype_t **type_new, - ptrdiff_t *st_offset) + ptrdiff_t *st_offset) { int blksize, global_size, mysize, i, j, rc, start_loop, step; ptrdiff_t stride; @@ -252,9 +252,9 @@ block(const int *gsize_array, int dim, int ndims, int nprocs, global_size = gsize_array[dim]; if (darg == MPI_DISTRIBUTE_DFLT_DARG) - blksize = (global_size + nprocs - 1) / nprocs; + blksize = (global_size + nprocs - 1) / nprocs; else { - blksize = darg; + blksize = darg; } j = global_size - blksize*rank; @@ -269,13 +269,13 @@ block(const int *gsize_array, int dim, int ndims, int nprocs, stride = orig_extent; if (dim == start_loop) { - rc = ompi_ddt_create_contiguous(mysize, type_old, type_new); + rc = ompi_datatype_create_contiguous(mysize, type_old, type_new); if (OMPI_SUCCESS != rc) return rc; } else { for (i = start_loop ; i != dim ; i += step) { stride *= gsize_array[i]; } - rc = ompi_ddt_create_hvector(mysize, 1, stride, type_old, type_new); + rc = ompi_datatype_create_hvector(mysize, 1, stride, type_old, type_new); if (OMPI_SUCCESS != rc) return rc; } @@ -291,7 +291,7 @@ static int cyclic(const int *gsize_array, int dim, int ndims, int nprocs, int rank, int darg, int order, ptrdiff_t orig_extent, ompi_datatype_t* type_old, ompi_datatype_t **type_new, - ptrdiff_t *st_offset) + ptrdiff_t *st_offset) { int blksize, i, blklens[2], st_index, end_index, local_size, rem, count, rc; ptrdiff_t stride, disps[2]; @@ -316,7 +316,7 @@ cyclic(const int *gsize_array, int dim, int ndims, int nprocs, count = local_size / blksize; rem = local_size % blksize; - + stride = nprocs*blksize*orig_extent; if (order == MPI_ORDER_FORTRAN) { for (i=0; iflags |= DT_FLAG_PREDEFINED; + datatype->super.flags |= OPAL_DATATYPE_FLAG_PREDEFINED; a_i[0] = &r; a_i[1] = &p; - ompi_ddt_set_args( datatype, 1, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_COMPLEX ); + ompi_datatype_set_args( datatype, 1, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_COMPLEX ); rc = opal_hash_table_set_value_uint64( &ompi_mpi_f90_complex_hashtable, key, datatype ); if (OMPI_SUCCESS != rc) { diff --git a/ompi/mpi/c/type_create_f90_integer.c b/ompi/mpi/c/type_create_f90_integer.c index 1bfac2fd1d..4d84352bbf 100644 --- a/ompi/mpi/c/type_create_f90_integer.c +++ b/ompi/mpi/c/type_create_f90_integer.c @@ -90,17 +90,17 @@ int MPI_Type_create_f90_integer(int r, MPI_Datatype *newtype) /* Create the duplicate type corresponding to selected type, then * set the argument to be a COMBINER with the correct value of r * and add it to the hash table. */ - if (OMPI_SUCCESS != ompi_ddt_duplicate( *newtype, &datatype)) { + if (OMPI_SUCCESS != ompi_datatype_duplicate( *newtype, &datatype)) { OMPI_ERRHANDLER_RETURN (MPI_ERR_INTERN, MPI_COMM_WORLD, MPI_ERR_INTERN, FUNC_NAME ); } /* Make sure the user is not allowed to free this datatype as specified * in the MPI standard. */ - datatype->flags |= DT_FLAG_PREDEFINED; + datatype->super.flags |= OPAL_DATATYPE_FLAG_PREDEFINED; a_i[0] = &r; - ompi_ddt_set_args( datatype, 1, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_INTEGER ); + ompi_datatype_set_args( datatype, 1, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_INTEGER ); rc = opal_hash_table_set_value_uint32( &ompi_mpi_f90_integer_hashtable, r, datatype ); if (OMPI_SUCCESS != rc) { diff --git a/ompi/mpi/c/type_create_f90_real.c b/ompi/mpi/c/type_create_f90_real.c index 9cb306817e..d1dd497c6c 100644 --- a/ompi/mpi/c/type_create_f90_real.c +++ b/ompi/mpi/c/type_create_f90_real.c @@ -91,18 +91,18 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype) /* Create the duplicate type corresponding to selected type, then * set the argument to be a COMBINER with the correct value of r * and add it to the hash table. */ - if (OMPI_SUCCESS != ompi_ddt_duplicate( *newtype, &datatype)) { + if (OMPI_SUCCESS != ompi_datatype_duplicate( *newtype, &datatype)) { OMPI_ERRHANDLER_RETURN (MPI_ERR_INTERN, MPI_COMM_WORLD, MPI_ERR_INTERN, FUNC_NAME ); } /* Make sure the user is not allowed to free this datatype as specified * in the MPI standard. */ - datatype->flags |= DT_FLAG_PREDEFINED; + datatype->super.flags |= OPAL_DATATYPE_FLAG_PREDEFINED; a_i[0] = &r; a_i[1] = &p; - ompi_ddt_set_args( datatype, 1, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_REAL ); + ompi_datatype_set_args( datatype, 1, a_i, 0, NULL, 0, NULL, MPI_COMBINER_F90_REAL ); rc = opal_hash_table_set_value_uint64( &ompi_mpi_f90_real_hashtable, key, datatype ); if (OMPI_SUCCESS != rc) { diff --git a/ompi/mpi/c/type_create_hindexed.c b/ompi/mpi/c/type_create_hindexed.c index 8221676cb5..ffd39c8eb4 100644 --- a/ompi/mpi/c/type_create_hindexed.c +++ b/ompi/mpi/c/type_create_hindexed.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -72,10 +72,10 @@ int MPI_Type_create_hindexed(int count, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_create_hindexed( count, array_of_blocklengths, array_of_displacements, + rc = ompi_datatype_create_hindexed( count, array_of_blocklengths, array_of_displacements, oldtype, newtype ); if( rc != MPI_SUCCESS ) { - ompi_ddt_destroy( newtype ); + ompi_datatype_destroy( newtype ); OMPI_ERRHANDLER_RETURN( rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } /* data description */ @@ -83,7 +83,7 @@ int MPI_Type_create_hindexed(int count, int* a_i[2]; a_i[0] = &count; a_i[1] = array_of_blocklengths; - ompi_ddt_set_args( *newtype, count + 1, a_i, count, array_of_displacements, + ompi_datatype_set_args( *newtype, count + 1, a_i, count, array_of_displacements, 1, &oldtype, MPI_COMBINER_HINDEXED ); } diff --git a/ompi/mpi/c/type_create_hvector.c b/ompi/mpi/c/type_create_hvector.c index 982d1e65d2..0fdf157c79 100644 --- a/ompi/mpi/c/type_create_hvector.c +++ b/ompi/mpi/c/type_create_hvector.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -65,7 +65,7 @@ int MPI_Type_create_hvector(int count, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_create_hvector ( count, blocklength, stride, oldtype, + rc = ompi_datatype_create_hvector ( count, blocklength, stride, oldtype, newtype ); OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME ); @@ -77,7 +77,7 @@ int MPI_Type_create_hvector(int count, a_i[1] = &blocklength; a_a[0] = stride; - ompi_ddt_set_args( *newtype, 2, a_i, 1, a_a, 1, &oldtype, MPI_COMBINER_HVECTOR ); + ompi_datatype_set_args( *newtype, 2, a_i, 1, a_a, 1, &oldtype, MPI_COMBINER_HVECTOR ); } OPAL_CR_EXIT_LIBRARY(); diff --git a/ompi/mpi/c/type_create_indexed_block.c b/ompi/mpi/c/type_create_indexed_block.c index 1c9b814a9a..496aa9d836 100644 --- a/ompi/mpi/c/type_create_indexed_block.c +++ b/ompi/mpi/c/type_create_indexed_block.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -65,10 +65,10 @@ int MPI_Type_create_indexed_block(int count, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_create_indexed_block( count, blocklength, array_of_displacements, + rc = ompi_datatype_create_indexed_block( count, blocklength, array_of_displacements, oldtype, newtype ); if( rc != MPI_SUCCESS ) { - ompi_ddt_destroy( newtype ); + ompi_datatype_destroy( newtype ); OMPI_ERRHANDLER_RETURN( rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } { @@ -76,7 +76,7 @@ int MPI_Type_create_indexed_block(int count, a_i[0] = &count; a_i[1] = &blocklength; a_i[2] = array_of_displacements; - ompi_ddt_set_args( *newtype, 2 + count, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_INDEXED_BLOCK ); + ompi_datatype_set_args( *newtype, 2 + count, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_INDEXED_BLOCK ); } OPAL_CR_EXIT_LIBRARY(); diff --git a/ompi/mpi/c/type_create_resized.c b/ompi/mpi/c/type_create_resized.c index 0495113b41..50eb8d72d0 100644 --- a/ompi/mpi/c/type_create_resized.c +++ b/ompi/mpi/c/type_create_resized.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -58,9 +58,9 @@ int MPI_Type_create_resized(MPI_Datatype oldtype, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_create_resized( oldtype, lb, extent, newtype ); + rc = ompi_datatype_create_resized( oldtype, lb, extent, newtype ); if( rc != MPI_SUCCESS ) { - ompi_ddt_destroy( newtype ); + ompi_datatype_destroy( newtype ); OMPI_ERRHANDLER_RETURN( rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } @@ -68,7 +68,7 @@ int MPI_Type_create_resized(MPI_Datatype oldtype, MPI_Aint a_a[2]; a_a[0] = lb; a_a[1] = extent; - ompi_ddt_set_args( *newtype, 0, NULL, 2, a_a, 1, &oldtype, MPI_COMBINER_RESIZED ); + ompi_datatype_set_args( *newtype, 0, NULL, 2, a_a, 1, &oldtype, MPI_COMBINER_RESIZED ); } OPAL_CR_EXIT_LIBRARY(); diff --git a/ompi/mpi/c/type_create_struct.c b/ompi/mpi/c/type_create_struct.c index 087f997172..a50efcd717 100644 --- a/ompi/mpi/c/type_create_struct.c +++ b/ompi/mpi/c/type_create_struct.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -78,10 +78,10 @@ int MPI_Type_create_struct(int count, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_create_struct( count, array_of_blocklengths, array_of_displacements, + rc = ompi_datatype_create_struct( count, array_of_blocklengths, array_of_displacements, array_of_types, newtype ); if( rc != MPI_SUCCESS ) { - ompi_ddt_destroy( newtype ); + ompi_datatype_destroy( newtype ); OMPI_ERRHANDLER_RETURN( rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } @@ -91,7 +91,7 @@ int MPI_Type_create_struct(int count, a_i[0] = &count; a_i[1] = array_of_blocklengths; - ompi_ddt_set_args( *newtype, count + 1, a_i, count, array_of_displacements, + ompi_datatype_set_args( *newtype, count + 1, a_i, count, array_of_displacements, count, array_of_types, MPI_COMBINER_STRUCT ); } diff --git a/ompi/mpi/c/type_create_subarray.c b/ompi/mpi/c/type_create_subarray.c index fea9a38876..95f8575fe7 100644 --- a/ompi/mpi/c/type_create_subarray.c +++ b/ompi/mpi/c/type_create_subarray.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -76,7 +76,7 @@ int MPI_Type_create_subarray(int ndims, OPAL_CR_ENTER_LIBRARY(); - ompi_ddt_type_extent( oldtype, &extent ); + ompi_datatype_type_extent( oldtype, &extent ); /* If the ndims is zero then return the NULL datatype */ if( ndims < 2 ) { @@ -85,7 +85,7 @@ int MPI_Type_create_subarray(int ndims, OPAL_CR_EXIT_LIBRARY(); return MPI_SUCCESS; } - ompi_ddt_create_contiguous( subsize_array[0], oldtype, &last_type ); + ompi_datatype_create_contiguous( subsize_array[0], oldtype, &last_type ); size = size_array[0]; displ = start_array[0]; goto replace_subarray_type; @@ -105,16 +105,16 @@ int MPI_Type_create_subarray(int ndims, * first dimension data outside the loop, such that we dont have to create * a duplicate of the oldtype just to be able to free it. */ - ompi_ddt_create_vector( subsize_array[i+step], subsize_array[i], size_array[i], + ompi_datatype_create_vector( subsize_array[i+step], subsize_array[i], size_array[i], oldtype, newtype ); last_type = *newtype; size = size_array[i] * size_array[i+step]; displ = start_array[i] + start_array[i+step] * size_array[i]; for( i += 2 * step; i != end_loop; i += step ) { - ompi_ddt_create_hvector( subsize_array[i], 1, size * extent, + ompi_datatype_create_hvector( subsize_array[i], 1, size * extent, last_type, newtype ); - ompi_ddt_destroy( &last_type ); + ompi_datatype_destroy( &last_type ); displ += size * start_array[i]; size *= size_array[i]; last_type = *newtype; @@ -134,9 +134,9 @@ int MPI_Type_create_subarray(int ndims, displs[0] = 0; displs[1] = displ * extent; displs[2] = size * extent; types[0] = MPI_LB; types[1] = last_type; types[2] = MPI_UB; - ompi_ddt_create_struct( 3, blength, displs, types, newtype ); + ompi_datatype_create_struct( 3, blength, displs, types, newtype ); } - ompi_ddt_destroy( &last_type ); + ompi_datatype_destroy( &last_type ); { int* a_i[5]; @@ -147,7 +147,7 @@ int MPI_Type_create_subarray(int ndims, a_i[3] = start_array; a_i[4] = ℴ - ompi_ddt_set_args( *newtype, 3 * ndims + 2, a_i, 0, NULL, 1, &oldtype, + ompi_datatype_set_args( *newtype, 3 * ndims + 2, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_SUBARRAY ); } diff --git a/ompi/mpi/c/type_delete_attr.c b/ompi/mpi/c/type_delete_attr.c index 52096e57c9..f922057044 100644 --- a/ompi/mpi/c/type_delete_attr.c +++ b/ompi/mpi/c/type_delete_attr.c @@ -23,7 +23,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/attribute/attribute.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/type_dup.c b/ompi/mpi/c/type_dup.c index 625f335450..70b8a8babe 100644 --- a/ompi/mpi/c/type_dup.c +++ b/ompi/mpi/c/type_dup.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/attribute/attribute.h" #include "ompi/memchecker.h" @@ -55,16 +55,16 @@ int MPI_Type_dup (MPI_Datatype type, OPAL_CR_ENTER_LIBRARY(); - if (OMPI_SUCCESS != ompi_ddt_duplicate( type, newtype)) { - ompi_ddt_destroy( newtype ); + if (OMPI_SUCCESS != ompi_datatype_duplicate( type, newtype)) { + ompi_datatype_destroy( newtype ); OMPI_ERRHANDLER_RETURN (MPI_ERR_INTERN, MPI_COMM_WORLD, MPI_ERR_INTERN, FUNC_NAME ); } - ompi_ddt_set_args( *newtype, 0, NULL, 0, NULL, 1, &type, MPI_COMBINER_DUP ); + ompi_datatype_set_args( *newtype, 0, NULL, 0, NULL, 1, &type, MPI_COMBINER_DUP ); /* Copy all the old attributes, if there were any. This is done - here (vs. ompi_ddt_duplicate()) because MPI_TYPE_DUP is the + here (vs. ompi_datatype_duplicate()) because MPI_TYPE_DUP is the only MPI function that copies attributes. All other MPI functions that take an old type and generate a newtype do not copy attributes. Really. */ @@ -74,7 +74,7 @@ int MPI_Type_dup (MPI_Datatype type, type, *newtype, type->d_keyhash, (*newtype)->d_keyhash)) { - ompi_ddt_destroy(newtype); + ompi_datatype_destroy(newtype); OMPI_ERRHANDLER_RETURN( MPI_ERR_INTERN, MPI_COMM_WORLD, MPI_ERR_INTERN, FUNC_NAME ); } diff --git a/ompi/mpi/c/type_extent.c b/ompi/mpi/c/type_extent.c index f8ba1776cb..ea90b6104d 100644 --- a/ompi/mpi/c/type_extent.c +++ b/ompi/mpi/c/type_extent.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -56,6 +56,6 @@ int MPI_Type_extent(MPI_Datatype type, MPI_Aint *extent) OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_get_extent( type, &lb, extent ); + rc = ompi_datatype_get_extent( type, &lb, extent ); OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } diff --git a/ompi/mpi/c/type_f2c.c b/ompi/mpi/c/type_f2c.c index 94e2c95854..c5e0696baa 100644 --- a/ompi/mpi/c/type_f2c.c +++ b/ompi/mpi/c/type_f2c.c @@ -23,7 +23,8 @@ #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" #include "ompi/mpi/f77/fint_2_int.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -54,7 +55,6 @@ MPI_Datatype MPI_Type_f2c(MPI_Fint datatype) /* Per MPI-2:4.12.4, do not invoke an error handler if we get an invalid fortran handle. If we get an invalid fortran handle, return an invalid C handle. */ - if (datatype_index < 0 || datatype_index >= opal_pointer_array_get_size(&ompi_datatype_f_to_c_table)) { diff --git a/ompi/mpi/c/type_free.c b/ompi/mpi/c/type_free.c index b7308f1e87..2ca780a4fc 100644 --- a/ompi/mpi/c/type_free.c +++ b/ompi/mpi/c/type_free.c @@ -23,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -48,7 +48,7 @@ int MPI_Type_free(MPI_Datatype *type) if( MPI_PARAM_CHECK ) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); if (NULL == type || NULL == *type || MPI_DATATYPE_NULL == *type || - ompi_ddt_is_predefined(*type)) { + ompi_datatype_is_predefined(*type)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME ); } @@ -56,7 +56,7 @@ int MPI_Type_free(MPI_Datatype *type) OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_destroy( type ); + rc = ompi_datatype_destroy( type ); if( rc != MPI_SUCCESS ) { OMPI_ERRHANDLER_RETURN( MPI_ERR_INTERN, MPI_COMM_WORLD, MPI_ERR_INTERN, FUNC_NAME ); diff --git a/ompi/mpi/c/type_get_attr.c b/ompi/mpi/c/type_get_attr.c index e9a1953d0b..dfd30203f2 100644 --- a/ompi/mpi/c/type_get_attr.c +++ b/ompi/mpi/c/type_get_attr.c @@ -23,7 +23,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/attribute/attribute.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/type_get_contents.c b/ompi/mpi/c/type_get_contents.c index 8f960fedf6..966e0ab1ae 100644 --- a/ompi/mpi/c/type_get_contents.c +++ b/ompi/mpi/c/type_get_contents.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -66,7 +66,7 @@ int MPI_Type_get_contents(MPI_Datatype mtype, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_get_args( mtype, 1, &max_integers, array_of_integers, + rc = ompi_datatype_get_args( mtype, 1, &max_integers, array_of_integers, &max_addresses, array_of_addresses, &max_datatypes, array_of_datatypes, NULL ); if( rc != MPI_SUCCESS ) { @@ -78,13 +78,13 @@ int MPI_Type_get_contents(MPI_Datatype mtype, /* if we have a predefined datatype then we return directly a pointer to * the datatype, otherwise we should create a copy and give back the copy. */ - if( !(ompi_ddt_is_predefined(array_of_datatypes[i])) ) { - if( (rc = ompi_ddt_duplicate( array_of_datatypes[i], &newtype )) != MPI_SUCCESS ) { - ompi_ddt_destroy( &newtype ); + if( !(ompi_datatype_is_predefined(array_of_datatypes[i])) ) { + if( (rc = ompi_datatype_duplicate( array_of_datatypes[i], &newtype )) != MPI_SUCCESS ) { + ompi_datatype_destroy( &newtype ); OMPI_ERRHANDLER_RETURN( MPI_ERR_INTERN, MPI_COMM_WORLD, MPI_ERR_INTERN, FUNC_NAME ); } - ompi_ddt_copy_args( array_of_datatypes[i], newtype ); + ompi_datatype_copy_args( array_of_datatypes[i], newtype ); array_of_datatypes[i] = newtype; } } diff --git a/ompi/mpi/c/type_get_envelope.c b/ompi/mpi/c/type_get_envelope.c index f9576c70f0..d32a08adc7 100644 --- a/ompi/mpi/c/type_get_envelope.c +++ b/ompi/mpi/c/type_get_envelope.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -62,7 +62,7 @@ int MPI_Type_get_envelope(MPI_Datatype type, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_get_args( type, 0, num_integers, NULL, num_addresses, NULL, + rc = ompi_datatype_get_args( type, 0, num_integers, NULL, num_addresses, NULL, num_datatypes, NULL, combiner ); OMPI_ERRHANDLER_RETURN( rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } diff --git a/ompi/mpi/c/type_get_extent.c b/ompi/mpi/c/type_get_extent.c index c6a3b45cf0..86920460cb 100644 --- a/ompi/mpi/c/type_get_extent.c +++ b/ompi/mpi/c/type_get_extent.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -55,6 +55,6 @@ int MPI_Type_get_extent(MPI_Datatype type, MPI_Aint *lb, MPI_Aint *extent) OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_get_extent( type, lb, extent ); + rc = ompi_datatype_get_extent( type, lb, extent ); OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } diff --git a/ompi/mpi/c/type_get_name.c b/ompi/mpi/c/type_get_name.c index 4763f13f72..037931c258 100644 --- a/ompi/mpi/c/type_get_name.c +++ b/ompi/mpi/c/type_get_name.c @@ -25,7 +25,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/type_get_true_extent.c b/ompi/mpi/c/type_get_true_extent.c index 96fe1de768..95a97be3cb 100644 --- a/ompi/mpi/c/type_get_true_extent.c +++ b/ompi/mpi/c/type_get_true_extent.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -59,6 +59,6 @@ int MPI_Type_get_true_extent(MPI_Datatype datatype, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_get_true_extent( datatype, true_lb, true_extent ); + rc = ompi_datatype_get_true_extent( datatype, true_lb, true_extent ); OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } diff --git a/ompi/mpi/c/type_indexed.c b/ompi/mpi/c/type_indexed.c index 5a97b23a11..dcb0a3f2b0 100644 --- a/ompi/mpi/c/type_indexed.c +++ b/ompi/mpi/c/type_indexed.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -71,11 +71,11 @@ int MPI_Type_indexed(int count, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_create_indexed ( count, array_of_blocklengths, + rc = ompi_datatype_create_indexed ( count, array_of_blocklengths, array_of_displacements, oldtype, newtype ); if( rc != MPI_SUCCESS ) { - ompi_ddt_destroy( newtype ); + ompi_datatype_destroy( newtype ); OMPI_ERRHANDLER_RETURN( rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } @@ -87,7 +87,7 @@ int MPI_Type_indexed(int count, a_i[1] = array_of_blocklengths; a_i[2] = array_of_displacements; - ompi_ddt_set_args( *newtype, 2 * count + 1, a_i, 0, NULL, 1, &oldtype, + ompi_datatype_set_args( *newtype, 2 * count + 1, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_INDEXED ); } diff --git a/ompi/mpi/c/type_lb.c b/ompi/mpi/c/type_lb.c index 24443111c9..90e55ddf6c 100644 --- a/ompi/mpi/c/type_lb.c +++ b/ompi/mpi/c/type_lb.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -56,6 +56,6 @@ int MPI_Type_lb(MPI_Datatype type, MPI_Aint *lb) OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_get_extent( type, lb, &extent ); + rc = ompi_datatype_get_extent( type, lb, &extent ); OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME ); } diff --git a/ompi/mpi/c/type_match_size.c b/ompi/mpi/c/type_match_size.c index f39cb982a1..e9bcbee627 100644 --- a/ompi/mpi/c/type_match_size.c +++ b/ompi/mpi/c/type_match_size.c @@ -23,7 +23,8 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES #pragma weak MPI_Type_match_size = PMPI_Type_match_size @@ -46,13 +47,13 @@ int MPI_Type_match_size(int typeclass, int size, MPI_Datatype *type) switch( typeclass ) { case MPI_TYPECLASS_REAL: - *type = (MPI_Datatype)ompi_ddt_match_size( size, DT_FLAG_DATA_FLOAT, DT_FLAG_DATA_FORTRAN ); + *type = (MPI_Datatype)ompi_datatype_match_size( size, OMPI_DATATYPE_FLAG_DATA_FLOAT, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); break; case MPI_TYPECLASS_INTEGER: - *type = (MPI_Datatype)ompi_ddt_match_size( size, DT_FLAG_DATA_INT, DT_FLAG_DATA_FORTRAN ); + *type = (MPI_Datatype)ompi_datatype_match_size( size, OMPI_DATATYPE_FLAG_DATA_INT, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); break; case MPI_TYPECLASS_COMPLEX: - *type = (MPI_Datatype)ompi_ddt_match_size( size, DT_FLAG_DATA_COMPLEX, DT_FLAG_DATA_FORTRAN ); + *type = (MPI_Datatype)ompi_datatype_match_size( size, OMPI_DATATYPE_FLAG_DATA_COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); break; default: *type = &ompi_mpi_datatype_null.dt; diff --git a/ompi/mpi/c/type_set_attr.c b/ompi/mpi/c/type_set_attr.c index 879d0c7765..f89fe2731c 100644 --- a/ompi/mpi/c/type_set_attr.c +++ b/ompi/mpi/c/type_set_attr.c @@ -23,7 +23,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/attribute/attribute.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/type_set_name.c b/ompi/mpi/c/type_set_name.c index 635c616b25..c17f0fc828 100644 --- a/ompi/mpi/c/type_set_name.c +++ b/ompi/mpi/c/type_set_name.c @@ -24,7 +24,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES diff --git a/ompi/mpi/c/type_size.c b/ompi/mpi/c/type_size.c index 1df9a45b59..c787549f59 100644 --- a/ompi/mpi/c/type_size.c +++ b/ompi/mpi/c/type_size.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +23,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -38,24 +39,25 @@ static const char FUNC_NAME[] = "MPI_Type_size"; int MPI_Type_size(MPI_Datatype type, int *size) { - + size_t type_size; MEMCHECKER( memchecker_datatype(type); ); OPAL_CR_NOOP_PROGRESS(); - if (MPI_PARAM_CHECK) { - OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (NULL == type || MPI_DATATYPE_NULL == type) { - return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME); - } else if (NULL == size) { - return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); + if (MPI_PARAM_CHECK) { + OMPI_ERR_INIT_FINALIZE(FUNC_NAME); + if (NULL == type || MPI_DATATYPE_NULL == type) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME); + } else if (NULL == size) { + return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME); + } } - } - /* Simple */ + opal_datatype_type_size ( &type->super, &type_size); - *size = (int)type->size; - return MPI_SUCCESS; + *size = type_size; + + return MPI_SUCCESS; } diff --git a/ompi/mpi/c/type_ub.c b/ompi/mpi/c/type_ub.c index e90ffc3a1e..a9d2cc823c 100644 --- a/ompi/mpi/c/type_ub.c +++ b/ompi/mpi/c/type_ub.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -57,7 +57,7 @@ int MPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) OPAL_CR_ENTER_LIBRARY(); - status = ompi_ddt_get_extent( mtype, &lb, &extent ); + status = ompi_datatype_get_extent( mtype, &lb, &extent ); if (MPI_SUCCESS == status) { *ub = lb + extent; } diff --git a/ompi/mpi/c/type_vector.c b/ompi/mpi/c/type_vector.c index 16c5aae853..64b46d233c 100644 --- a/ompi/mpi/c/type_vector.c +++ b/ompi/mpi/c/type_vector.c @@ -22,7 +22,7 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -64,7 +64,7 @@ int MPI_Type_vector(int count, OPAL_CR_ENTER_LIBRARY(); - rc = ompi_ddt_create_vector ( count, blocklength, stride, oldtype, newtype ); + rc = ompi_datatype_create_vector ( count, blocklength, stride, oldtype, newtype ); OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME ); { @@ -73,7 +73,7 @@ int MPI_Type_vector(int count, a_i[1] = &blocklength; a_i[2] = &stride; - ompi_ddt_set_args( *newtype, 3, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_VECTOR ); + ompi_datatype_set_args( *newtype, 3, a_i, 0, NULL, 1, &oldtype, MPI_COMBINER_VECTOR ); } OPAL_CR_EXIT_LIBRARY(); diff --git a/ompi/mpi/c/unpack.c b/ompi/mpi/c/unpack.c index 2760f07e97..8a8090ac2b 100644 --- a/ompi/mpi/c/unpack.c +++ b/ompi/mpi/c/unpack.c @@ -23,8 +23,8 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -43,7 +43,7 @@ int MPI_Unpack(void *inbuf, int insize, int *position, MPI_Comm comm) { int rc = 1; - ompi_convertor_t local_convertor; + opal_convertor_t local_convertor; struct iovec outvec; unsigned int iov_count; size_t size; @@ -77,13 +77,13 @@ int MPI_Unpack(void *inbuf, int insize, int *position, OPAL_CR_ENTER_LIBRARY(); if( insize > 0 ) { - OBJ_CONSTRUCT( &local_convertor, ompi_convertor_t ); + OBJ_CONSTRUCT( &local_convertor, opal_convertor_t ); /* the resulting convertor will be set the the position ZERO */ - ompi_convertor_copy_and_prepare_for_recv( ompi_mpi_local_convertor, datatype, + opal_convertor_copy_and_prepare_for_recv( ompi_mpi_local_convertor, &(datatype->super), outcount, outbuf, 0, &local_convertor ); /* Check for truncation */ - ompi_convertor_get_packed_size( &local_convertor, &size ); + opal_convertor_get_packed_size( &local_convertor, &size ); if( (*position + size) > (unsigned int)insize ) { OBJ_DESTRUCT( &local_convertor ); OPAL_CR_EXIT_LIBRARY(); @@ -96,7 +96,7 @@ int MPI_Unpack(void *inbuf, int insize, int *position, /* Do the actual unpacking */ iov_count = 1; - rc = ompi_convertor_unpack( &local_convertor, &outvec, &iov_count, &size ); + rc = opal_convertor_unpack( &local_convertor, &outvec, &iov_count, &size ); *position += size; OBJ_DESTRUCT( &local_convertor ); diff --git a/ompi/mpi/c/unpack_external.c b/ompi/mpi/c/unpack_external.c index 294b62c0d4..6fe770aeed 100644 --- a/ompi/mpi/c/unpack_external.c +++ b/ompi/mpi/c/unpack_external.c @@ -22,8 +22,8 @@ #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/memchecker.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES @@ -42,7 +42,7 @@ int MPI_Unpack_external (char *datarep, void *inbuf, MPI_Aint insize, MPI_Datatype datatype) { int rc; - ompi_convertor_t local_convertor; + opal_convertor_t local_convertor; struct iovec outvec; unsigned int iov_count; size_t size; @@ -65,14 +65,14 @@ int MPI_Unpack_external (char *datarep, void *inbuf, MPI_Aint insize, OPAL_CR_ENTER_LIBRARY(); - OBJ_CONSTRUCT(&local_convertor, ompi_convertor_t); + OBJ_CONSTRUCT(&local_convertor, opal_convertor_t); /* the resulting convertor will be set to the position ZERO */ - ompi_convertor_copy_and_prepare_for_recv( ompi_mpi_external32_convertor, - datatype, outcount, outbuf, 0, &local_convertor ); + opal_convertor_copy_and_prepare_for_recv( ompi_mpi_external32_convertor, + &(datatype->super), outcount, outbuf, 0, &local_convertor ); /* Check for truncation */ - ompi_convertor_get_packed_size( &local_convertor, &size ); + opal_convertor_get_packed_size( &local_convertor, &size ); if( (*position + size) > (unsigned int)insize ) { OBJ_DESTRUCT( &local_convertor ); OPAL_CR_EXIT_LIBRARY(); @@ -85,7 +85,7 @@ int MPI_Unpack_external (char *datarep, void *inbuf, MPI_Aint insize, /* Do the actual unpacking */ iov_count = 1; - rc = ompi_convertor_unpack( &local_convertor, &outvec, &iov_count, &size ); + rc = opal_convertor_unpack( &local_convertor, &outvec, &iov_count, &size ); *position += size; OBJ_DESTRUCT( &local_convertor ); diff --git a/ompi/mpi/cxx/intercepts.cc b/ompi/mpi/cxx/intercepts.cc index ee7febcce6..24473e4ddb 100644 --- a/ompi/mpi/cxx/intercepts.cc +++ b/ompi/mpi/cxx/intercepts.cc @@ -26,7 +26,7 @@ #include "ompi_config.h" #include "ompi/errhandler/errhandler.h" #include "ompi/communicator/communicator.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" extern "C" void ompi_mpi_cxx_throw_exception(int *errcode) diff --git a/ompi/mpi/cxx/mpicxx.cc b/ompi/mpi/cxx/mpicxx.cc index 9493be0bb3..35e5d8d04e 100644 --- a/ompi/mpi/cxx/mpicxx.cc +++ b/ompi/mpi/cxx/mpicxx.cc @@ -81,7 +81,7 @@ const Datatype REAL((MPI_Datatype)&(ompi_mpi_real)); const Datatype INTEGER((MPI_Datatype)&(ompi_mpi_integer)); const Datatype DOUBLE_PRECISION((MPI_Datatype)&(ompi_mpi_dblprec)); const Datatype F_COMPLEX((MPI_Datatype)&(ompi_mpi_cplex)); -const Datatype LOGICAL((MPI_Datatype)&(ompi_mpi_logic)); +const Datatype LOGICAL((MPI_Datatype)&(ompi_mpi_logical)); const Datatype CHARACTER((MPI_Datatype)&(ompi_mpi_character)); // datatype for reduction functions (Fortran) diff --git a/ompi/mpi/f77/type_get_attr_f.c b/ompi/mpi/f77/type_get_attr_f.c index 5b0f4bd79d..02b62daf57 100644 --- a/ompi/mpi/f77/type_get_attr_f.c +++ b/ompi/mpi/f77/type_get_attr_f.c @@ -21,7 +21,7 @@ #include "ompi/mpi/f77/bindings.h" #include "ompi/attribute/attribute.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER #pragma weak PMPI_TYPE_GET_ATTR = mpi_type_get_attr_f diff --git a/ompi/mpi/f77/type_match_size_f.c b/ompi/mpi/f77/type_match_size_f.c index 5efec2f660..3286f3148e 100644 --- a/ompi/mpi/f77/type_match_size_f.c +++ b/ompi/mpi/f77/type_match_size_f.c @@ -21,7 +21,8 @@ #include "ompi/mpi/f77/bindings.h" #include "ompi/mpi/f77/constants.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" #include "ompi/errhandler/errhandler.h" #include "ompi/communicator/communicator.h" #include "ompi/runtime/params.h" @@ -79,13 +80,13 @@ void mpi_type_match_size_f(MPI_Fint *typeclass, MPI_Fint *size, MPI_Fint *type, switch( OMPI_FINT_2_INT(*typeclass) ) { case MPI_TYPECLASS_REAL: - c_type = (MPI_Datatype)ompi_ddt_match_size( c_size, DT_FLAG_DATA_FLOAT, DT_FLAG_DATA_FORTRAN ); + c_type = (MPI_Datatype)ompi_datatype_match_size( c_size, OMPI_DATATYPE_FLAG_DATA_FLOAT, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); break; case MPI_TYPECLASS_INTEGER: - c_type = (MPI_Datatype)ompi_ddt_match_size( c_size, DT_FLAG_DATA_INT, DT_FLAG_DATA_FORTRAN ); + c_type = (MPI_Datatype)ompi_datatype_match_size( c_size, OMPI_DATATYPE_FLAG_DATA_INT, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); break; case MPI_TYPECLASS_COMPLEX: - c_type = (MPI_Datatype)ompi_ddt_match_size( c_size, DT_FLAG_DATA_COMPLEX, DT_FLAG_DATA_FORTRAN ); + c_type = (MPI_Datatype)ompi_datatype_match_size( c_size, OMPI_DATATYPE_FLAG_DATA_COMPLEX, OMPI_DATATYPE_FLAG_DATA_FORTRAN ); break; default: c_type = &ompi_mpi_datatype_null.dt; diff --git a/ompi/mpi/f77/type_set_attr_f.c b/ompi/mpi/f77/type_set_attr_f.c index 2ba0d2d7c1..aa99b3a38c 100644 --- a/ompi/mpi/f77/type_set_attr_f.c +++ b/ompi/mpi/f77/type_set_attr_f.c @@ -20,7 +20,7 @@ #include "ompi/mpi/f77/bindings.h" #include "ompi/attribute/attribute.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER #pragma weak PMPI_TYPE_SET_ATTR = mpi_type_set_attr_f diff --git a/ompi/op/op.c b/ompi/op/op.c index 093c157da9..43444eb767 100644 --- a/ompi/op/op.c +++ b/ompi/op/op.c @@ -21,11 +21,12 @@ #include "ompi_config.h" +#include "opal/class/opal_pointer_array.h" + #include "ompi/constants.h" #include "ompi/op/op.h" #include "ompi/mca/op/base/base.h" -#include "opal/class/opal_pointer_array.h" -#include "ompi/datatype/datatype_internal.h" +#include "ompi/datatype/ompi_datatype_internal.h" /* @@ -76,7 +77,7 @@ ompi_predefined_op_t ompi_mpi_op_replace; /* * Map from ddt->id to position in op function pointer array */ -int ompi_op_ddt_map[DT_MAX_PREDEFINED]; +int ompi_op_ddt_map[OMPI_DATATYPE_MAX_PREDEFINED]; #define FLAGS_NO_FLOAT \ @@ -101,41 +102,42 @@ int ompi_op_init(void) /* Fill in the ddt.id->op_position map */ - for (i = 0; i < DT_MAX_PREDEFINED; ++i) { + for (i = 0; i < OMPI_DATATYPE_MAX_PREDEFINED; ++i) { ompi_op_ddt_map[i] = -1; } - ompi_op_ddt_map[DT_UNSIGNED_CHAR] = OMPI_OP_BASE_TYPE_UNSIGNED_CHAR; - ompi_op_ddt_map[DT_SIGNED_CHAR] = OMPI_OP_BASE_TYPE_SIGNED_CHAR; - ompi_op_ddt_map[DT_BYTE] = OMPI_OP_BASE_TYPE_BYTE; - ompi_op_ddt_map[DT_SHORT] = OMPI_OP_BASE_TYPE_SHORT; - ompi_op_ddt_map[DT_UNSIGNED_SHORT] = OMPI_OP_BASE_TYPE_UNSIGNED_SHORT; - ompi_op_ddt_map[DT_INT] = OMPI_OP_BASE_TYPE_INT; - ompi_op_ddt_map[DT_UNSIGNED_INT] = OMPI_OP_BASE_TYPE_UNSIGNED; - ompi_op_ddt_map[DT_LONG] = OMPI_OP_BASE_TYPE_LONG; - ompi_op_ddt_map[DT_UNSIGNED_LONG] = OMPI_OP_BASE_TYPE_UNSIGNED_LONG; - ompi_op_ddt_map[DT_LONG_LONG_INT] = OMPI_OP_BASE_TYPE_LONG_LONG_INT; - ompi_op_ddt_map[DT_UNSIGNED_LONG_LONG] = OMPI_OP_BASE_TYPE_UNSIGNED_LONG_LONG; - ompi_op_ddt_map[DT_FLOAT] = OMPI_OP_BASE_TYPE_FLOAT; - ompi_op_ddt_map[DT_DOUBLE] = OMPI_OP_BASE_TYPE_DOUBLE; - ompi_op_ddt_map[DT_LONG_DOUBLE] = OMPI_OP_BASE_TYPE_LONG_DOUBLE; - ompi_op_ddt_map[DT_COMPLEX_FLOAT] = OMPI_OP_BASE_TYPE_COMPLEX; - ompi_op_ddt_map[DT_COMPLEX_DOUBLE] = OMPI_OP_BASE_TYPE_DOUBLE_COMPLEX; - ompi_op_ddt_map[DT_LOGIC] = OMPI_OP_BASE_TYPE_LOGICAL; - ompi_op_ddt_map[DT_CXX_BOOL] = OMPI_OP_BASE_TYPE_BOOL; - ompi_op_ddt_map[DT_FLOAT_INT] = OMPI_OP_BASE_TYPE_FLOAT_INT; - ompi_op_ddt_map[DT_DOUBLE_INT] = OMPI_OP_BASE_TYPE_DOUBLE_INT; - ompi_op_ddt_map[DT_LONG_INT] = OMPI_OP_BASE_TYPE_LONG_INT; - ompi_op_ddt_map[DT_2INT] = OMPI_OP_BASE_TYPE_2INT; - ompi_op_ddt_map[DT_SHORT_INT] = OMPI_OP_BASE_TYPE_SHORT_INT; - ompi_op_ddt_map[DT_INTEGER] = OMPI_OP_BASE_TYPE_INTEGER; - ompi_op_ddt_map[DT_REAL] = OMPI_OP_BASE_TYPE_REAL; - ompi_op_ddt_map[DT_DBLPREC] = OMPI_OP_BASE_TYPE_DOUBLE_PRECISION; - ompi_op_ddt_map[DT_2REAL] = OMPI_OP_BASE_TYPE_2REAL; - ompi_op_ddt_map[DT_2DBLPREC] = OMPI_OP_BASE_TYPE_2DOUBLE_PRECISION; - ompi_op_ddt_map[DT_2INTEGER] = OMPI_OP_BASE_TYPE_2INTEGER; - ompi_op_ddt_map[DT_LONG_DOUBLE_INT] = OMPI_OP_BASE_TYPE_LONG_DOUBLE_INT; - ompi_op_ddt_map[DT_WCHAR] = OMPI_OP_BASE_TYPE_WCHAR; + /* XXX TODO */ + ompi_op_ddt_map[OMPI_DATATYPE_UNSIGNED_CHAR] = OMPI_OP_BASE_TYPE_UNSIGNED_CHAR; + ompi_op_ddt_map[OMPI_DATATYPE_SIGNED_CHAR] = OMPI_OP_BASE_TYPE_SIGNED_CHAR; + ompi_op_ddt_map[OMPI_DATATYPE_BYTE] = OMPI_OP_BASE_TYPE_BYTE; + ompi_op_ddt_map[OMPI_DATATYPE_SHORT] = OMPI_OP_BASE_TYPE_SHORT; + ompi_op_ddt_map[OMPI_DATATYPE_UNSIGNED_SHORT] = OMPI_OP_BASE_TYPE_UNSIGNED_SHORT; + ompi_op_ddt_map[OMPI_DATATYPE_INT] = OMPI_OP_BASE_TYPE_INT; + ompi_op_ddt_map[OMPI_DATATYPE_UNSIGNED_INT] = OMPI_OP_BASE_TYPE_UNSIGNED; + ompi_op_ddt_map[OMPI_DATATYPE_LONG] = OMPI_OP_BASE_TYPE_LONG; + ompi_op_ddt_map[OMPI_DATATYPE_UNSIGNED_LONG] = OMPI_OP_BASE_TYPE_UNSIGNED_LONG; + ompi_op_ddt_map[OMPI_DATATYPE_LONG_LONG] = OMPI_OP_BASE_TYPE_LONG_LONG_INT; + ompi_op_ddt_map[OMPI_DATATYPE_UNSIGNED_LONG_LONG] = OMPI_OP_BASE_TYPE_UNSIGNED_LONG_LONG; + ompi_op_ddt_map[OMPI_DATATYPE_FLOAT] = OMPI_OP_BASE_TYPE_FLOAT; + ompi_op_ddt_map[OMPI_DATATYPE_DOUBLE] = OMPI_OP_BASE_TYPE_DOUBLE; + ompi_op_ddt_map[OMPI_DATATYPE_LONG_DOUBLE] = OMPI_OP_BASE_TYPE_LONG_DOUBLE; + ompi_op_ddt_map[OMPI_DATATYPE_COMPLEX] = OMPI_OP_BASE_TYPE_COMPLEX; + ompi_op_ddt_map[OMPI_DATATYPE_DOUBLE_COMPLEX] = OMPI_OP_BASE_TYPE_DOUBLE_COMPLEX; + ompi_op_ddt_map[OMPI_DATATYPE_LOGICAL] = OMPI_OP_BASE_TYPE_LOGICAL; + ompi_op_ddt_map[OMPI_DATATYPE_BOOL] = OMPI_OP_BASE_TYPE_BOOL; + ompi_op_ddt_map[OMPI_DATATYPE_FLOAT_INT] = OMPI_OP_BASE_TYPE_FLOAT_INT; + ompi_op_ddt_map[OMPI_DATATYPE_DOUBLE_INT] = OMPI_OP_BASE_TYPE_DOUBLE_INT; + ompi_op_ddt_map[OMPI_DATATYPE_LONG_INT] = OMPI_OP_BASE_TYPE_LONG_INT; + ompi_op_ddt_map[OMPI_DATATYPE_2INT] = OMPI_OP_BASE_TYPE_2INT; + ompi_op_ddt_map[OMPI_DATATYPE_SHORT_INT] = OMPI_OP_BASE_TYPE_SHORT_INT; + ompi_op_ddt_map[OMPI_DATATYPE_INTEGER] = OMPI_OP_BASE_TYPE_INTEGER; + ompi_op_ddt_map[OMPI_DATATYPE_REAL] = OMPI_OP_BASE_TYPE_REAL; + ompi_op_ddt_map[OMPI_DATATYPE_DOUBLE_PRECISION] = OMPI_OP_BASE_TYPE_DOUBLE_PRECISION; + ompi_op_ddt_map[OMPI_DATATYPE_2REAL] = OMPI_OP_BASE_TYPE_2REAL; + ompi_op_ddt_map[OMPI_DATATYPE_2DBLPREC] = OMPI_OP_BASE_TYPE_2DOUBLE_PRECISION; + ompi_op_ddt_map[OMPI_DATATYPE_2INTEGER] = OMPI_OP_BASE_TYPE_2INTEGER; + ompi_op_ddt_map[OMPI_DATATYPE_LONG_DOUBLE_INT] = OMPI_OP_BASE_TYPE_LONG_DOUBLE_INT; + ompi_op_ddt_map[OMPI_DATATYPE_WCHAR] = OMPI_OP_BASE_TYPE_WCHAR; /* Create the intrinsic ops */ diff --git a/ompi/op/op.h b/ompi/op/op.h index d42986b610..9607166a57 100644 --- a/ompi/op/op.h +++ b/ompi/op/op.h @@ -36,7 +36,7 @@ #include "opal/class/opal_object.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/mpi/f77/fint_2_int.h" #include "ompi/mca/op/op.h" @@ -189,7 +189,7 @@ typedef struct ompi_predefined_op_t ompi_predefined_op_t; * extra lookup, and that lookup is way cheaper than the function call * to invoke the reduction operation, it seemed like the best idea. */ -OMPI_DECLSPEC extern int ompi_op_ddt_map[DT_MAX_PREDEFINED]; +OMPI_DECLSPEC extern int ompi_op_ddt_map[OMPI_DATATYPE_MAX_PREDEFINED]; /** * Global variable for MPI_OP_NULL @@ -405,10 +405,10 @@ static inline bool ompi_op_is_valid(ompi_op_t * op, ompi_datatype_t * ddt, */ if (ompi_op_is_intrinsic(op)) { - if (ompi_ddt_is_predefined(ddt)) { + if (ompi_datatype_is_predefined(ddt)) { /* Intrinsic ddt on intrinsic op */ - if (-1 == ompi_op_ddt_map[ddt->id] || - NULL == op->o_func.intrinsic.fns[ompi_op_ddt_map[ddt->id]]) { + if (-1 == ompi_op_ddt_map[ddt->super.id] || + NULL == op->o_func.intrinsic.fns[ompi_op_ddt_map[ddt->super.id]]) { asprintf(msg, "%s: the reduction operation %s is not defined on the %s datatype", func, op->o_name, ddt->name); @@ -495,9 +495,9 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source, /* For intrinsics, we also pass the corresponding op module */ if (0 != (op->o_flags & OMPI_OP_FLAGS_INTRINSIC)) { - op->o_func.intrinsic.fns[ompi_op_ddt_map[dtype->id]](source, target, - &count, &dtype, - op->o_func.intrinsic.modules[ompi_op_ddt_map[dtype->id]]); + op->o_func.intrinsic.fns[ompi_op_ddt_map[dtype->super.id]](source, target, + &count, &dtype, + op->o_func.intrinsic.modules[ompi_op_ddt_map[dtype->super.id]]); } /* User-defined function */ @@ -548,10 +548,10 @@ static inline void ompi_3buff_op_reduce(ompi_op_t * op, void *source1, src2 = source2; tgt = target; - op->o_3buff_intrinsic.fns[ompi_op_ddt_map[dtype->id]](src1, src2, - tgt, &count, - &dtype, - op->o_3buff_intrinsic.modules[ompi_op_ddt_map[dtype->id]]); + op->o_3buff_intrinsic.fns[ompi_op_ddt_map[dtype->super.id]](src1, src2, + tgt, &count, + &dtype, + op->o_3buff_intrinsic.modules[ompi_op_ddt_map[dtype->super.id]]); } END_C_DECLS diff --git a/ompi/proc/proc.c b/ompi/proc/proc.c index 03eab906a9..5469244fa0 100644 --- a/ompi/proc/proc.c +++ b/ompi/proc/proc.c @@ -21,18 +21,20 @@ #include +#include "ompi/constants.h" +#include "opal/datatype/opal_convertor.h" #include "opal/threads/mutex.h" -#include "orte/util/show_help.h" - #include "opal/dss/dss.h" + #include "orte/mca/errmgr/errmgr.h" #include "orte/mca/ess/ess.h" #include "orte/util/proc_info.h" #include "orte/util/name_fns.h" +#include "orte/util/show_help.h" #include "orte/runtime/orte_globals.h" #include "ompi/proc/proc.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/runtime/mpiruntime.h" static opal_list_t ompi_proc_list; @@ -76,7 +78,7 @@ void ompi_proc_destruct(ompi_proc_t* proc) /* As all the convertors are created with OBJ_NEW we can just call OBJ_RELEASE. All, except * the local convertor, will get destroyed at some point here. If the reference count is correct * the local convertor (who has the reference count increased in the datatype) will not get - * destroyed here. It will be destroyed later when the ompi_ddt_finalize is called. + * destroyed here. It will be destroyed later when the ompi_datatype_finalize is called. */ OBJ_RELEASE( proc->proc_convertor ); /* DO NOT FREE THE HOSTNAME FIELD AS THIS POINTS @@ -146,7 +148,7 @@ int ompi_proc_set_arch(void) if (proc->proc_arch != orte_process_info.arch) { #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT OBJ_RELEASE(proc->proc_convertor); - proc->proc_convertor = ompi_convertor_create(proc->proc_arch, 0); + proc->proc_convertor = opal_convertor_create(proc->proc_arch, 0); #else orte_show_help("help-mpi-runtime", "heterogeneous-support-unavailable", @@ -360,7 +362,7 @@ int ompi_proc_refresh(void) { if (proc->proc_arch != orte_process_info.arch) { #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT OBJ_RELEASE(proc->proc_convertor); - proc->proc_convertor = ompi_convertor_create(proc->proc_arch, 0); + proc->proc_convertor = opal_convertor_create(proc->proc_arch, 0); #else orte_show_help("help-mpi-runtime", "heterogeneous-support-unavailable", @@ -529,10 +531,10 @@ ompi_proc_unpack(opal_buffer_t* buf, plist[i]->proc_arch = new_arch; /* if arch is different than mine, create a new convertor for this proc */ - if (plist[i]->proc_arch != ompi_mpi_local_arch) { + if (plist[i]->proc_arch != opal_local_arch) { #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT OBJ_RELEASE(plist[i]->proc_convertor); - plist[i]->proc_convertor = ompi_convertor_create(plist[i]->proc_arch, 0); + plist[i]->proc_convertor = opal_convertor_create(plist[i]->proc_arch, 0); #else orte_show_help("help-mpi-runtime", "heterogeneous-support-unavailable", diff --git a/ompi/proc/proc.h b/ompi/proc/proc.h index b452aa8ab2..32291c9db7 100644 --- a/ompi/proc/proc.h +++ b/ompi/proc/proc.h @@ -65,7 +65,7 @@ struct ompi_proc_t { /** flags for this proc */ uint8_t proc_flags; /** Base convertor for the proc described by this process */ - struct ompi_convertor_t* proc_convertor; + struct opal_convertor_t* proc_convertor; /** A pointer to the name of this host - data is * actually stored in the RTE */ diff --git a/ompi/tools/ompi_info/param.c b/ompi/tools/ompi_info/param.c index e7c8d6d5a9..1ff0f3fa64 100644 --- a/ompi/tools/ompi_info/param.c +++ b/ompi/tools/ompi_info/param.c @@ -613,10 +613,10 @@ void ompi_info_do_config(bool want_all) ompi_info_out_int("C double size", "compiler:c:sizeof:double", sizeof(double)); ompi_info_out_int("C pointer size", "compiler:c:sizeof:pointer", sizeof(void *)); ompi_info_out_int("C char align", "compiler:c:align:char", OPAL_ALIGNMENT_CHAR); - ompi_info_out_int("C bool align", "compiler:c:align:bool", OMPI_ALIGNMENT_CXX_BOOL); + ompi_info_out_int("C bool align", "compiler:c:align:bool", OPAL_ALIGNMENT_CXX_BOOL); ompi_info_out_int("C int align", "compiler:c:align:int", OPAL_ALIGNMENT_INT); - ompi_info_out_int("C float align", "compiler:c:align:float", OMPI_ALIGNMENT_FLOAT); - ompi_info_out_int("C double align", "compiler:c:align:double", OMPI_ALIGNMENT_DOUBLE); + ompi_info_out_int("C float align", "compiler:c:align:float", OPAL_ALIGNMENT_FLOAT); + ompi_info_out_int("C double align", "compiler:c:align:double", OPAL_ALIGNMENT_DOUBLE); } ompi_info_out("C++ compiler", "compiler:cxx:command", OMPI_CXX); diff --git a/opal/Makefile.am b/opal/Makefile.am index 41e2e659d8..eb99ca0ee7 100644 --- a/opal/Makefile.am +++ b/opal/Makefile.am @@ -2,7 +2,7 @@ # Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana # University Research and Technology # Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University +# Copyright (c) 2004-2009 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. # Copyright (c) 2004-2009 High Performance Computing Center Stuttgart, @@ -22,7 +22,8 @@ SUBDIRS = \ include \ $(LIBLTDL_SUBDIR) \ asm \ - etc \ + datatype \ + etc \ event \ util \ mca/base \ @@ -35,7 +36,8 @@ DIST_SUBDIRS = \ include \ libltdl \ asm \ - etc \ + datatype \ + etc \ event \ util \ mca/base \ @@ -49,6 +51,7 @@ libopen_pal_la_SOURCES = libopen_pal_la_LIBADD = \ $(LIBLTDL) \ asm/libasm.la \ + datatype/libdatatype.la \ event/libevent.la \ mca/base/libmca_base.la \ util/libopalutil.la \ diff --git a/opal/datatype/Makefile.am b/opal/datatype/Makefile.am new file mode 100644 index 0000000000..3ca9d13d5d --- /dev/null +++ b/opal/datatype/Makefile.am @@ -0,0 +1,73 @@ +# -*- makefile -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2009 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2007 Los Alamos National Security, LLC. All rights +# reserved. +# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +headers = \ + opal_convertor.h \ + opal_convertor_internal.h \ + opal_datatype_checksum.h \ + opal_datatype.h \ + opal_datatype_internal.h \ + opal_datatype_memcpy.h \ + opal_datatype_pack.h \ + opal_datatype_prototypes.h \ + opal_datatype_unpack.h + + +noinst_LTLIBRARIES = \ + libdatatype_reliable.la \ + libdatatype.la + +# these sources will be compiled with the special -D +libdatatype_reliable_la_SOURCES = opal_datatype_pack.c opal_datatype_unpack.c +libdatatype_reliable_la_CFLAGS = -DCHECKSUM $(AM_CFLAGS) + +# these sources will be compiled with the normal CFLAGS only +libdatatype_la_SOURCES = \ + opal_convertor.c \ + opal_convertor_raw.c \ + opal_copy_functions.c \ + opal_copy_functions_heterogeneous.c \ + opal_datatype_add.c \ + opal_datatype_clone.c \ + opal_datatype_copy.c \ + opal_datatype_create.c \ + opal_datatype_create_contiguous.c \ + opal_datatype_destroy.c \ + opal_datatype_dump.c \ + opal_datatype_fake_stack.c \ + opal_datatype_get_count.c \ + opal_datatype_module.c \ + opal_datatype_optimize.c \ + opal_datatype_pack.c \ + opal_datatype_position.c \ + opal_datatype_resize.c \ + opal_datatype_unpack.c + +libdatatype_la_LIBADD = libdatatype_reliable.la + +# Conditionally install the header files +if WANT_INSTALL_HEADERS +opaldir = $(includedir)/openmpi/opal/datatype +opal_HEADERS = $(headers) +else +opaldir = $(includedir) +endif diff --git a/ompi/datatype/convertor.c b/opal/datatype/opal_convertor.c similarity index 64% rename from ompi/datatype/convertor.c rename to opal/datatype/opal_convertor.c index cb2ec51f7c..477f2f80c7 100644 --- a/ompi/datatype/convertor.c +++ b/opal/datatype/opal_convertor.c @@ -3,14 +3,14 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008 UT-Battelle, LLC + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -18,63 +18,65 @@ * $HEADER$ */ -#include "ompi_config.h" +#include "opal_config.h" + +#include #include -#ifdef HAVE_STRINGS_H -#include +#ifdef HAVE_STDINT_H +#include #endif -#include #include "opal/prefetch.h" #include "opal/util/arch.h" +#include "opal/util/output.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype_internal.h" -#include "ompi/datatype/datatype_checksum.h" -#include "ompi/datatype/datatype_prototypes.h" -#include "ompi/datatype/convertor_internal.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_checksum.h" +#include "opal/datatype/opal_datatype_prototypes.h" +#include "opal/datatype/opal_convertor_internal.h" -extern size_t ompi_ddt_local_sizes[DT_MAX_PREDEFINED]; -extern int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* convertor, +extern int opal_convertor_create_stack_with_pos_general( opal_convertor_t* convertor, int starting_point, const int* sizes ); -static void ompi_convertor_construct( ompi_convertor_t* convertor ) +static void opal_convertor_construct( opal_convertor_t* convertor ) { convertor->pStack = convertor->static_stack; convertor->stack_size = DT_STATIC_STACK_SIZE; convertor->partial_length = 0; - convertor->remoteArch = ompi_mpi_local_arch; - convertor->flags = DT_FLAG_NO_GAPS | CONVERTOR_COMPLETED; + convertor->remoteArch = opal_local_arch; + convertor->flags = OPAL_DATATYPE_FLAG_NO_GAPS | CONVERTOR_COMPLETED; } -static void ompi_convertor_destruct( ompi_convertor_t* convertor ) + +static void opal_convertor_destruct( opal_convertor_t* convertor ) { - ompi_convertor_cleanup( convertor ); + opal_convertor_cleanup( convertor ); } -OBJ_CLASS_INSTANCE(ompi_convertor_t, opal_object_t, ompi_convertor_construct, ompi_convertor_destruct ); +OBJ_CLASS_INSTANCE(opal_convertor_t, opal_object_t, opal_convertor_construct, opal_convertor_destruct ); -static ompi_convertor_master_t* ompi_convertor_master_list = NULL; +static opal_convertor_master_t* opal_convertor_master_list = NULL; -extern conversion_fct_t ompi_ddt_heterogeneous_copy_functions[DT_MAX_PREDEFINED]; -extern conversion_fct_t ompi_ddt_copy_functions[DT_MAX_PREDEFINED]; +extern conversion_fct_t opal_datatype_heterogeneous_copy_functions[OPAL_DATATYPE_MAX_PREDEFINED]; +extern conversion_fct_t opal_datatype_copy_functions[OPAL_DATATYPE_MAX_PREDEFINED]; -void ompi_convertor_destroy_masters( void ) +void opal_convertor_destroy_masters( void ) { - ompi_convertor_master_t* master = ompi_convertor_master_list; + opal_convertor_master_t* master = opal_convertor_master_list; while( NULL != master ) { - ompi_convertor_master_list = master->next; + opal_convertor_master_list = master->next; master->next = NULL; /* Cleanup the conversion function if not one of the defaults */ - if( (master->pFunctions != ompi_ddt_heterogeneous_copy_functions) && - (master->pFunctions != ompi_ddt_copy_functions) ) + if( (master->pFunctions != opal_datatype_heterogeneous_copy_functions) && + (master->pFunctions != opal_datatype_copy_functions) ) free( master->pFunctions ); free( master ); - master = ompi_convertor_master_list; + master = opal_convertor_master_list; } } @@ -83,10 +85,9 @@ void ompi_convertor_destroy_masters( void ) * is already a master convertor for this architecture then return it. * Otherwise, create and initialize a full featured master convertor. */ -ompi_convertor_master_t* -ompi_convertor_find_or_create_master( uint32_t remote_arch ) +opal_convertor_master_t* opal_convertor_find_or_create_master( uint32_t remote_arch ) { - ompi_convertor_master_t* master = ompi_convertor_master_list; + opal_convertor_master_t* master = opal_convertor_master_list; int i; size_t* remote_sizes; @@ -95,116 +96,89 @@ ompi_convertor_find_or_create_master( uint32_t remote_arch ) return master; master = master->next; } - /* Create a new convertor matching the specified architecture and add it to the + /** + * Create a new convertor matching the specified architecture and add it to the * master convertor list. */ - master = (ompi_convertor_master_t*)malloc( sizeof(ompi_convertor_master_t) ); - master->next = ompi_convertor_master_list; - ompi_convertor_master_list = master; + master = (opal_convertor_master_t*)malloc( sizeof(opal_convertor_master_t) ); + master->next = opal_convertor_master_list; + opal_convertor_master_list = master; master->remote_arch = remote_arch; master->flags = 0; master->hetero_mask = 0; - /* Most of the sizes will be identical, so for now just make a copy of + /** + * Most of the sizes will be identical, so for now just make a copy of * the local ones. As master->remote_sizes is defined as being an array of * consts we have to manually cast it before using it for writing purposes. */ remote_sizes = (size_t*)master->remote_sizes; - memcpy(remote_sizes, ompi_ddt_local_sizes, sizeof(size_t) * DT_MAX_PREDEFINED); + memcpy(remote_sizes, opal_datatype_local_sizes, sizeof(size_t) * OPAL_DATATYPE_MAX_PREDEFINED); /** * If the local and remote architecture are the same there is no need * to check for the remote data sizes. They will always be the same as * the local ones. */ - if( master->remote_arch == ompi_mpi_local_arch ) { - master->pFunctions = ompi_ddt_copy_functions; + if( master->remote_arch == opal_local_arch ) { + master->pFunctions = opal_datatype_copy_functions; master->flags |= CONVERTOR_HOMOGENEOUS; return master; } /* Find out the remote bool size */ if( opal_arch_checkmask( &master->remote_arch, OPAL_ARCH_BOOLIS8 ) ) { - remote_sizes[DT_CXX_BOOL] = 1; + remote_sizes[OPAL_DATATYPE_BOOL] = 1; } else if( opal_arch_checkmask( &master->remote_arch, OPAL_ARCH_BOOLIS16 ) ) { - remote_sizes[DT_CXX_BOOL] = 2; + remote_sizes[OPAL_DATATYPE_BOOL] = 2; } else if( opal_arch_checkmask( &master->remote_arch, OPAL_ARCH_BOOLIS32 ) ) { - remote_sizes[DT_CXX_BOOL] = 4; + remote_sizes[OPAL_DATATYPE_BOOL] = 4; } else { opal_output( 0, "Unknown sizeof(bool) for the remote architecture\n" ); } - /* check the length of the long */ - if( opal_arch_checkmask( &master->remote_arch, OPAL_ARCH_LONGIS64 ) ) { - remote_sizes[DT_LONG] = 8; - remote_sizes[DT_UNSIGNED_LONG] = 8; - remote_sizes[DT_LONG_LONG_INT] = 8; - remote_sizes[DT_UNSIGNED_LONG_LONG] = 8; - } else { - remote_sizes[DT_LONG] = 4; - remote_sizes[DT_UNSIGNED_LONG] = 4; - remote_sizes[DT_LONG_LONG_INT] = 4; - remote_sizes[DT_UNSIGNED_LONG_LONG] = 4; - } - /* find out the remote logical size. It can happens that the size will be - * unknown (if Fortran is not supported on the remote library). If this is - * the case, just let the remote logical size to match the local size. - */ - if( opal_arch_checkmask( &master->remote_arch, OPAL_ARCH_LOGICALIS8 ) ) { - remote_sizes[DT_LOGIC] = 1; - } else if( opal_arch_checkmask( &master->remote_arch, OPAL_ARCH_LOGICALIS16 ) ) { - remote_sizes[DT_LOGIC] = 2; - } else if( opal_arch_checkmask( &master->remote_arch, OPAL_ARCH_LOGICALIS32 ) ) { - remote_sizes[DT_LOGIC] = 4; - } else { - opal_output( 0, "Unknown sizeof(fortran logical) for the remote architecture\n" ); - } - /* check the size for the doubles */ - if( opal_arch_checkmask( &master->remote_arch, OPAL_ARCH_LONGDOUBLEIS128 ) ) { - remote_sizes[DT_LONG_DOUBLE] = 16; - } else { - remote_sizes[DT_LONG_DOUBLE] = 8; - } /** * Now we can compute the conversion mask. For all sizes where the remote * and local architecture differ a conversion is needed. Moreover, if the * 2 architectures don't have the same endianess all data with a length * over 2 bytes (with the exception of logicals) have to be byte-swapped. */ - for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) { - if( remote_sizes[i] != ompi_ddt_local_sizes[i] ) - master->hetero_mask |= (((uint64_t)1) << i); + for( i = OPAL_DATATYPE_FIRST_TYPE; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) { + if( remote_sizes[i] != opal_datatype_local_sizes[i] ) + master->hetero_mask |= (((uint32_t)1) << i); } if( opal_arch_checkmask( &master->remote_arch, OPAL_ARCH_ISBIGENDIAN ) != - opal_arch_checkmask( &ompi_mpi_local_arch, OPAL_ARCH_ISBIGENDIAN ) ) { - uint64_t hetero_mask = 0; + opal_arch_checkmask( &opal_local_arch, OPAL_ARCH_ISBIGENDIAN ) ) { + uint32_t hetero_mask = 0; - for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) { + for( i = OPAL_DATATYPE_FIRST_TYPE; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) { if( remote_sizes[i] > 1 ) - hetero_mask |= (((uint64_t)1) << i); + hetero_mask |= (((uint32_t)1) << i); } - hetero_mask &= ~((((uint64_t)1) << DT_LOGIC) | (((uint64_t)1) << DT_CXX_BOOL)); + hetero_mask &= ~(((uint32_t)1) << OPAL_DATATYPE_BOOL); master->hetero_mask |= hetero_mask; } - master->pFunctions = (conversion_fct_t*)malloc( sizeof(ompi_ddt_heterogeneous_copy_functions) ); + master->pFunctions = (conversion_fct_t*)malloc( sizeof(opal_datatype_heterogeneous_copy_functions) ); /** * Usually the heterogeneous functions are slower than the copy ones. Let's * try to minimize the usage of the heterogeneous versions. */ - for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) { - if( master->hetero_mask & (((uint64_t)1) << i) ) - master->pFunctions[i] = ompi_ddt_heterogeneous_copy_functions[i]; + for( i = OPAL_DATATYPE_FIRST_TYPE; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) { + if( master->hetero_mask & (((uint32_t)1) << i) ) + master->pFunctions[i] = opal_datatype_heterogeneous_copy_functions[i]; else - master->pFunctions[i] = ompi_ddt_copy_functions[i]; + master->pFunctions[i] = opal_datatype_copy_functions[i]; } + /* We're done so far, return the mater convertor */ return master; } -ompi_convertor_t* ompi_convertor_create( int32_t remote_arch, int32_t mode ) -{ - ompi_convertor_t* convertor = OBJ_NEW(ompi_convertor_t); - ompi_convertor_master_t* master; - master = ompi_convertor_find_or_create_master( remote_arch ); +opal_convertor_t* opal_convertor_create( int32_t remote_arch, int32_t mode ) +{ + opal_convertor_t* convertor = OBJ_NEW(opal_convertor_t); + opal_convertor_master_t* master; + + master = opal_convertor_find_or_create_master( remote_arch ); convertor->remoteArch = remote_arch; convertor->stack_pos = 0; @@ -214,7 +188,7 @@ ompi_convertor_t* ompi_convertor_create( int32_t remote_arch, int32_t mode ) return convertor; } -#define OMPI_CONVERTOR_SET_STATUS_BEFORE_PACK_UNPACK( CONVERTOR, IOV, OUT, MAX_DATA ) \ +#define OPAL_CONVERTOR_SET_STATUS_BEFORE_PACK_UNPACK( CONVERTOR, IOV, OUT, MAX_DATA ) \ do { \ /* protect against over packing data */ \ if( OPAL_UNLIKELY((CONVERTOR)->flags & CONVERTOR_COMPLETED) ) { \ @@ -229,20 +203,21 @@ ompi_convertor_t* ompi_convertor_create( int32_t remote_arch, int32_t mode ) assert( (CONVERTOR)->bConverted < (CONVERTOR)->local_size ); \ } while(0) -/* +/** * Return 0 if everything went OK and if there is still room before the complete * conversion of the data (need additional call with others input buffers ) * 1 if everything went fine and the data was completly converted * -1 something wrong occurs. */ -int32_t ompi_convertor_pack( ompi_convertor_t* pConv, +int32_t opal_convertor_pack( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ) { - OMPI_CONVERTOR_SET_STATUS_BEFORE_PACK_UNPACK( pConv, iov, out_size, max_data ); + OPAL_CONVERTOR_SET_STATUS_BEFORE_PACK_UNPACK( pConv, iov, out_size, max_data ); if( OPAL_LIKELY(pConv->flags & CONVERTOR_NO_OP) ) { - /* We are doing conversion on a contiguous datatype on a homogeneous + /** + * We are doing conversion on a contiguous datatype on a homogeneous * environment. The convertor contain minimal informations, we only * use the bConverted to manage the conversion. */ @@ -251,7 +226,7 @@ int32_t ompi_convertor_pack( ompi_convertor_t* pConv, size_t pending_length = pConv->local_size - pConv->bConverted; *max_data = pending_length; - ompi_convertor_get_current_pointer( pConv, (void**)&base_pointer ); + opal_convertor_get_current_pointer( pConv, (void**)&base_pointer ); for( i = 0; i < *out_size; i++ ) { if( iov[i].iov_len >= pending_length ) { @@ -267,7 +242,8 @@ int32_t ompi_convertor_pack( ompi_convertor_t* pConv, *max_data -= pending_length; pConv->bConverted += (*max_data); return 0; - complete_contiguous_data_pack: + +complete_contiguous_data_pack: iov[i].iov_len = pending_length; if( OPAL_LIKELY(NULL == iov[i].iov_base) ) iov[i].iov_base = (IOVBASE_TYPE *) base_pointer; @@ -282,14 +258,16 @@ int32_t ompi_convertor_pack( ompi_convertor_t* pConv, return pConv->fAdvance( pConv, iov, out_size, max_data ); } -int32_t ompi_convertor_unpack( ompi_convertor_t* pConv, + +int32_t opal_convertor_unpack( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ) { - OMPI_CONVERTOR_SET_STATUS_BEFORE_PACK_UNPACK( pConv, iov, out_size, max_data ); + OPAL_CONVERTOR_SET_STATUS_BEFORE_PACK_UNPACK( pConv, iov, out_size, max_data ); if( OPAL_LIKELY(pConv->flags & CONVERTOR_NO_OP) ) { - /* We are doing conversion on a contiguous datatype on a homogeneous + /** + * We are doing conversion on a contiguous datatype on a homogeneous * environment. The convertor contain minimal informations, we only * use the bConverted to manage the conversion. */ @@ -298,7 +276,7 @@ int32_t ompi_convertor_unpack( ompi_convertor_t* pConv, size_t pending_length = pConv->local_size - pConv->bConverted; *max_data = pending_length; - ompi_convertor_get_current_pointer( pConv, (void**)&base_pointer ); + opal_convertor_get_current_pointer( pConv, (void**)&base_pointer ); for( i = 0; i < *out_size; i++ ) { if( iov[i].iov_len >= pending_length ) { @@ -311,7 +289,8 @@ int32_t ompi_convertor_unpack( ompi_convertor_t* pConv, *max_data -= pending_length; pConv->bConverted += (*max_data); return 0; - complete_contiguous_data_unpack: + +complete_contiguous_data_unpack: iov[i].iov_len = pending_length; MEMCPY( base_pointer, iov[i].iov_base, iov[i].iov_len ); pConv->bConverted = pConv->local_size; @@ -323,18 +302,18 @@ int32_t ompi_convertor_unpack( ompi_convertor_t* pConv, return pConv->fAdvance( pConv, iov, out_size, max_data ); } -static inline -int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor, - size_t starting_point, const size_t* sizes ) +static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t* pConvertor, + size_t starting_point, const size_t* sizes ) { dt_stack_t* pStack; /* pointer to the position on the stack */ - const ompi_datatype_t* pData = pConvertor->pDesc; + const opal_datatype_t* pData = pConvertor->pDesc; dt_elem_desc_t* pElems; uint32_t count; - ptrdiff_t extent; + OPAL_PTRDIFF_TYPE extent; pStack = pConvertor->pStack; - /* The prepare function already make the selection on which data representation + /** + * The prepare function already make the selection on which data representation * we have to use: normal one or the optimized version ? */ pElems = pConvertor->use_desc->desc; @@ -342,14 +321,15 @@ int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor, count = (uint32_t)(starting_point / pData->size); extent = pData->ub - pData->lb; - pStack[0].type = DT_LOOP; /* the first one is always the loop */ + pStack[0].type = OPAL_DATATYPE_LOOP; /* the first one is always the loop */ pStack[0].count = pConvertor->count - count; pStack[0].index = -1; pStack[0].disp = count * extent; /* now compute the number of pending bytes */ count = (uint32_t)(starting_point - count * pData->size); - /* we save the current displacement starting from the begining + /** + * We save the current displacement starting from the begining * of this data. */ if( OPAL_LIKELY(0 == count) ) { @@ -357,7 +337,7 @@ int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor, pStack[1].count = pElems->elem.count; pStack[1].disp = pElems->elem.disp; } else { - pStack[1].type = DT_BYTE; + pStack[1].type = OPAL_DATATYPE_UINT1; pStack[1].count = pData->size - count; pStack[1].disp = pData->true_lb + count; } @@ -366,17 +346,18 @@ int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor, pConvertor->bConverted = starting_point; pConvertor->stack_pos = 1; assert( 0 == pConvertor->partial_length ); - return OMPI_SUCCESS; + return OPAL_SUCCESS; } static inline -int ompi_convertor_create_stack_at_begining( ompi_convertor_t* convertor, +int opal_convertor_create_stack_at_begining( opal_convertor_t* convertor, const size_t* sizes ) { dt_stack_t* pStack = convertor->pStack; dt_elem_desc_t* pElems; - /* The prepare function already make the selection on which data representation + /** + * The prepare function already make the selection on which data representation * we have to use: normal one or the optimized version ? */ pElems = convertor->use_desc->desc; @@ -384,8 +365,9 @@ int ompi_convertor_create_stack_at_begining( ompi_convertor_t* convertor, convertor->stack_pos = 1; convertor->partial_length = 0; convertor->bConverted = 0; - /* Fill the first position on the stack. This one correspond to the - * last fake DT_END_LOOP that we add to the data representation and + /** + * Fill the first position on the stack. This one correspond to the + * last fake OPAL_DATATYPE_END_LOOP that we add to the data representation and * allow us to move quickly inside the datatype when we have a count. */ pStack[0].index = -1; @@ -394,54 +376,56 @@ int ompi_convertor_create_stack_at_begining( ompi_convertor_t* convertor, pStack[1].index = 0; pStack[1].disp = 0; - if( pElems[0].elem.common.type == DT_LOOP ) { + if( pElems[0].elem.common.type == OPAL_DATATYPE_LOOP ) { pStack[1].count = pElems[0].loop.loops; } else { pStack[1].count = pElems[0].elem.count; } - return OMPI_SUCCESS; + return OPAL_SUCCESS; } -int32_t ompi_convertor_set_position_nocheck( ompi_convertor_t* convertor, + +int32_t opal_convertor_set_position_nocheck( opal_convertor_t* convertor, size_t* position ) { int32_t rc; - /* + /** * If we plan to rollback the convertor then first we have to set it * at the beginning. */ if( (0 == (*position)) || ((*position) < convertor->bConverted) ) { - rc = ompi_convertor_create_stack_at_begining( convertor, ompi_ddt_local_sizes ); + rc = opal_convertor_create_stack_at_begining( convertor, opal_datatype_local_sizes ); if( 0 == (*position) ) return rc; } - if( OPAL_LIKELY(convertor->flags & DT_FLAG_CONTIGUOUS) ) { - rc = ompi_convertor_create_stack_with_pos_contig( convertor, (*position), - ompi_ddt_local_sizes ); + if( OPAL_LIKELY(convertor->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) ) { + rc = opal_convertor_create_stack_with_pos_contig( convertor, (*position), + opal_datatype_local_sizes ); } else { - rc = ompi_convertor_generic_simple_position( convertor, position ); + rc = opal_convertor_generic_simple_position( convertor, position ); } *position = convertor->bConverted; return rc; } + /** * Compute the remote size. */ -#define OMPI_CONVERTOR_COMPUTE_REMOTE_SIZE(convertor, datatype, bdt_mask) \ +#define OPAL_CONVERTOR_COMPUTE_REMOTE_SIZE(convertor, datatype, bdt_mask) \ { \ if( OPAL_UNLIKELY(0 != bdt_mask) ) { \ - ompi_convertor_master_t* master; \ + opal_convertor_master_t* master; \ int i; \ - uint64_t mask = datatype->bdt_used; \ + uint32_t mask = datatype->bdt_used; \ convertor->flags ^= CONVERTOR_HOMOGENEOUS; \ master = convertor->master; \ convertor->remote_size = 0; \ - for( i = DT_CHAR; mask && (i < DT_MAX_PREDEFINED); i++ ) { \ - if( mask & ((uint64_t)1 << i) ) { \ + for( i = OPAL_DATATYPE_FIRST_TYPE; mask && (i < OPAL_DATATYPE_MAX_PREDEFINED); i++ ) { \ + if( mask & ((uint32_t)1 << i) ) { \ convertor->remote_size += (datatype->btypes[i] * \ master->remote_sizes[i]); \ - mask ^= ((uint64_t)1 << i); \ + mask ^= ((uint32_t)1 << i); \ } \ } \ convertor->remote_size *= convertor->count; \ @@ -456,20 +440,19 @@ int32_t ompi_convertor_set_position_nocheck( ompi_convertor_t* convertor, * here that the convertor is clean, either never initialized or already * cleaned. */ -#define OMPI_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ) \ +#define OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ) \ { \ - uint64_t bdt_mask; \ + uint32_t bdt_mask; \ \ /* If the data is empty we just mark the convertor as \ * completed. With this flag set the pack and unpack functions \ * will not do anything. \ */ \ if( OPAL_UNLIKELY((0 == count) || (0 == datatype->size)) ) { \ - convertor->flags |= DT_FLAG_NO_GAPS | CONVERTOR_COMPLETED; \ + convertor->flags |= OPAL_DATATYPE_FLAG_NO_GAPS | CONVERTOR_COMPLETED; \ convertor->local_size = convertor->remote_size = 0; \ - return OMPI_SUCCESS; \ + return OPAL_SUCCESS; \ } \ - bdt_mask = datatype->bdt_used & convertor->master->hetero_mask; \ /* Compute the local in advance */ \ convertor->local_size = count * datatype->size; \ convertor->pBaseBuf = (unsigned char*)pUserBuf; \ @@ -479,35 +462,36 @@ int32_t ompi_convertor_set_position_nocheck( ompi_convertor_t* convertor, convertor->flags &= CONVERTOR_TYPE_MASK; \ convertor->flags |= (CONVERTOR_DATATYPE_MASK & datatype->flags); \ convertor->flags |= (CONVERTOR_NO_OP | CONVERTOR_HOMOGENEOUS); \ - convertor->pDesc = (ompi_datatype_t*)datatype; \ + convertor->pDesc = (opal_datatype_t*)datatype; \ convertor->bConverted = 0; \ /* By default consider the optimized description */ \ convertor->use_desc = &(datatype->opt_desc); \ \ convertor->remote_size = convertor->local_size; \ - if( OPAL_LIKELY(convertor->remoteArch == ompi_mpi_local_arch) ) { \ - if( (convertor->flags & (CONVERTOR_WITH_CHECKSUM | DT_FLAG_NO_GAPS)) == DT_FLAG_NO_GAPS ) { \ - return OMPI_SUCCESS; \ + if( OPAL_LIKELY(convertor->remoteArch == opal_local_arch) ) { \ + if( (convertor->flags & (CONVERTOR_WITH_CHECKSUM | OPAL_DATATYPE_FLAG_NO_GAPS)) == OPAL_DATATYPE_FLAG_NO_GAPS ) { \ + return OPAL_SUCCESS; \ } \ - if( ((convertor->flags & (CONVERTOR_WITH_CHECKSUM | DT_FLAG_CONTIGUOUS)) \ - == DT_FLAG_CONTIGUOUS) && (1 == count) ) { \ - return OMPI_SUCCESS; \ + if( ((convertor->flags & (CONVERTOR_WITH_CHECKSUM | OPAL_DATATYPE_FLAG_CONTIGUOUS)) \ + == OPAL_DATATYPE_FLAG_CONTIGUOUS) && (1 == count) ) { \ + return OPAL_SUCCESS; \ } \ } \ \ - OMPI_CONVERTOR_COMPUTE_REMOTE_SIZE( convertor, datatype, \ + bdt_mask = datatype->bdt_used & convertor->master->hetero_mask; \ + OPAL_CONVERTOR_COMPUTE_REMOTE_SIZE( convertor, datatype, \ bdt_mask ); \ assert( NULL != convertor->use_desc->desc ); \ /* For predefined datatypes (contiguous) do nothing more */ \ /* if checksum is enabled then always continue */ \ - if( ((convertor->flags & (CONVERTOR_WITH_CHECKSUM | DT_FLAG_NO_GAPS)) \ - == DT_FLAG_NO_GAPS) && \ + if( ((convertor->flags & (CONVERTOR_WITH_CHECKSUM | OPAL_DATATYPE_FLAG_NO_GAPS)) \ + == OPAL_DATATYPE_FLAG_NO_GAPS) && \ (convertor->flags & (CONVERTOR_SEND | CONVERTOR_HOMOGENEOUS)) ) { \ - return OMPI_SUCCESS; \ + return OPAL_SUCCESS; \ } \ convertor->flags &= ~CONVERTOR_NO_OP; \ { \ - uint32_t required_stack_length = datatype->btypes[DT_LOOP] + 1; \ + uint32_t required_stack_length = datatype->btypes[OPAL_DATATYPE_LOOP] + 1; \ \ if( required_stack_length > convertor->stack_size ) { \ convertor->stack_size = required_stack_length; \ @@ -518,79 +502,79 @@ int32_t ompi_convertor_set_position_nocheck( ompi_convertor_t* convertor, convertor->stack_size = DT_STATIC_STACK_SIZE; \ } \ } \ - ompi_convertor_create_stack_at_begining( convertor, ompi_ddt_local_sizes ); \ + opal_convertor_create_stack_at_begining( convertor, opal_datatype_local_sizes ); \ } -int32_t -ompi_convertor_prepare_for_recv( ompi_convertor_t* convertor, - const struct ompi_datatype_t* datatype, - int32_t count, - const void* pUserBuf ) + +int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor, + const struct opal_datatype_t* datatype, + int32_t count, + const void* pUserBuf ) { /* Here I should check that the data is not overlapping */ convertor->flags |= CONVERTOR_RECV; - OMPI_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ); + OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ); if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) { #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) { - convertor->fAdvance = ompi_unpack_general_checksum; + convertor->fAdvance = opal_unpack_general_checksum; } else #endif - if( convertor->pDesc->flags & DT_FLAG_CONTIGUOUS ) { - convertor->fAdvance = ompi_unpack_homogeneous_contig_checksum; + if( convertor->pDesc->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { + convertor->fAdvance = opal_unpack_homogeneous_contig_checksum; } else { - convertor->fAdvance = ompi_generic_simple_unpack_checksum; + convertor->fAdvance = opal_generic_simple_unpack_checksum; } } else { #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) { - convertor->fAdvance = ompi_unpack_general; + convertor->fAdvance = opal_unpack_general; } else #endif - if( convertor->pDesc->flags & DT_FLAG_CONTIGUOUS ) { - convertor->fAdvance = ompi_unpack_homogeneous_contig; + if( convertor->pDesc->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { + convertor->fAdvance = opal_unpack_homogeneous_contig; } else { - convertor->fAdvance = ompi_generic_simple_unpack; + convertor->fAdvance = opal_generic_simple_unpack; } } - return OMPI_SUCCESS; + return OPAL_SUCCESS; } -int32_t -ompi_convertor_prepare_for_send( ompi_convertor_t* convertor, - const struct ompi_datatype_t* datatype, - int32_t count, - const void* pUserBuf ) + +int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor, + const struct opal_datatype_t* datatype, + int32_t count, + const void* pUserBuf ) { convertor->flags |= CONVERTOR_SEND; - OMPI_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ); + OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ); if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) { - if( datatype->flags & DT_FLAG_CONTIGUOUS ) { - if( ((datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size) + if( datatype->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { + if( ((datatype->ub - datatype->lb) == (OPAL_PTRDIFF_TYPE)datatype->size) || (1 >= convertor->count) ) - convertor->fAdvance = ompi_pack_homogeneous_contig_checksum; + convertor->fAdvance = opal_pack_homogeneous_contig_checksum; else - convertor->fAdvance = ompi_pack_homogeneous_contig_with_gaps_checksum; + convertor->fAdvance = opal_pack_homogeneous_contig_with_gaps_checksum; } else { - convertor->fAdvance = ompi_generic_simple_pack_checksum; + convertor->fAdvance = opal_generic_simple_pack_checksum; } } else { - if( datatype->flags & DT_FLAG_CONTIGUOUS ) { - if( ((datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size) + if( datatype->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { + if( ((datatype->ub - datatype->lb) == (OPAL_PTRDIFF_TYPE)datatype->size) || (1 >= convertor->count) ) - convertor->fAdvance = ompi_pack_homogeneous_contig; + convertor->fAdvance = opal_pack_homogeneous_contig; else - convertor->fAdvance = ompi_pack_homogeneous_contig_with_gaps; + convertor->fAdvance = opal_pack_homogeneous_contig_with_gaps; } else { - convertor->fAdvance = ompi_generic_simple_pack; + convertor->fAdvance = opal_generic_simple_pack; } } - return OMPI_SUCCESS; + return OPAL_SUCCESS; } /* @@ -601,10 +585,10 @@ ompi_convertor_prepare_for_send( ompi_convertor_t* convertor, * stack is created with the correct number of entries but if the copy_stack is true (!= 0) * then the content of the old stack is copied on the new one. The result will be a convertor * ready to use starting from the old position. If copy_stack is false then the convertor - * is created with a empty stack (you have to use ompi_convertor_set_position before using it). + * is created with a empty stack (you have to use opal_convertor_set_position before using it). */ -int ompi_convertor_clone( const ompi_convertor_t* source, - ompi_convertor_t* destination, +int opal_convertor_clone( const opal_convertor_t* source, + opal_convertor_t* destination, int32_t copy_stack ) { destination->remoteArch = source->remoteArch; @@ -634,24 +618,26 @@ int ompi_convertor_clone( const ompi_convertor_t* source, destination->bConverted = source->bConverted; destination->stack_pos = source->stack_pos; } - return OMPI_SUCCESS; + return OPAL_SUCCESS; } -void ompi_convertor_dump( ompi_convertor_t* convertor ) + +void opal_convertor_dump( opal_convertor_t* convertor ) { printf( "Convertor %p count %d stack position %d bConverted %ld\n", (void*)convertor, convertor->count, convertor->stack_pos, (unsigned long)convertor->bConverted ); printf( "\tlocal_size %ld remote_size %ld flags %X stack_size %d pending_length %d\n", (unsigned long)convertor->local_size, (unsigned long)convertor->remote_size, convertor->flags, convertor->stack_size, convertor->partial_length ); - ompi_ddt_dump( convertor->pDesc ); + opal_datatype_dump( convertor->pDesc ); printf( "Actual stack representation\n" ); - ompi_ddt_dump_stack( convertor->pStack, convertor->stack_pos, - convertor->pDesc->desc.desc, convertor->pDesc->name ); + opal_datatype_dump_stack( convertor->pStack, convertor->stack_pos, + convertor->pDesc->desc.desc, convertor->pDesc->name ); } -void ompi_ddt_dump_stack( const dt_stack_t* pStack, int stack_pos, - const union dt_elem_desc* pDesc, const char* name ) + +void opal_datatype_dump_stack( const dt_stack_t* pStack, int stack_pos, + const union dt_elem_desc* pDesc, const char* name ) { opal_output( 0, "\nStack %p stack_pos %d name %s\n", (void*)pStack, stack_pos, name ); for( ; stack_pos >= 0; stack_pos-- ) { diff --git a/opal/datatype/opal_convertor.h b/opal/datatype/opal_convertor.h new file mode 100644 index 0000000000..486dc6c910 --- /dev/null +++ b/opal/datatype/opal_convertor.h @@ -0,0 +1,364 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef OPAL_CONVERTOR_H_HAS_BEEN_INCLUDED +#define OPAL_CONVERTOR_H_HAS_BEEN_INCLUDED + +#include "opal_config.h" + +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_UIO_H +#include +#endif +#ifdef HAVE_NET_UIO_H +#include +#endif + +#include "opal/constants.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/prefetch.h" + +BEGIN_C_DECLS +/* + * CONVERTOR SECTION + */ +/* keep the last 16 bits free for data flags */ +#define CONVERTOR_DATATYPE_MASK 0x0000FFFF +#define CONVERTOR_SEND_CONVERSION 0x00010000 +#define CONVERTOR_RECV 0x00020000 +#define CONVERTOR_SEND 0x00040000 +#define CONVERTOR_HOMOGENEOUS 0x00080000 +#define CONVERTOR_NO_OP 0x00100000 +#define CONVERTOR_WITH_CHECKSUM 0x00200000 +#define CONVERTOR_TYPE_MASK 0x00FF0000 +#define CONVERTOR_STATE_START 0x01000000 +#define CONVERTOR_STATE_COMPLETE 0x02000000 +#define CONVERTOR_STATE_ALLOC 0x04000000 +#define CONVERTOR_COMPLETED 0x08000000 + +union dt_elem_desc; +typedef struct opal_convertor_t opal_convertor_t; + +typedef int32_t (*convertor_advance_fct_t)( opal_convertor_t* pConvertor, + struct iovec* iov, + uint32_t* out_size, + size_t* max_data ); +typedef void*(*memalloc_fct_t)( size_t* pLength, void* userdata ); + +/* The master convertor struct (defined in convertor_internal.h) */ +struct opal_convertor_master_t; + +struct dt_stack_t { + int32_t index; /**< index in the element description */ + int16_t type; /**< the type used for the last pack/unpack (original or OPAL_DATATYPE_UINT1) */ + size_t count; /**< number of times we still have to do it */ + OPAL_PTRDIFF_TYPE disp; /**< actual displacement depending on the count field */ +}; +typedef struct dt_stack_t dt_stack_t; + +/** + * + */ +#define DT_STATIC_STACK_SIZE 5 /**< This should be sufficient for most applications */ + +struct opal_convertor_t { + opal_object_t super; /**< basic superclass */ + uint32_t remoteArch; /**< the remote architecture */ + uint32_t flags; /**< the properties of this convertor */ + size_t local_size; /**< overall length data on local machine, compared to bConverted */ + size_t remote_size; /**< overall length data on remote machine, compared to bConverted */ + const opal_datatype_t* pDesc; /**< the datatype description associated with the convertor */ + const dt_type_desc_t* use_desc; /**< the version used by the convertor (normal or optimized) */ + opal_datatype_count_t count; /**< the total number of full datatype elements */ + uint32_t stack_size; /**< size of the allocated stack */ + /* --- cacheline 1 boundary (64 bytes) --- */ + unsigned char* pBaseBuf; /**< initial buffer as supplied by the user */ + dt_stack_t* pStack; /**< the local stack for the actual conversion */ + convertor_advance_fct_t fAdvance; /**< pointer to the pack/unpack functions */ + struct opal_convertor_master_t* master; /**< the master convertor */ + + /* All others fields get modified for every call to pack/unpack functions */ + uint32_t stack_pos; /**< the actual position on the stack */ + uint32_t partial_length; /**< amount of data left over from the last unpack */ + size_t bConverted; /**< # of bytes already converted */ + uint32_t checksum; /**< checksum computed by pack/unpack operation */ + uint32_t csum_ui1; /**< partial checksum computed by pack/unpack operation */ + size_t csum_ui2; /**< partial checksum computed by pack/unpack operation */ + /* --- cacheline 2 boundary (128 bytes) --- */ + dt_stack_t static_stack[DT_STATIC_STACK_SIZE]; /**< local stack for small datatypes */ + /* --- cacheline 3 boundary (192 bytes) was 56 bytes ago --- */ + + /* size: 248, cachelines: 4, members: 20 */ + /* last cacheline: 56 bytes */ +}; +OPAL_DECLSPEC OBJ_CLASS_DECLARATION( opal_convertor_t ); + + +/* + * + */ +static inline uint32_t opal_convertor_get_checksum( opal_convertor_t* convertor ) +{ + return convertor->checksum; +} + + +/* + * + */ +OPAL_DECLSPEC int32_t opal_convertor_pack( opal_convertor_t* pConv, struct iovec* iov, + uint32_t* out_size, size_t* max_data ); + +/* + * + */ +OPAL_DECLSPEC int32_t opal_convertor_unpack( opal_convertor_t* pConv, struct iovec* iov, + uint32_t* out_size, size_t* max_data ); + +/* + * + */ +OPAL_DECLSPEC opal_convertor_t* opal_convertor_create( int32_t remote_arch, int32_t mode ); + + +/** + * The cleanup function will put the convertor in exactly the same state as after a call + * to opal_convertor_construct. Therefore, all PML can call OBJ_DESTRUCT on the request's + * convertors without having to call OBJ_CONSTRUCT everytime they grab a new one from the + * cache. The OBJ_CONSTRUCT on the convertor should be called only on the first creation + * of a request (not when extracted from the cache). + */ +static inline int opal_convertor_cleanup( opal_convertor_t* convertor ) +{ + if( OPAL_UNLIKELY(convertor->stack_size > DT_STATIC_STACK_SIZE) ) { + free( convertor->pStack ); + convertor->pStack = convertor->static_stack; + convertor->stack_size = DT_STATIC_STACK_SIZE; + } + convertor->pDesc = NULL; + convertor->stack_pos = 0; + convertor->flags = OPAL_DATATYPE_FLAG_NO_GAPS | CONVERTOR_COMPLETED; + + return OPAL_SUCCESS; +} + + +/** + * Return: 0 if no packing is required for sending (the upper layer + * can use directly the pointer to the contiguous user + * buffer). + * 1 if data does need to be packed, i.e. heterogeneous peers + * (source arch != dest arch) or non contiguous memory + * layout. + */ +static inline int32_t opal_convertor_need_buffers( const opal_convertor_t* pConvertor ) +{ +#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT + if (OPAL_UNLIKELY(0 == (pConvertor->flags & CONVERTOR_HOMOGENEOUS))) return 1; +#endif + if( pConvertor->flags & OPAL_DATATYPE_FLAG_NO_GAPS ) return 0; + if( (pConvertor->count == 1) && (pConvertor->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) ) return 0; + return 1; +} + + +/* + * + */ +static inline void opal_convertor_get_packed_size( const opal_convertor_t* pConv, + size_t* pSize ) +{ + *pSize = pConv->local_size; +} + + +/* + * + */ +static inline void opal_convertor_get_unpacked_size( const opal_convertor_t* pConv, + size_t* pSize ) +{ + *pSize = pConv->remote_size; +} + + +/** + * Return the current absolute position of the next pack/unpack. This function is + * mostly useful for contiguous datatypes, when we need to get the pointer to the + * contiguous piece of memory. + */ +static inline void opal_convertor_get_current_pointer( const opal_convertor_t* pConv, + void** position ) +{ + unsigned char* base = pConv->pBaseBuf + pConv->bConverted + pConv->pDesc->true_lb; + *position = (void*)base; +} + +/* + * + */ +OPAL_DECLSPEC int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor, + const struct opal_datatype_t* datatype, + int32_t count, + const void* pUserBuf); + +static inline int32_t opal_convertor_copy_and_prepare_for_send( const opal_convertor_t* pSrcConv, + const struct opal_datatype_t* datatype, + int32_t count, + const void* pUserBuf, + int32_t flags, + opal_convertor_t* convertor ) +{ + convertor->remoteArch = pSrcConv->remoteArch; + convertor->flags = pSrcConv->flags | flags; + convertor->master = pSrcConv->master; + + return opal_convertor_prepare_for_send( convertor, datatype, count, pUserBuf ); +} + +/* + * + */ +OPAL_DECLSPEC int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor, + const struct opal_datatype_t* datatype, + int32_t count, + const void* pUserBuf ); +static inline int32_t opal_convertor_copy_and_prepare_for_recv( const opal_convertor_t* pSrcConv, + const struct opal_datatype_t* datatype, + int32_t count, + const void* pUserBuf, + int32_t flags, + opal_convertor_t* convertor ) +{ + convertor->remoteArch = pSrcConv->remoteArch; + convertor->flags = (pSrcConv->flags | flags); + convertor->master = pSrcConv->master; + + return opal_convertor_prepare_for_recv( convertor, datatype, count, pUserBuf ); +} + +/* + * Give access to the raw memory layout based on the datatype. + */ +OPAL_DECLSPEC int32_t +opal_convertor_raw( opal_convertor_t* convertor, /* [IN/OUT] */ + struct iovec* iov, /* [IN/OUT] */ + uint32_t* iov_count, /* [IN/OUT] */ + size_t* length ); /* [OUT] */ + +/* + * Upper level does not need to call the _nocheck function directly. + */ +OPAL_DECLSPEC int32_t +opal_convertor_set_position_nocheck( opal_convertor_t* convertor, + size_t* position ); +static inline int32_t +opal_convertor_set_position( opal_convertor_t* convertor, + size_t* position ) +{ + /* + * Do not allow the convertor to go outside the data boundaries. This test include + * the check for datatype with size zero as well as for convertors with a count of zero. + */ + if( OPAL_UNLIKELY(convertor->local_size <= *position) ) { + convertor->flags |= CONVERTOR_COMPLETED; + convertor->bConverted = convertor->local_size; + *position = convertor->bConverted; + return OPAL_SUCCESS; + } + + /* + * If the convertor is already at the correct position we are happy. + */ + if( OPAL_LIKELY((*position) == convertor->bConverted) ) return OPAL_SUCCESS; + + /* Remove the completed flag if it's already set */ + convertor->flags &= ~CONVERTOR_COMPLETED; + + if( !(convertor->flags & CONVERTOR_WITH_CHECKSUM) && + (convertor->flags & OPAL_DATATYPE_FLAG_NO_GAPS) && + (convertor->flags & (CONVERTOR_SEND | CONVERTOR_HOMOGENEOUS)) ) { + /* Contiguous and no checkpoint and no homogeneous unpack */ + convertor->bConverted = *position; + return OPAL_SUCCESS; + } + + return opal_convertor_set_position_nocheck( convertor, position ); +} + +/* + * + */ +static inline int32_t +opal_convertor_personalize( opal_convertor_t* convertor, + uint32_t flags, + size_t* position ) +{ + convertor->flags |= flags; + + if( OPAL_UNLIKELY(NULL == position) ) + return OPAL_SUCCESS; + return opal_convertor_set_position( convertor, position ); +} + +/* + * + */ +OPAL_DECLSPEC int +opal_convertor_clone( const opal_convertor_t* source, + opal_convertor_t* destination, + int32_t copy_stack ); + +static inline int +opal_convertor_clone_with_position( const opal_convertor_t* source, + opal_convertor_t* destination, + int32_t copy_stack, + size_t* position ) +{ + (void)opal_convertor_clone( source, destination, copy_stack ); + return opal_convertor_set_position( destination, position ); +} + +/* + * + */ +OPAL_DECLSPEC void +opal_convertor_dump( opal_convertor_t* convertor ); + +OPAL_DECLSPEC void +opal_datatype_dump_stack( const dt_stack_t* pStack, + int stack_pos, + const union dt_elem_desc* pDesc, + const char* name ); + +/* + * + */ +OPAL_DECLSPEC int +opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, + size_t* position ); + +END_C_DECLS + +#endif /* OPAL_CONVERTOR_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/datatype/convertor_internal.h b/opal/datatype/opal_convertor_internal.h similarity index 53% rename from ompi/datatype/convertor_internal.h rename to opal/datatype/opal_convertor_internal.h index 0b294b1aaa..00952cbc5f 100644 --- a/ompi/datatype/convertor_internal.h +++ b/opal/datatype/opal_convertor_internal.h @@ -3,49 +3,53 @@ * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ -#ifndef CONVERTOR_INTERNAL_HAS_BEEN_INCLUDED -#define CONVERTOR_INTERNAL_HAS_BEEN_INCLUDED +#ifndef OPAL_CONVERTOR_INTERNAL_HAS_BEEN_INCLUDED +#define OPAL_CONVERTOR_INTERNAL_HAS_BEEN_INCLUDED -#include "ompi_config.h" -#include "ompi/constants.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "opal_config.h" + +#include + +#include "opal/constants.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor.h" BEGIN_C_DECLS -typedef int32_t (*conversion_fct_t)( ompi_convertor_t* pConvertor, uint32_t count, - const void* from, size_t from_len, ptrdiff_t from_extent, - void* to, size_t to_length, ptrdiff_t to_extent, - ptrdiff_t *advance ); +typedef int32_t (*conversion_fct_t)( opal_convertor_t* pConvertor, uint32_t count, + const void* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, + void* to, size_t to_length, OPAL_PTRDIFF_TYPE to_extent, + OPAL_PTRDIFF_TYPE *advance ); -typedef struct ompi_convertor_master_t { - struct ompi_convertor_master_t* next; +typedef struct opal_convertor_master_t { + struct opal_convertor_master_t* next; uint32_t remote_arch; uint32_t flags; - uint64_t hetero_mask; - const size_t remote_sizes[DT_MAX_PREDEFINED]; + uint32_t hetero_mask; + const size_t remote_sizes[OPAL_DATATYPE_MAX_PREDEFINED]; conversion_fct_t* pFunctions; /**< the convertor functions pointer */ -} ompi_convertor_master_t; +} opal_convertor_master_t; /* * Find or create a new master convertor based on a specific architecture. The master * convertor hold all informations related to a defined architecture, such as the sizes * of the predefined data-types, the conversion functions, ... */ -ompi_convertor_master_t* ompi_convertor_find_or_create_master( uint32_t remote_arch ); +opal_convertor_master_t* opal_convertor_find_or_create_master( uint32_t remote_arch ); /* * Destroy all pending master convertors. This function is usually called when we * shutdown the data-type engine, once all convertors have been destroyed. */ -void ompi_convertor_destroy_masters( void ); +void opal_convertor_destroy_masters( void ); END_C_DECLS -#endif /* CONVERTOR_INTERNAL_HAS_BEEN_INCLUDED */ +#endif /* OPAL_CONVERTOR_INTERNAL_HAS_BEEN_INCLUDED */ diff --git a/ompi/datatype/convertor_raw.c b/opal/datatype/opal_convertor_raw.c similarity index 83% rename from ompi/datatype/convertor_raw.c rename to opal/datatype/opal_convertor_raw.c index 59c33751a4..55e8a7871c 100644 --- a/ompi/datatype/convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -3,6 +3,7 @@ * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,13 +11,18 @@ * $HEADER$ */ -#include "ompi_config.h" -#include "ompi/datatype/convertor_internal.h" -#include "ompi/datatype/datatype_internal.h" +#include "opal_config.h" + +#include + +#include "opal/datatype/opal_convertor_internal.h" +#include "opal/datatype/opal_datatype_internal.h" #if OPAL_ENABLE_DEBUG -extern int ompi_pack_debug; -#define DO_DEBUG(INST) if( ompi_pack_debug ) { INST } +#include "opal/util/output.h" + +extern int opal_pack_debug; +#define DO_DEBUG(INST) if( opal_pack_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ @@ -27,11 +33,11 @@ extern int ompi_pack_debug; * length we're working on are local. */ int32_t -ompi_convertor_raw( ompi_convertor_t* pConvertor, +opal_convertor_raw( opal_convertor_t* pConvertor, struct iovec* iov, uint32_t* iov_count, size_t* length ) { - const ompi_datatype_t *pData = pConvertor->pDesc; + const opal_datatype_t *pData = pConvertor->pDesc; dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ uint32_t count_desc; /* the number of items already done in the actual pos_desc */ @@ -46,7 +52,7 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor, * to manage the conversion. This function work even after the convertor * was moved to a specific position. */ - ompi_convertor_get_current_pointer( pConvertor, (void**)&iov[0].iov_base ); + opal_convertor_get_current_pointer( pConvertor, (void**)&iov[0].iov_base ); iov[0].iov_len = pConvertor->local_size - pConvertor->bConverted; *length = iov[0].iov_len; pConvertor->bConverted = pConvertor->local_size; @@ -55,7 +61,7 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor, return 1; /* we're done */ } - DO_DEBUG( opal_output( 0, "ompi_convertor_raw( %p, {%p, %u}, %lu )\n", (void*)pConvertor, + DO_DEBUG( opal_output( 0, "opal_convertor_raw( %p, {%p, %u}, %lu )\n", (void*)pConvertor, (void*)iov, *iov_count, (unsigned long)*length ); ); description = pConvertor->use_desc->desc; @@ -77,14 +83,14 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor, pos_desc, count_desc, (long)(source_base - pConvertor->pBaseBuf), pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); while( 1 ) { - while( pElem->elem.common.flags & DT_FLAG_DATA ) { - size_t blength = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size; + while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { + size_t blength = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; source_base += pElem->elem.disp; if( blength == (size_t)pElem->elem.extent ) { /* no resized data */ if( index < *iov_count ) { blength *= count_desc; /* now here we have a basic datatype */ - OMPI_DDT_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %lu}\n", index, source_base, (unsigned long)blength ); ); @@ -97,7 +103,7 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor, } } else { for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) { - OMPI_DDT_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %lu}\n", index, source_base, (unsigned long)blength ); ); @@ -117,7 +123,7 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor, } goto complete_loop; } - if( DT_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ + if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ DO_DEBUG( opal_output( 0, "raw end_loop count %d stack_pos %d" " pos_desc %d disp %ld space %lu\n", (int)pStack->count, pConvertor->stack_pos, @@ -138,7 +144,7 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor, if( pStack->index == -1 ) { pStack->disp += (pData->ub - pData->lb); } else { - assert( DT_LOOP == description[pStack->index].loop.common.type ); + assert( OPAL_DATATYPE_LOOP == description[pStack->index].loop.common.type ); pStack->disp += description[pStack->index].loop.extent; } } @@ -149,15 +155,15 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor, (int)pStack->count, pConvertor->stack_pos, pos_desc, (long)pStack->disp, (unsigned long)raw_data ); ); } - if( DT_LOOP == pElem->elem.common.type ) { - ptrdiff_t local_disp = (ptrdiff_t)source_base; + if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { + OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)source_base; ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)(pElem + pElem->loop.items); - if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) { + if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { uint32_t i; source_base += end_loop->first_elem_disp; for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) { - OMPI_DDT_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); iov[index].iov_base = (IOVBASE_TYPE *) source_base; iov[index].iov_len = end_loop->size; @@ -171,8 +177,8 @@ ompi_convertor_raw( ompi_convertor_t* pConvertor, goto update_loop_description; } } - local_disp = (ptrdiff_t)source_base - local_disp; - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc, + local_disp = (OPAL_PTRDIFF_TYPE)source_base - local_disp; + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; update_loop_description: /* update the current state */ @@ -191,10 +197,9 @@ complete_loop: return 1; } /* I complete an element, next step I should go to the next one */ - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc, + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_UINT1, count_desc, source_base - pStack->disp - pConvertor->pBaseBuf ); DO_DEBUG( opal_output( 0, "raw save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n", pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); return 0; } - diff --git a/opal/datatype/opal_copy_functions.c b/opal/datatype/opal_copy_functions.c new file mode 100644 index 0000000000..051e713ca5 --- /dev/null +++ b/opal/datatype/opal_copy_functions.c @@ -0,0 +1,244 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" + +#include + +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "opal/datatype/opal_datatype_checksum.h" +#include "opal/datatype/opal_convertor_internal.h" + +/* + * This function is used to copy data from one buffer to another. The assumption + * is that the number of bytes per element to copy at the source and destination + * are the same. + * count - number of instances of a given data-type to copy + * from - point to the source buffer + * to - pointer to the destination buffer + * from_len - length of source buffer (in bytes) + * to_len - length of destination buffer (in bytes) + * from_extent - extent of the source data type (in bytes) + * to_extent - extent of the destination data type (in bytes) + * + * Return value: Number of elements of type TYPE copied + */ +#define COPY_TYPE( TYPENAME, TYPE, COUNT ) \ +static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count, \ + char* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, \ + char* to, size_t to_len, OPAL_PTRDIFF_TYPE to_extent, \ + OPAL_PTRDIFF_TYPE *advance) \ +{ \ + uint32_t i; \ + size_t remote_TYPE_size = sizeof(TYPE) * (COUNT); /* TODO */ \ + size_t local_TYPE_size = (COUNT) * sizeof(TYPE); \ + \ + /* make sure the remote buffer is large enough to hold the data */ \ + if( (remote_TYPE_size * count) > from_len ) { \ + count = (uint32_t)(from_len / remote_TYPE_size); \ + if( (count * remote_TYPE_size) != from_len ) { \ + DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \ + from_len - (count * remote_TYPE_size) ); \ + } \ + DUMP( "correct: copy %s count %d from buffer %p with length %d to %p space %d\n", \ + #TYPE, count, from, from_len, to, to_len ); \ + } else \ + DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \ + #TYPE, count, from, from_len, to, to_len ); \ + \ + if( (from_extent == (OPAL_PTRDIFF_TYPE)local_TYPE_size) && \ + (to_extent == (OPAL_PTRDIFF_TYPE)remote_TYPE_size) ) { \ + /* copy of contigous data at both source and destination */ \ + MEMCPY( to, from, count * local_TYPE_size ); \ + } else { \ + /* source or destination are non-contigous */ \ + for( i = 0; i < count; i++ ) { \ + MEMCPY( to, from, local_TYPE_size ); \ + to += to_extent; \ + from += from_extent; \ + } \ + } \ + *advance = count * from_extent; \ + return count; \ +} + +/* + * This function is used to copy data from one buffer to another. The assumption + * is that the number of bytes per element to copy at the source and destination + * are the same. + * count - number of instances of a given data-type to copy + * from - point to the source buffer + * to - pointer to the destination buffer + * from_len - length of source buffer (in bytes) + * to_len - length of destination buffer (in bytes) + * from_extent - extent of the source data type (in bytes) + * to_extent - extent of the destination data type (in bytes) + * + * Return value: Number of elements of type TYPE copied + */ +#define COPY_CONTIGUOUS_BYTES( TYPENAME, COUNT ) \ +static int copy_##TYPENAME##_##COUNT( opal_convertor_t *pConvertor, uint32_t count, \ + char* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, \ + char* to, size_t to_len, OPAL_PTRDIFF_TYPE to_extent, \ + OPAL_PTRDIFF_TYPE *advance ) \ +{ \ + uint32_t i; \ + size_t remote_TYPE_size = (size_t)(COUNT); /* TODO */ \ + size_t local_TYPE_size = (size_t)(COUNT); \ + \ + if( (remote_TYPE_size * count) > from_len ) { \ + count = (uint32_t)(from_len / remote_TYPE_size); \ + if( (count * remote_TYPE_size) != from_len ) { \ + DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \ + from_len - (count * remote_TYPE_size) ); \ + } \ + DUMP( "correct: copy %s count %d from buffer %p with length %d to %p space %d\n", \ + #TYPENAME, count, from, from_len, to, to_len ); \ + } else \ + DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \ + #TYPENAME, count, from, from_len, to, to_len ); \ + \ + if( (from_extent == (OPAL_PTRDIFF_TYPE)local_TYPE_size) && \ + (to_extent == (OPAL_PTRDIFF_TYPE)remote_TYPE_size) ) { \ + MEMCPY( to, from, count * local_TYPE_size ); \ + } else { \ + for( i = 0; i < count; i++ ) { \ + MEMCPY( to, from, local_TYPE_size ); \ + to += to_extent; \ + from += from_extent; \ + } \ + } \ + *advance = count * from_extent; \ + return count; \ +} + +/* set up copy functions for the basic C MPI data types */ +/* per default, select all of them */ +#define REQUIRE_COPY_BYTES_1 1 +#define REQUIRE_COPY_BYTES_2 1 +#define REQUIRE_COPY_BYTES_4 1 +#define REQUIRE_COPY_BYTES_8 1 +#define REQUIRE_COPY_BYTES_16 1 + +#if REQUIRE_COPY_BYTES_1 +COPY_CONTIGUOUS_BYTES( bytes, 1 ) +#endif +#if REQUIRE_COPY_BYTES_2 +COPY_CONTIGUOUS_BYTES( bytes, 2 ) +#endif +#if REQUIRE_COPY_BYTES_4 +COPY_CONTIGUOUS_BYTES( bytes, 4 ) +#endif +#if REQUIRE_COPY_BYTES_8 +COPY_CONTIGUOUS_BYTES( bytes, 8 ) +#endif +#if REQUIRE_COPY_BYTES_16 +COPY_CONTIGUOUS_BYTES( bytes, 16 ) +#endif + +#if SIZEOF_FLOAT == 2 +COPY_TYPE( float_2, float, 1 ) +#elif SIZEOF_DOUBLE == 2 +COPY_TYPE( float_2, double, 1 ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 2 +COPY_TYPE( float_2, long double, 1 ) +#else +/* #error No basic type for copy function for opal_datatype_float2 found */ +#define copy_float_2 NULL +#endif + +#if SIZEOF_FLOAT == 4 +COPY_TYPE( float_4, float, 1 ) +#elif SIZEOF_DOUBLE == 4 +COPY_TYPE( float_4, double, 1 ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 4 +COPY_TYPE( float_4, long double, 1 ) +#else +#error No basic type for copy function for opal_datatype_float4 found +#endif + +#if SIZEOF_FLOAT == 8 +COPY_TYPE( float_8, float, 1 ) +#elif SIZEOF_DOUBLE == 8 +COPY_TYPE( float_8, double, 1 ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 8 +COPY_TYPE( float_8, long double, 1 ) +#else +#error No basic type for copy function for opal_datatype_float8 found +#endif + +#if SIZEOF_FLOAT == 12 +COPY_TYPE( float_12, float, 1 ) +#elif SIZEOF_DOUBLE == 12 +COPY_TYPE( float_12, double, 1 ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 12 +COPY_TYPE( float_12, long double, 1 ) +#else +/* #error No basic type for copy function for opal_datatype_float12 found */ +#define copy_float_12 NULL +#endif + +#if SIZEOF_FLOAT == 16 +COPY_TYPE( float_16, float, 1 ) +#elif SIZEOF_DOUBLE == 16 +COPY_TYPE( float_16, double, 1 ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 16 +COPY_TYPE( float_16, long double, 1 ) +#else +/* #error No basic type for copy function for opal_datatype_float16 found */ +#define copy_float_16 NULL +#endif + +#if SIZEOF_BOOL == SIZEOF_CHAR +COPY_TYPE (bool, char, 1) +#elif SIZEOF_BOOL == SIZEOF_SHORT +COPY_TYPE (bool, short, 1) +#elif SIZEOF_BOOL == SIZEOF_INT +COPY_TYPE (bool, int, 1) +#elif SIZEOF_BOOL == SIZEOF_LONG +COPY_TYPE (bool, long, 1) +#else +#error No basic type for copy function for opal_datatype_bool found +#endif + +COPY_TYPE (wchar, wchar_t, 1) + + +/* Table of predefined copy functions - one for each OPAL type */ +/* NOTE: The order of this array *MUST* match the order in opal_datatype_basicDatatypes */ +conversion_fct_t opal_datatype_copy_functions[OPAL_DATATYPE_MAX_PREDEFINED] = { + (conversion_fct_t)NULL, /* OPAL_DATATYPE_LOOP */ + (conversion_fct_t)NULL, /* OPAL_DATATYPE_END_LOOP */ + (conversion_fct_t)NULL, /* OPAL_DATATYPE_LB */ + (conversion_fct_t)NULL, /* OPAL_DATATYPE_UB */ + (conversion_fct_t)copy_bytes_1, /* OPAL_DATATYPE_INT1 */ + (conversion_fct_t)copy_bytes_2, /* OPAL_DATATYPE_INT2 */ + (conversion_fct_t)copy_bytes_4, /* OPAL_DATATYPE_INT4 */ + (conversion_fct_t)copy_bytes_8, /* OPAL_DATATYPE_INT8 */ + (conversion_fct_t)copy_bytes_16, /* OPAL_DATATYPE_INT16 */ + (conversion_fct_t)copy_bytes_1, /* OPAL_DATATYPE_UINT1 */ + (conversion_fct_t)copy_bytes_2, /* OPAL_DATATYPE_UINT2 */ + (conversion_fct_t)copy_bytes_4, /* OPAL_DATATYPE_UINT4 */ + (conversion_fct_t)copy_bytes_8, /* OPAL_DATATYPE_UINT8 */ + (conversion_fct_t)copy_bytes_16, /* OPAL_DATATYPE_UINT16 */ + (conversion_fct_t)copy_float_2, /* OPAL_DATATYPE_FLOAT2 */ + (conversion_fct_t)copy_float_4, /* OPAL_DATATYPE_FLOAT4 */ + (conversion_fct_t)copy_float_8, /* OPAL_DATATYPE_FLOAT8 */ + (conversion_fct_t)copy_float_12, /* OPAL_DATATYPE_FLOAT12 */ + (conversion_fct_t)copy_float_16, /* OPAL_DATATYPE_FLOAT16 */ + (conversion_fct_t)copy_bool, /* OPAL_DATATYPE_BOOL */ + (conversion_fct_t)copy_wchar, /* OPAL_DATATYPE_WCHAR */ + (conversion_fct_t)NULL /* OPAL_DATATYPE_UNAVAILABLE */ +}; diff --git a/opal/datatype/opal_copy_functions_heterogeneous.c b/opal/datatype/opal_copy_functions_heterogeneous.c new file mode 100644 index 0000000000..bc75950492 --- /dev/null +++ b/opal/datatype/opal_copy_functions_heterogeneous.c @@ -0,0 +1,356 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" + +#include +#ifdef HAVE_STDINT_H +#include +#endif + +#include "opal/util/arch.h" + +#include "opal/types.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "opal/datatype/opal_datatype_checksum.h" +#include "opal/datatype/opal_convertor_internal.h" + + +/* + * Long-Term TODO: + * We need a better way for the upper layer to convert + * multiple, consecutive struct-types, e.g. float_int. + * In the current design, the copy_float_heterogeneous and copy_float_heterogeneous + * functions would be called 2*count times in total. + * This is a big performance hit for a structure types. + * + * A better way would be to have a conversion registration functionality. + */ + +static inline void +opal_dt_swap_bytes(void *to_p, const void *from_p, const size_t size) +{ + size_t i; + size_t back_i = size - 1; + uint8_t *to = (uint8_t*) to_p; + uint8_t *from = (uint8_t*) from_p; + for (i = 0 ; i < size ; i++, back_i--) { + to[back_i] = from[i]; + } +} + + +#define COPY_TYPE_HETEROGENEOUS( TYPENAME, TYPE ) \ +static int32_t \ +copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ + const char* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, \ + char* to, size_t to_length, OPAL_PTRDIFF_TYPE to_extent, \ + OPAL_PTRDIFF_TYPE *advance) \ +{ \ + uint32_t i; \ + \ + datatype_check( #TYPE, sizeof(TYPE), sizeof(TYPE), &count, \ + from, from_len, from_extent, \ + to, to_length, to_extent); \ + \ + if ((pConvertor->remoteArch & OPAL_ARCH_ISBIGENDIAN) != \ + (opal_local_arch & OPAL_ARCH_ISBIGENDIAN)) { \ + for( i = 0; i < count; i++ ) { \ + opal_dt_swap_bytes(to, from, sizeof(TYPE)); \ + to += to_extent; \ + from += from_extent; \ + } \ + } else if ((OPAL_PTRDIFF_TYPE)sizeof(TYPE) == to_extent && \ + (OPAL_PTRDIFF_TYPE)sizeof(TYPE) == from_extent) { \ + MEMCPY( to, from, count * sizeof(TYPE) ); \ + } else { \ + /* source or destination are non-contigous */ \ + for( i = 0; i < count; i++ ) { \ + MEMCPY( to, from, sizeof(TYPE) ); \ + to += to_extent; \ + from += from_extent; \ + } \ + } \ + *advance = count * from_extent; \ + return count; \ +} + + +#define COPY_2TYPE_HETEROGENEOUS( TYPENAME, TYPE1, TYPE2 ) \ +static int32_t \ +copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ + const char* from, uint32_t from_len, OPAL_PTRDIFF_TYPE from_extent, \ + char* to, uint32_t to_length, OPAL_PTRDIFF_TYPE to_extent, \ + OPAL_PTRDIFF_TYPE *advance) \ +{ \ + uint32_t i; \ + \ + datatype_check( #TYPENAME, sizeof(TYPE1) + sizeof(TYPE2), \ + sizeof(TYPE1) + sizeof(TYPE2), &count, \ + from, from_len, from_extent, \ + to, to_length, to_extent); \ + \ + if ((pConvertor->remoteArch & OPAL_ARCH_ISBIGENDIAN) != \ + (opal_local_arch & OPAL_ARCH_ISBIGENDIAN)) { \ + /* source and destination are different endianness */ \ + for( i = 0; i < count; i++ ) { \ + TYPE1* to_1, *from_1; \ + TYPE2* to_2, *from_2; \ + to_1 = (TYPE1*) to; from_1 = (TYPE1*) from; \ + opal_dt_swap_bytes(to_1, from_1, sizeof(TYPE1)); \ + to_2 = (TYPE2*) (to_1 + 1); from_2 = (TYPE2*) (from_1 + 1); \ + opal_dt_swap_bytes(to_2, from_2, sizeof(TYPE2)); \ + to += to_extent; \ + from += from_extent; \ + } \ + } else if ((OPAL_PTRDIFF_TYPE)(sizeof(TYPE1) + sizeof(TYPE2)) == to_extent && \ + (OPAL_PTRDIFF_TYPE)(sizeof(TYPE1) + sizeof(TYPE2)) == from_extent) { \ + /* source and destination are contigous */ \ + MEMCPY( to, from, count * (sizeof(TYPE1) + sizeof(TYPE2)) ); \ + } else { \ + /* source or destination are non-contigous */ \ + for( i = 0; i < count; i++ ) { \ + MEMCPY( to, from, sizeof(TYPE1) + sizeof(TYPE2) ); \ + to += to_extent; \ + from += from_extent; \ + } \ + } \ + *advance = count * from_extent; \ + return count; \ +} + + +static inline void +datatype_check(char *type, size_t local_size, size_t remote_size, uint32_t *count, + const char* from, size_t from_len, OPAL_PTRDIFF_TYPE from_extent, + char* to, size_t to_len, OPAL_PTRDIFF_TYPE to_extent) +{ + /* make sure the remote buffer is large enough to hold the data */ + if( (remote_size * *count) > from_len ) { + *count = (uint32_t)(from_len / remote_size); + if( (*count * remote_size) != from_len ) { + DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", + from_len - (*count * remote_size) ); + } + DUMP( "correct: copy %s count %d from buffer %p with length %d to %p space %d\n", + "char", *count, from, from_len, to, to_len ); + } else { + DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", + "char", *count, from, from_len, to, to_len ); + } +} + +#if 0 /* XXX TODO to be deleted? */ +/* char has no endian issues, so don't really worry about it */ +static int32_t +copy_char_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, + const char* from, uint32_t from_len, OPAL_PTRDIFF_TYPE from_extent, + char* to, uint32_t to_length, OPAL_PTRDIFF_TYPE to_extent, + OPAL_PTRDIFF_TYPE *advance) +{ + uint32_t i; + + datatype_check("char", sizeof(char), sizeof(char), &count, + from, from_len, from_extent, + to, to_length, to_extent); + + if( (from_extent == sizeof(char)) && + (to_extent == sizeof(char)) ) { + /* copy of contigous data at both source and destination */ + MEMCPY( to, from, count * sizeof(char) ); + } else { + /* source or destination are non-contigous */ + for( i = 0; i < count; i++ ) { + MEMCPY( to, from, sizeof(char) ); + to += to_extent; + from += from_extent; + } + } + *advance = count * from_extent; + return count; +} +#endif /* 0 */ + +#define CXX_BOOL_COPY_LOOP(TYPE) \ + for( i = 0; i < count; i++ ) { \ + bool *to_real = (bool*) to; \ + *to_real = *((TYPE*) from) == 0 ? false : true; \ + to += to_extent; \ + from += from_extent; \ + } +static int32_t +copy_cxx_bool_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, + const char* from, uint32_t from_len, OPAL_PTRDIFF_TYPE from_extent, + char* to, uint32_t to_length, OPAL_PTRDIFF_TYPE to_extent, + OPAL_PTRDIFF_TYPE *advance) +{ + uint32_t i; + + /* fix up the from extent */ + if ((pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) != + (opal_local_arch & OPAL_ARCH_BOOLISxx)) { + switch (pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) { + case OPAL_ARCH_BOOLIS8: + from_extent = 1; + break; + case OPAL_ARCH_BOOLIS16: + from_extent = 2; + break; + case OPAL_ARCH_BOOLIS32: + from_extent = 4; + break; + } + } + + datatype_check( "bool", sizeof(bool), sizeof(bool), &count, + from, from_len, from_extent, + to, to_length, to_extent); + + if ((to_extent != sizeof(bool) || from_extent != sizeof(bool)) || + ((pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) != + (opal_local_arch & OPAL_ARCH_BOOLISxx))) { + switch (pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) { + case OPAL_ARCH_BOOLIS8: + CXX_BOOL_COPY_LOOP(int8_t); + break; + case OPAL_ARCH_BOOLIS16: + CXX_BOOL_COPY_LOOP(int16_t); + break; + case OPAL_ARCH_BOOLIS32: + CXX_BOOL_COPY_LOOP(int32_t); + break; + } + } else { + MEMCPY( to, from, count * sizeof(bool) ); + } + + *advance = count * from_extent; + return count; +} + + +COPY_TYPE_HETEROGENEOUS(int1, int8_t) +COPY_TYPE_HETEROGENEOUS(int2, int16_t) +COPY_TYPE_HETEROGENEOUS(int4, int32_t) +#ifdef HAVE_INT64_T +COPY_TYPE_HETEROGENEOUS(int8, int64_t) +#else +#define copy_int8_heterogeneous NULL +#endif + +#ifdef HAVE_INT128_T +COPY_TYPE_HETEROGENEOUS(int16, int128_t) +#else +#define copy_int16_heterogeneous NULL +#endif + + +#if SIZEOF_FLOAT == 2 +COPY_TYPE_HETEROGENEOUS( float2, float ) +#elif SIZEOF_DOUBLE == 2 +COPY_TYPE_HETEROGENEOUS( float2, double ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 2 +COPY_TYPE_HETEROGENEOUS( float2, long double ) +#else +/* #error No basic type for copy function for opal_datatype_float2 found */ +#define copy_float2_heterogeneous NULL +#endif + +#if SIZEOF_FLOAT == 4 +COPY_TYPE_HETEROGENEOUS( float4, float ) +#elif SIZEOF_DOUBLE == 4 +COPY_TYPE_HETEROGENEOUS( float4, double ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 4 +COPY_TYPE_HETEROGENEOUS( float4, long double ) +#else +/* #error No basic type for copy function for opal_datatype_float4 found */ +#define copy_float4_heterogeneous NULL +#endif + +#if SIZEOF_FLOAT == 8 +COPY_TYPE_HETEROGENEOUS( float8, float ) +#elif SIZEOF_DOUBLE == 8 +COPY_TYPE_HETEROGENEOUS( float8, double ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 8 +COPY_TYPE_HETEROGENEOUS( float8, long double ) +#else +/* #error No basic type for copy function for opal_datatype_float8 found */ +#define copy_float8_heterogeneous NULL +#endif + +#if SIZEOF_FLOAT == 12 +COPY_TYPE_HETEROGENEOUS( float12, float ) +#elif SIZEOF_DOUBLE == 12 +COPY_TYPE_HETEROGENEOUS( float12, double ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 12 +COPY_TYPE_HETEROGENEOUS( float12, long double ) +#else +/* #error No basic type for copy function for opal_datatype_float12 found */ +#define copy_float12_heterogeneous NULL +#endif + +#if SIZEOF_FLOAT == 16 +COPY_TYPE_HETEROGENEOUS( float16, float ) +#elif SIZEOF_DOUBLE == 8 +COPY_TYPE_HETEROGENEOUS( float16, double ) +#elif HAVE_LONG_DOUBLE && SIZEOF_LONG_DOUBLE == 16 +COPY_TYPE_HETEROGENEOUS( float16, long double ) +#else +/* #error No basic type for copy function for opal_datatype_float16 found */ +#define copy_float16_heterogeneous NULL +#endif + +#if 0 /* XXX TODO */ +#if SIZEOF_BOOL == SIZEOF_CHAR +COPY_TYPE_HETEROGENEOUS (bool, char) +#elif SIZEOF_BOOL == SIZEOF_SHORT +COPY_TYPE_HETEROGENEOUS (bool, short) +#elif SIZEOF_BOOL == SIZEOF_INT +COPY_TYPE_HETEROGENEOUS (bool, int) +#elif SIZEOF_BOOL == SIZEOF_LONG +COPY_TYPE_HETEROGENEOUS (bool, long) +#else +#error No basic type for copy function for opal_datatype_bool found +#endif +#endif /* 0 */ + +COPY_TYPE_HETEROGENEOUS (wchar, wchar_t) + + +/* table of predefined copy functions - one for each MPI type */ +conversion_fct_t opal_datatype_heterogeneous_copy_functions[OPAL_DATATYPE_MAX_PREDEFINED] = { + NULL, /* OPAL_DATATYPE_LOOP */ + NULL, /* OPAL_DATATYPE_END_LOOP */ + NULL, /* OPAL_DATATYPE_LB */ + NULL, /* OPAL_DATATYPE_UB */ + (conversion_fct_t) copy_int1_heterogeneous, /* OPAL_DATATYPE_INT1 */ + (conversion_fct_t) copy_int2_heterogeneous, /* OPAL_DATATYPE_INT2 */ + (conversion_fct_t) copy_int4_heterogeneous, /* OPAL_DATATYPE_INT4 */ + (conversion_fct_t) copy_int8_heterogeneous, /* OPAL_DATATYPE_INT8 */ + (conversion_fct_t) copy_int16_heterogeneous, /* OPAL_DATATYPE_INT16 */ + (conversion_fct_t) copy_int1_heterogeneous, /* OPAL_DATATYPE_UINT1 */ + (conversion_fct_t) copy_int2_heterogeneous, /* OPAL_DATATYPE_UINT2 */ + (conversion_fct_t) copy_int4_heterogeneous, /* OPAL_DATATYPE_UINT4 */ + (conversion_fct_t) copy_int8_heterogeneous, /* OPAL_DATATYPE_UINT8 */ + (conversion_fct_t) copy_int16_heterogeneous, /* OPAL_DATATYPE_UINT16 */ + (conversion_fct_t) copy_float2_heterogeneous, /* OPAL_DATATYPE_FLOAT2 */ + (conversion_fct_t) copy_float4_heterogeneous, /* OPAL_DATATYPE_FLOAT4 */ + (conversion_fct_t) copy_float8_heterogeneous, /* OPAL_DATATYPE_FLOAT8 */ + (conversion_fct_t) copy_float12_heterogeneous, /* OPAL_DATATYPE_FLOAT12 */ + (conversion_fct_t) copy_float16_heterogeneous, /* OPAL_DATATYPE_FLOAT16 */ + (conversion_fct_t) copy_cxx_bool_heterogeneous, /* OPAL_DATATYPE_BOOL */ + (conversion_fct_t) copy_wchar_heterogeneous, /* OPAL_DATATYPE_WCHAR */ + NULL, /* OPAL_DATATYPE_UNAVAILABLE */ +}; diff --git a/opal/datatype/opal_datatype.h b/opal/datatype/opal_datatype.h new file mode 100644 index 0000000000..9eaa92179a --- /dev/null +++ b/opal/datatype/opal_datatype.h @@ -0,0 +1,344 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2007 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** + * opal_datatype_t interface for OPAL internal data type representation + * + * opal_datatype_t is a class which represents contiguous or + * non-contiguous data together with constituent type-related + * information. + */ + +#ifndef OPAL_DATATYPE_H_HAS_BEEN_INCLUDED +#define OPAL_DATATYPE_H_HAS_BEEN_INCLUDED + +#include "opal_config.h" + +#include +#ifdef HAVE_STDINT_H +#include +#endif + +#include "opal/class/opal_object.h" + +BEGIN_C_DECLS + +/* + * If there are more basic datatypes than the number of bytes in the int type + * the bdt_used field of the data description struct should be changed to long. + * + * This must match the same definition as in opal_datatype_internal.h + */ +#define OPAL_DATATYPE_MAX_PREDEFINED 22 +/* + * No more than this number of _Basic_ datatypes in C/CPP or Fortran + * are supported (in order to not change setup and usage of btypes). + * + * XXX TODO Adapt to whatever the OMPI-layer needs + */ +#define OPAL_DATATYPE_MAX_SUPPORTED 46 + + +/* flags for the datatypes. */ +#define OPAL_DATATYPE_FLAG_UNAVAILABLE 0x0001 /**< datatypes unavailable on the build (OS or compiler dependant) */ +#define OPAL_DATATYPE_FLAG_PREDEFINED 0x0002 /**< cannot be removed: initial and predefined datatypes */ +#define OPAL_DATATYPE_FLAG_COMMITED 0x0004 /**< ready to be used for a send/recv operation */ +#define OPAL_DATATYPE_FLAG_OVERLAP 0x0008 /**< datatype is unpropper for a recv operation */ +#define OPAL_DATATYPE_FLAG_CONTIGUOUS 0x0010 /**< contiguous datatype */ +#define OPAL_DATATYPE_FLAG_NO_GAPS 0x0020 /**< no gaps around the datatype, aka OPAL_DATATYPE_FLAG_CONTIGUOUS and extent == size */ +#define OPAL_DATATYPE_FLAG_USER_LB 0x0040 /**< has a user defined LB */ +#define OPAL_DATATYPE_FLAG_USER_UB 0x0080 /**< has a user defined UB */ +#define OPAL_DATATYPE_FLAG_DATA 0x0100 /**< data or control structure */ +/* + * We should make the difference here between the predefined contiguous and non contiguous + * datatypes. The OPAL_DATATYPE_FLAG_BASIC is held by all predefined contiguous datatypes. + */ +#define OPAL_DATATYPE_FLAG_BASIC (OPAL_DATATYPE_FLAG_PREDEFINED | \ + OPAL_DATATYPE_FLAG_CONTIGUOUS | \ + OPAL_DATATYPE_FLAG_NO_GAPS | \ + OPAL_DATATYPE_FLAG_DATA | \ + OPAL_DATATYPE_FLAG_COMMITED) + + +/** + * The number of supported entries in the data-type definition and the + * associated type. + */ +#define MAX_DT_COMPONENT_COUNT UINT_MAX +typedef uint32_t opal_datatype_count_t; + +typedef union dt_elem_desc dt_elem_desc_t; + +struct dt_type_desc_t { + opal_datatype_count_t length; /**< the maximum number of elements in the description array */ + opal_datatype_count_t used; /**< the number of used elements in the description array */ + dt_elem_desc_t* desc; +}; +typedef struct dt_type_desc_t dt_type_desc_t; + + +/* + * The datatype description. + */ +struct opal_datatype_t { + opal_object_t super; /**< basic superclass */ + uint16_t flags; /**< the flags */ + uint16_t id; /**< data id, normally the index in the data array. */ + uint32_t bdt_used; /**< bitset of which basic datatypes are used in the data description */ + size_t size; /**< total size in bytes of the memory used by the data if + the data is put on a contiguous buffer */ + OPAL_PTRDIFF_TYPE true_lb; /**< the true lb of the data without user defined lb and ub */ + OPAL_PTRDIFF_TYPE true_ub; /**< the true ub of the data without user defined lb and ub */ + OPAL_PTRDIFF_TYPE lb; /**< lower bound in memory */ + OPAL_PTRDIFF_TYPE ub; /**< upper bound in memory */ + /* --- cacheline 1 boundary (64 bytes) --- */ + uint32_t align; /**< data should be aligned to */ + uint32_t nbElems; /**< total number of elements inside the datatype */ + + /* Attribute fields */ + char name[OPAL_MAX_OBJECT_NAME]; /* TODO: Can this be deleted??? It's just sugar...*/ + /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */ + dt_type_desc_t desc; /**< the data description */ + dt_type_desc_t opt_desc; /**< short description of the data used when conversion is useless + or in the send case (without conversion) */ + + uint32_t btypes[OPAL_DATATYPE_MAX_SUPPORTED]; + /**< basic elements count used to compute the size of the + datatype for remote nodes. The length of the array is dependent on + the maximum number of datatypes of all top layers. + Reason being is that Fortran is not at the OPAL layer. */ + /* --- cacheline 5 boundary (320 bytes) was 32 bytes ago --- */ + + /* size: 352, cachelines: 6, members: 15 */ + /* last cacheline: 32 bytes */ +}; + +typedef struct opal_datatype_t opal_datatype_t; + +OPAL_DECLSPEC OBJ_CLASS_DECLARATION( opal_datatype_t ); + +OPAL_DECLSPEC extern const opal_datatype_t* opal_datatype_basicDatatypes[OPAL_DATATYPE_MAX_PREDEFINED]; +OPAL_DECLSPEC extern const size_t opal_datatype_local_sizes[OPAL_DATATYPE_MAX_PREDEFINED]; + +/* Local Architecture as provided by opal_arch_compute_local_id() */ +OPAL_DECLSPEC extern uint32_t opal_local_arch; + +/* + * The OPAL-layer's Basic datatypes themselves. + */ +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_null; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_loop; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_end_loop; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_lb; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_ub; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_int1; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_int2; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_int4; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_int8; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_int16; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_uint1; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_uint2; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_uint4; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_uint8; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_uint16; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_float2; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_float4; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_float8; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_float12; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_float16; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_bool; +OPAL_DECLSPEC extern const opal_datatype_t opal_datatype_wchar; + + +/* + * Functions exported externally + */ +int opal_datatype_register_params(void); +OPAL_DECLSPEC int32_t opal_datatype_init( void ); +OPAL_DECLSPEC int32_t opal_datatype_finalize( void ); +OPAL_DECLSPEC opal_datatype_t* opal_datatype_create( int32_t expectedSize ); +OPAL_DECLSPEC int32_t opal_datatype_create_desc( opal_datatype_t * datatype, int32_t expectedSize ); +OPAL_DECLSPEC int32_t opal_datatype_commit( opal_datatype_t * pData ); +OPAL_DECLSPEC int32_t opal_datatype_destroy( opal_datatype_t** ); + +static inline int32_t +opal_datatype_is_committed( const opal_datatype_t* type ) +{ + return ((type->flags & OPAL_DATATYPE_FLAG_COMMITED) == OPAL_DATATYPE_FLAG_COMMITED); +} + +static inline int32_t +opal_datatype_is_overlapped( const opal_datatype_t* type ) +{ + return ((type->flags & OPAL_DATATYPE_FLAG_OVERLAP) == OPAL_DATATYPE_FLAG_OVERLAP); +} + +static inline int32_t +opal_datatype_is_valid( const opal_datatype_t* type ) +{ + return !((type->flags & OPAL_DATATYPE_FLAG_UNAVAILABLE) == OPAL_DATATYPE_FLAG_UNAVAILABLE); +} + +static inline int32_t +opal_datatype_is_predefined( const opal_datatype_t* type ) +{ + return (type->flags & OPAL_DATATYPE_FLAG_PREDEFINED); +} + +/* + * This function return true (1) if the datatype representation depending on the count + * is contiguous in the memory. And false (0) otherwise. + */ +static inline int32_t +opal_datatype_is_contiguous_memory_layout( const opal_datatype_t* datatype, int32_t count ) +{ + if( !(datatype->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) ) return 0; + if( (count == 1) || (datatype->flags & OPAL_DATATYPE_FLAG_NO_GAPS) ) return 1; + assert( (OPAL_PTRDIFF_TYPE)datatype->size != (datatype->ub - datatype->lb) ); + return 0; +} + + +OPAL_DECLSPEC void opal_datatype_dump( const opal_datatype_t* pData ); +/* data creation functions */ +OPAL_DECLSPEC int32_t opal_datatype_clone( const opal_datatype_t * src_type, opal_datatype_t * dest_type ); +OPAL_DECLSPEC int32_t opal_datatype_create_contiguous( int count, const opal_datatype_t* oldType, opal_datatype_t** newType ); +OPAL_DECLSPEC int32_t opal_datatype_resize( opal_datatype_t* type, OPAL_PTRDIFF_TYPE lb, OPAL_PTRDIFF_TYPE extent ); +OPAL_DECLSPEC int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtAdd, uint32_t count, + OPAL_PTRDIFF_TYPE disp, OPAL_PTRDIFF_TYPE extent ); + +static inline int32_t +opal_datatype_type_lb( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* disp ) +{ + *disp = pData->lb; + return 0; +} + +static inline int32_t +opal_datatype_type_ub( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* disp ) +{ + *disp = pData->ub; + return 0; +} + +static inline int32_t +opal_datatype_type_size( const opal_datatype_t* pData, size_t *size ) +{ + *size = pData->size; + return 0; +} + +static inline int32_t +opal_datatype_type_extent( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* extent ) +{ + *extent = pData->ub - pData->lb; + return 0; +} + +static inline int32_t +opal_datatype_get_extent( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* lb, OPAL_PTRDIFF_TYPE* extent) +{ + *lb = pData->lb; *extent = pData->ub - pData->lb; + return 0; +} + +static inline int32_t +opal_datatype_get_true_extent( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE* true_lb, OPAL_PTRDIFF_TYPE* true_extent) +{ + *true_lb = pData->true_lb; + *true_extent = (pData->true_ub - pData->true_lb); + return 0; +} + +OPAL_DECLSPEC int32_t +opal_datatype_get_element_count( const opal_datatype_t* pData, size_t iSize ); +OPAL_DECLSPEC int32_t +opal_datatype_set_element_count( const opal_datatype_t* pData, uint32_t count, size_t* length ); +OPAL_DECLSPEC int32_t +opal_datatype_copy_content_same_ddt( const opal_datatype_t* pData, int32_t count, + char* pDestBuf, char* pSrcBuf ); + +OPAL_DECLSPEC const opal_datatype_t* +opal_datatype_match_size( int size, uint16_t datakind, uint16_t datalang ); + +/* + * + */ +OPAL_DECLSPEC int32_t +opal_datatype_sndrcv( void *sbuf, int32_t scount, const opal_datatype_t* sdtype, void *rbuf, + int32_t rcount, const opal_datatype_t* rdtype); + +/* + * + */ +OPAL_DECLSPEC int32_t +opal_datatype_get_args( const opal_datatype_t* pData, int32_t which, + int32_t * ci, int32_t * i, + int32_t * ca, OPAL_PTRDIFF_TYPE* a, + int32_t * cd, opal_datatype_t** d, int32_t * type); +OPAL_DECLSPEC int32_t +opal_datatype_set_args( opal_datatype_t* pData, + int32_t ci, int32_t ** i, + int32_t ca, OPAL_PTRDIFF_TYPE* a, + int32_t cd, opal_datatype_t** d,int32_t type); +OPAL_DECLSPEC int32_t +opal_datatype_copy_args( const opal_datatype_t* source_data, + opal_datatype_t* dest_data ); +OPAL_DECLSPEC int32_t +opal_datatype_release_args( opal_datatype_t* pData ); + +/* + * + */ +OPAL_DECLSPEC size_t +opal_datatype_pack_description_length( const opal_datatype_t* datatype ); + +/* + * + */ +OPAL_DECLSPEC int +opal_datatype_get_pack_description( opal_datatype_t* datatype, + const void** packed_buffer ); + +/* + * + */ +struct opal_proc_t; +OPAL_DECLSPEC opal_datatype_t* +opal_datatype_create_from_packed_description( void** packed_buffer, + struct opal_proc_t* remote_processor ); + +#if OPAL_ENABLE_DEBUG +/* + * Set a breakpoint to this function in your favorite debugger + * to make it stop on all pack and unpack errors. + */ +OPAL_DECLSPEC int +opal_datatype_safeguard_pointer_debug_breakpoint( const void* actual_ptr, int length, + const void* initial_ptr, + const opal_datatype_t* pData, + int count ); +#endif /* OPAL_ENABLE_DEBUG */ + +END_C_DECLS +#endif /* OPAL_DATATYPE_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/datatype/dt_add.c b/opal/datatype/opal_datatype_add.c similarity index 69% rename from ompi/datatype/dt_add.c rename to opal/datatype/opal_datatype_add.c index e67e667aa1..3d58733813 100644 --- a/ompi/datatype/dt_add.c +++ b/opal/datatype/opal_datatype_add.c @@ -10,6 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,32 +18,36 @@ * $HEADER$ */ -#include "ompi_config.h" -#include "ompi/constants.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" +#include "opal_config.h" + +#include + +#include "opal/constants.h" +#include "opal/util/output.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" /* macros to play with the flags */ -#define SET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) | (DT_FLAG_CONTIGUOUS) -#define SET_NO_GAP_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) | (DT_FLAG_NO_GAPS) -#define UNSET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) & (~(DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS)) +#define SET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) | (OPAL_DATATYPE_FLAG_CONTIGUOUS) +#define SET_NO_GAP_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) | (OPAL_DATATYPE_FLAG_NO_GAPS) +#define UNSET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) & (~(OPAL_DATATYPE_FLAG_CONTIGUOUS | OPAL_DATATYPE_FLAG_NO_GAPS)) #if defined(__GNUC__) && !defined(__STDC__) -#define LMAX(A,B) ({ ptrdiff_t _a = (A), _b = (B); (_a < _b ? _b : _a) }) -#define LMIN(A,B) ({ ptrdiff_t _a = (A), _b = (B); (_a < _b ? _a : _b); }) +#define LMAX(A,B) ({ OPAL_PTRDIFF_TYPE _a = (A), _b = (B); (_a < _b ? _b : _a) }) +#define LMIN(A,B) ({ OPAL_PTRDIFF_TYPE _a = (A), _b = (B); (_a < _b ? _a : _b); }) #define IMAX(A,B) ({ int _a = (A), _b = (B); (_a < _b ? _b : _a); }) #define IMIN(A,B) ({ int _a = (A), _b = (B); (_a < _b ? _a : _b); }) #else -static inline ptrdiff_t LMAX( ptrdiff_t a, ptrdiff_t b ) { return ( a < b ? b : a ); } -static inline ptrdiff_t LMIN( ptrdiff_t a, ptrdiff_t b ) { return ( a < b ? a : b ); } +static inline OPAL_PTRDIFF_TYPE LMAX( OPAL_PTRDIFF_TYPE a, OPAL_PTRDIFF_TYPE b ) { return ( a < b ? b : a ); } +static inline OPAL_PTRDIFF_TYPE LMIN( OPAL_PTRDIFF_TYPE a, OPAL_PTRDIFF_TYPE b ) { return ( a < b ? a : b ); } static inline int IMAX( int a, int b ) { return ( a < b ? b : a ); } static inline int IMIN( int a, int b ) { return ( a < b ? a : b ); } #endif /* __GNU__ */ -#define OMPI_DDT_COMPUTE_REQUIRED_ENTRIES( _pdtAdd, _count, _extent, _place_needed) \ +#define OPAL_DATATYPE_COMPUTE_REQUIRED_ENTRIES( _pdtAdd, _count, _extent, _place_needed) \ { \ - if( (_pdtAdd)->flags & DT_FLAG_PREDEFINED ) { /* add a basic datatype */ \ - (_place_needed) = ((_extent) == (ptrdiff_t)(_pdtAdd)->size ? 1 : 3); \ + if( (_pdtAdd)->flags & OPAL_DATATYPE_FLAG_PREDEFINED ) { /* add a basic datatype */ \ + (_place_needed) = ((_extent) == (OPAL_PTRDIFF_TYPE)(_pdtAdd)->size ? 1 : 3); \ } else { \ (_place_needed) = (_pdtAdd)->desc.used; \ if( (_count) != 1 ) { \ @@ -54,19 +59,19 @@ static inline int IMIN( int a, int b ) { return ( a < b ? a : b ); } */ \ opal_output( 0, "Too many elements in the datatype. The limit is %ud\n", \ MAX_DT_COMPONENT_COUNT ); \ - return OMPI_ERROR; \ + return OPAL_ERROR; \ } \ } \ } \ } -#define OMPI_DDT_LB_UB_CONT( _count, _disp, _old_lb, _old_ub, _old_extent, _new_lb, _new_ub ) \ +#define OPAL_DATATYPE_LB_UB_CONT( _count, _disp, _old_lb, _old_ub, _old_extent, _new_lb, _new_ub ) \ { \ if( 0 == _count ) { \ _new_lb = (_old_lb) + (_disp); \ _new_ub = (_old_ub) + (_disp); \ } else { \ - ptrdiff_t lower, upper; \ + OPAL_PTRDIFF_TYPE lower, upper; \ upper = (_disp) + (_old_extent) * ((_count) - 1); \ lower = (_disp); \ if( lower < upper ) { \ @@ -95,13 +100,13 @@ static inline int IMIN( int a, int b ) { return ( a < b ? a : b ); } * be sure that the pdtBase datatype is correctly initialized with all fields * set to ZERO if it's a empty datatype. */ -int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, - uint32_t count, ptrdiff_t disp, ptrdiff_t extent ) +int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtAdd, + uint32_t count, OPAL_PTRDIFF_TYPE disp, OPAL_PTRDIFF_TYPE extent ) { uint32_t newLength, place_needed = 0, i; short localFlags = 0; /* no specific options yet */ dt_elem_desc_t *pLast, *pLoop = NULL; - ptrdiff_t lb, ub, true_lb, true_ub, epsilon, old_true_ub; + OPAL_PTRDIFF_TYPE lb, ub, true_lb, true_ub, epsilon, old_true_ub; /* the extent should always be positive. So a negative * value here have a special meaning ie. default extent as @@ -109,35 +114,35 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, */ if( extent == -1 ) extent = (pdtAdd->ub - pdtAdd->lb); - /* Deal with the special markers (DT_LB and DT_UB) */ - if( DT_LB == pdtAdd->id ) { - pdtBase->bdt_used |= (((uint64_t)1) << DT_LB); - if( pdtBase->flags & DT_FLAG_USER_LB ) { + /* Deal with the special markers (OPAL_DATATYPE_LB and OPAL_DATATYPE_UB) */ + if( OPAL_DATATYPE_LB == pdtAdd->id ) { + pdtBase->bdt_used |= (((uint32_t)1) << OPAL_DATATYPE_LB); + if( pdtBase->flags & OPAL_DATATYPE_FLAG_USER_LB ) { pdtBase->lb = LMIN( pdtBase->lb, disp ); } else { pdtBase->lb = disp; - pdtBase->flags |= DT_FLAG_USER_LB; + pdtBase->flags |= OPAL_DATATYPE_FLAG_USER_LB; } - if( (pdtBase->ub - pdtBase->lb) != (ptrdiff_t)pdtBase->size ) { - pdtBase->flags &= ~DT_FLAG_NO_GAPS; + if( (pdtBase->ub - pdtBase->lb) != (OPAL_PTRDIFF_TYPE)pdtBase->size ) { + pdtBase->flags &= ~OPAL_DATATYPE_FLAG_NO_GAPS; } - return OMPI_SUCCESS; /* Just ignore the DT_LOOP and DT_END_LOOP */ - } else if( DT_UB == pdtAdd->id ) { - pdtBase->bdt_used |= (((uint64_t)1) << DT_UB); - if( pdtBase->flags & DT_FLAG_USER_UB ) { + return OPAL_SUCCESS; /* Just ignore the OPAL_DATATYPE_LOOP and OPAL_DATATYPE_END_LOOP */ + } else if( OPAL_DATATYPE_UB == pdtAdd->id ) { + pdtBase->bdt_used |= (((uint32_t)1) << OPAL_DATATYPE_UB); + if( pdtBase->flags & OPAL_DATATYPE_FLAG_USER_UB ) { pdtBase->ub = LMAX( pdtBase->ub, disp ); } else { pdtBase->ub = disp; - pdtBase->flags |= DT_FLAG_USER_UB; + pdtBase->flags |= OPAL_DATATYPE_FLAG_USER_UB; } - if( (pdtBase->ub - pdtBase->lb) != (ptrdiff_t)pdtBase->size ) { - pdtBase->flags &= ~DT_FLAG_NO_GAPS; + if( (pdtBase->ub - pdtBase->lb) != (OPAL_PTRDIFF_TYPE)pdtBase->size ) { + pdtBase->flags &= ~OPAL_DATATYPE_FLAG_NO_GAPS; } - return OMPI_SUCCESS; /* Just ignore the DT_LOOP and DT_END_LOOP */ + return OPAL_SUCCESS; /* Just ignore the OPAL_DATATYPE_LOOP and OPAL_DATATYPE_END_LOOP */ } /* Compute the number of entries we need in the datatype description */ - OMPI_DDT_COMPUTE_REQUIRED_ENTRIES( pdtAdd, count, extent, place_needed ); + OPAL_DATATYPE_COMPUTE_REQUIRED_ENTRIES( pdtAdd, count, extent, place_needed ); /* * Compute the lower and upper bound of the datatype. We do it in 2 steps. @@ -145,7 +150,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, * count. Then update the lb value depending on the user markers and * update the global lb and ub. */ - OMPI_DDT_LB_UB_CONT( count, disp, pdtAdd->lb, pdtAdd->ub, extent, lb, ub ); + OPAL_DATATYPE_LB_UB_CONT( count, disp, pdtAdd->lb, pdtAdd->ub, extent, lb, ub ); /* Compute the true_lb and true_ub for the datatype to be added, taking * in account the number of repetions. These values do not include the @@ -161,7 +166,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, #if 0 /* Avoid claiming overlap as much as possible. */ - if( !(pdtBase->flags & DT_FLAG_OVERLAP) ) { + if( !(pdtBase->flags & OPAL_DATATYPE_FLAG_OVERLAP) ) { if( ((disp + true_lb) >= pdtBase->true_ub) || ((disp + true_ub) <= pdtBase->true_lb) ) { } else { @@ -174,11 +179,11 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, * if the USER has explicitly set it. The result lb is the MIN between * the all lb + disp if and only if all or nobody flags's contain the LB. */ - if( (pdtAdd->flags ^ pdtBase->flags) & DT_FLAG_USER_LB ) { - if( pdtBase->flags & DT_FLAG_USER_LB ) { + if( (pdtAdd->flags ^ pdtBase->flags) & OPAL_DATATYPE_FLAG_USER_LB ) { + if( pdtBase->flags & OPAL_DATATYPE_FLAG_USER_LB ) { lb = pdtBase->lb; /* base type has a user provided lb */ } - pdtBase->flags |= DT_FLAG_USER_LB; + pdtBase->flags |= OPAL_DATATYPE_FLAG_USER_LB; } else { /* both of them have the LB flag or both of them dont have it */ lb = LMIN( pdtBase->lb, lb ); @@ -188,11 +193,11 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, * either of them has the flag UB, in which case we should * compute the UB including the natural alignement of the data. */ - if( (pdtBase->flags ^ pdtAdd->flags) & DT_FLAG_USER_UB ) { - if( pdtBase->flags & DT_FLAG_USER_UB ) { + if( (pdtBase->flags ^ pdtAdd->flags) & OPAL_DATATYPE_FLAG_USER_UB ) { + if( pdtBase->flags & OPAL_DATATYPE_FLAG_USER_UB ) { ub = pdtBase->ub; } - pdtBase->flags |= DT_FLAG_USER_UB; + pdtBase->flags |= OPAL_DATATYPE_FLAG_USER_UB; } else { /* both of them have the UB flag or both of them dont have it */ /* we should compute the extent depending on the alignement */ @@ -214,14 +219,14 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, * This rule apply only if there is user specified upper bound as stated in the * MPI standard MPI 1.2 page 71. */ - if( !(pdtBase->flags & DT_FLAG_USER_UB) ) { + if( !(pdtBase->flags & OPAL_DATATYPE_FLAG_USER_UB) ) { epsilon = (pdtBase->ub - pdtBase->lb) % pdtBase->align; if( 0 != epsilon ) { pdtBase->ub += (pdtBase->align - epsilon); } } /* now we know it contain some data */ - pdtBase->flags |= DT_FLAG_DATA; + pdtBase->flags |= OPAL_DATATYPE_FLAG_DATA; /* * the count == 0 is LEGAL only for MPI_UB and MPI_LB. Therefore we support it @@ -230,7 +235,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, * the true_lb and true_ub. */ if( (0 == count) || (0 == pdtAdd->size) ) { - return OMPI_SUCCESS; + return OPAL_SUCCESS; } /* Now, once we know everything is fine and there are some bytes in @@ -260,37 +265,37 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, * of an predefined contiguous datatype. This part is unable to handle any * predefined non contiguous datatypes (like MPI_SHORT_INT). */ - if( (pdtAdd->flags & (DT_FLAG_PREDEFINED | DT_FLAG_DATA)) == (DT_FLAG_PREDEFINED | DT_FLAG_DATA) ) { + if( (pdtAdd->flags & (OPAL_DATATYPE_FLAG_PREDEFINED | OPAL_DATATYPE_FLAG_DATA)) == (OPAL_DATATYPE_FLAG_PREDEFINED | OPAL_DATATYPE_FLAG_DATA) ) { pdtBase->btypes[pdtAdd->id] += count; - if( (extent != (ptrdiff_t)pdtAdd->size) && (count > 1) ) { /* gaps around the datatype */ - localFlags = pdtAdd->flags & ~(DT_FLAG_COMMITED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS); + if( (extent != (OPAL_PTRDIFF_TYPE)pdtAdd->size) && (count > 1) ) { /* gaps around the datatype */ + localFlags = pdtAdd->flags & ~(OPAL_DATATYPE_FLAG_COMMITED | OPAL_DATATYPE_FLAG_CONTIGUOUS | OPAL_DATATYPE_FLAG_NO_GAPS); CREATE_LOOP_START( pLast, count, 2, extent, localFlags ); pLast++; pLast->elem.common.type = pdtAdd->id; pLast->elem.count = 1; pLast->elem.disp = disp; pLast->elem.extent = pdtAdd->size; - pLast->elem.common.flags = localFlags | DT_FLAG_CONTIGUOUS; + pLast->elem.common.flags = localFlags | OPAL_DATATYPE_FLAG_CONTIGUOUS; pLast++; CREATE_LOOP_END( pLast, 2, disp, pdtAdd->size, localFlags ); pdtBase->desc.used += 3; - pdtBase->btypes[DT_LOOP] = 1; - pdtBase->btypes[DT_END_LOOP] = 1; + pdtBase->btypes[OPAL_DATATYPE_LOOP] = 1; + pdtBase->btypes[OPAL_DATATYPE_END_LOOP] = 1; } else { pLast->elem.common.type = pdtAdd->id; pLast->elem.count = count; pLast->elem.disp = disp; pLast->elem.extent = extent; pdtBase->desc.used++; - pLast->elem.common.flags = pdtAdd->flags & ~(DT_FLAG_COMMITED); + pLast->elem.common.flags = pdtAdd->flags & ~(OPAL_DATATYPE_FLAG_COMMITED); } } else { /* keep trace of the total number of basic datatypes in the datatype definition */ - pdtBase->btypes[DT_LOOP] += pdtAdd->btypes[DT_LOOP]; - pdtBase->btypes[DT_END_LOOP] += pdtAdd->btypes[DT_END_LOOP]; - pdtBase->btypes[DT_LB] |= pdtAdd->btypes[DT_LB]; - pdtBase->btypes[DT_UB] |= pdtAdd->btypes[DT_UB]; - for( i = 4; i < DT_MAX_PREDEFINED; i++ ) + pdtBase->btypes[OPAL_DATATYPE_LOOP] += pdtAdd->btypes[OPAL_DATATYPE_LOOP]; + pdtBase->btypes[OPAL_DATATYPE_END_LOOP] += pdtAdd->btypes[OPAL_DATATYPE_END_LOOP]; + pdtBase->btypes[OPAL_DATATYPE_LB] |= pdtAdd->btypes[OPAL_DATATYPE_LB]; + pdtBase->btypes[OPAL_DATATYPE_UB] |= pdtAdd->btypes[OPAL_DATATYPE_UB]; + for( i = 4; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) if( pdtAdd->btypes[i] != 0 ) pdtBase->btypes[i] += (count * pdtAdd->btypes[i]); if( (1 == pdtAdd->desc.used) && (extent == (pdtAdd->ub - pdtAdd->lb)) && @@ -306,17 +311,17 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, if( count != 1 ) { pLoop = pLast; CREATE_LOOP_START( pLast, count, pdtAdd->desc.used + 1, extent, - (pdtAdd->flags & ~(DT_FLAG_COMMITED)) ); - pdtBase->btypes[DT_LOOP] += 2; + (pdtAdd->flags & ~(OPAL_DATATYPE_FLAG_COMMITED)) ); + pdtBase->btypes[OPAL_DATATYPE_LOOP] += 2; pdtBase->desc.used += 2; pLast++; } for( i = 0; i < pdtAdd->desc.used; i++ ) { pLast->elem = pdtAdd->desc.desc[i].elem; - if( DT_FLAG_DATA & pLast->elem.common.flags ) + if( OPAL_DATATYPE_FLAG_DATA & pLast->elem.common.flags ) pLast->elem.disp += disp; - else if( DT_END_LOOP == pLast->elem.common.type ) { + else if( OPAL_DATATYPE_END_LOOP == pLast->elem.common.type ) { pLast->end_loop.first_elem_disp += disp; } pLast++; @@ -324,7 +329,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, pdtBase->desc.used += pdtAdd->desc.used; if( pLoop != NULL ) { int index = GET_FIRST_NON_LOOP( pLoop ); - assert( pLoop[index].elem.common.flags & DT_FLAG_DATA ); + assert( pLoop[index].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ); CREATE_LOOP_END( pLast, pdtAdd->desc.used + 1, pLoop[index].elem.disp, pdtAdd->size, pLoop->loop.common.flags ); } @@ -339,21 +344,21 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, */ localFlags = pdtBase->flags & pdtAdd->flags; UNSET_CONTIGUOUS_FLAG(pdtBase->flags); - if( (localFlags & DT_FLAG_CONTIGUOUS) /* both type were contiguous */ + if( (localFlags & OPAL_DATATYPE_FLAG_CONTIGUOUS) /* both type were contiguous */ && ((disp + pdtAdd->true_lb) == old_true_ub) /* and there is no gap between them */ - && ( ((ptrdiff_t)pdtAdd->size == extent) /* the size and the extent of the + && ( ((OPAL_PTRDIFF_TYPE)pdtAdd->size == extent) /* the size and the extent of the * added type have to match */ || (count < 2)) ) { /* if the count is bigger than 2 */ SET_CONTIGUOUS_FLAG(pdtBase->flags); - if( (ptrdiff_t)pdtBase->size == (pdtBase->ub - pdtBase->lb) ) + if( (OPAL_PTRDIFF_TYPE)pdtBase->size == (pdtBase->ub - pdtBase->lb) ) SET_NO_GAP_FLAG(pdtBase->flags); } /* If the NO_GAP flag is set the contiguous have to be set too */ - if( pdtBase->flags & DT_FLAG_NO_GAPS ) { - assert( pdtBase->flags & DT_FLAG_CONTIGUOUS ); + if( pdtBase->flags & OPAL_DATATYPE_FLAG_NO_GAPS ) { + assert( pdtBase->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ); } pdtBase->nbElems += (count * pdtAdd->nbElems); - return OMPI_SUCCESS; + return OPAL_SUCCESS; } diff --git a/ompi/datatype/datatype_checksum.h b/opal/datatype/opal_datatype_checksum.h similarity index 82% rename from ompi/datatype/datatype_checksum.h rename to opal/datatype/opal_datatype_checksum.h index 9f0a174b3e..64fecd179b 100644 --- a/ompi/datatype/datatype_checksum.h +++ b/opal/datatype/opal_datatype_checksum.h @@ -1,13 +1,14 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 IBM Corporation. All rights reserved. * Copyright (c) 2009 Los Alamos National Security, LLC. All rights - * reserved. + * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,24 +20,24 @@ #define DATATYPE_CHECKSUM_H_HAS_BEEN_INCLUDED -#include "ompi/datatype/datatype_memcpy.h" +#include "opal/datatype/opal_datatype_memcpy.h" #include "opal/util/crc.h" #if defined(CHECKSUM) -#if defined (OMPI_CSUM_DST) +#if defined (OPAL_CSUM_DST) #define MEMCPY_CSUM( DST, SRC, BLENGTH, CONVERTOR ) \ do { \ (CONVERTOR)->checksum += OPAL_CSUM_BCOPY_PARTIAL( (SRC), (DST), (BLENGTH), (BLENGTH), &(CONVERTOR)->csum_ui1, &(CONVERTOR)->csum_ui2 ); \ } while (0) -#else /* if OMPI_CSUM_DST */ +#else /* if OPAL_CSUM_DST */ #define MEMCPY_CSUM( DST, SRC, BLENGTH, CONVERTOR ) \ do { \ (CONVERTOR)->checksum += OPAL_CSUM_BCOPY_PARTIAL( (SRC), (DST), (BLENGTH), (BLENGTH), &(CONVERTOR)->csum_ui1, &(CONVERTOR)->csum_ui2 ); \ } while (0) -#endif /* if OMPI_CSUM_DST */ +#endif /* if OPAL_CSUM_DST */ #define COMPUTE_CSUM( SRC, BLENGTH, CONVERTOR ) \ do { \ diff --git a/opal/datatype/opal_datatype_clone.c b/opal/datatype/opal_datatype_clone.c new file mode 100644 index 0000000000..0212792858 --- /dev/null +++ b/opal/datatype/opal_datatype_clone.c @@ -0,0 +1,66 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" +#include "opal/constants.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" + +/* + * As the new type has the same commit state as the old one, I have to copy the fake + * OPAL_DATATYPE_END_LOOP from the description (both normal and optimized). + * + * Clone all the values from oldType into newType without allocating a new datatype. + */ +int32_t opal_datatype_clone( const opal_datatype_t * src_type, opal_datatype_t * dest_type ) +{ + int32_t desc_length = src_type->desc.used + 1; /* +1 because of the fake OPAL_DATATYPE_END_LOOP entry */ + dt_elem_desc_t* temp = dest_type->desc.desc; /* temporary copy of the desc pointer */ + + memcpy( dest_type, src_type, sizeof(opal_datatype_t) ); + dest_type->super.obj_reference_count = 1; + dest_type->desc.desc = temp; + dest_type->flags &= (~OPAL_DATATYPE_FLAG_PREDEFINED); + + /** + * Allow duplication of MPI_UB and MPI_LB. + */ + if( 0 != src_type->desc.used ) { + memcpy( dest_type->desc.desc, src_type->desc.desc, sizeof(dt_elem_desc_t) * desc_length ); + if( 0 != src_type->opt_desc.used ) { + if( src_type->opt_desc.desc == src_type->desc.desc) { + dest_type->opt_desc = dest_type->desc; + } else { + desc_length = dest_type->opt_desc.used + 1; + dest_type->opt_desc.desc = (dt_elem_desc_t*)malloc( desc_length * sizeof(dt_elem_desc_t) ); + /* + * Yes, the dest_type->opt_desc.length is just the opt_desc.used of the old Type. + */ + dest_type->opt_desc.length = src_type->opt_desc.used; + dest_type->opt_desc.used = src_type->opt_desc.used; + memcpy( dest_type->opt_desc.desc, src_type->opt_desc.desc, desc_length * sizeof(dt_elem_desc_t) ); + } + } + } + dest_type->id = src_type->id; /* preserve the default id. This allow us to + * copy predefined types. */ + return OPAL_SUCCESS; +} diff --git a/ompi/datatype/dt_copy.c b/opal/datatype/opal_datatype_copy.c similarity index 79% rename from ompi/datatype/dt_copy.c rename to opal/datatype/opal_datatype_copy.c index 6d9e9d2bd2..f3d2697e67 100644 --- a/ompi/datatype/dt_copy.c +++ b/opal/datatype/opal_datatype_copy.c @@ -3,13 +3,14 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,29 +18,33 @@ * $HEADER$ */ -#include "ompi_config.h" -#include "opal/prefetch.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype_internal.h" -#include "ompi/datatype/datatype_checksum.h" +#include "opal_config.h" +#include #ifdef HAVE_ALLOCA_H #include #endif #include +#include "opal/prefetch.h" +#include "opal/util/output.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "opal/datatype/opal_datatype_checksum.h" + + #if OPAL_ENABLE_DEBUG -extern int ompi_copy_debug; -#define DO_DEBUG(INST) if( ompi_copy_debug ) { INST } +extern int opal_copy_debug; +#define DO_DEBUG(INST) if( opal_copy_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ -size_t ompi_datatype_memcpy_block_size = 128 * 1024; +size_t opal_datatype_memcpy_block_size = 128 * 1024; static inline void copy_predefined_data( const dt_elem_desc_t* ELEM, - const ompi_datatype_t* DATATYPE, + const opal_datatype_t* DATATYPE, unsigned char* SOURCE_BASE, int32_t TOTAL_COUNT, uint32_t COUNT, @@ -53,11 +58,11 @@ static inline void copy_predefined_data( const dt_elem_desc_t* ELEM, unsigned char* _source = (SOURCE) + _elem->disp; unsigned char* _destination = (DESTINATION) + _elem->disp; - _copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size; + _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; if( _copy_blength == (uint32_t)_elem->extent ) { _copy_blength *= _copy_count; - OMPI_DDT_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE), + OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE), (DATATYPE), (TOTAL_COUNT) ); /* the extent and the size of the basic datatype are equals */ DO_DEBUG( opal_output( 0, "copy 1. memcpy( %p, %p, %lu ) => space %lu\n", @@ -68,7 +73,7 @@ static inline void copy_predefined_data( const dt_elem_desc_t* ELEM, } else { uint32_t _i; for( _i = 0; _i < _copy_count; _i++ ) { - OMPI_DDT_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE), + OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE), (DATATYPE), (TOTAL_COUNT) ); DO_DEBUG( opal_output( 0, "copy 2. memcpy( %p, %p, %lu ) => space %lu\n", _destination, _source, (unsigned long)_copy_blength, (unsigned long)(*(SPACE) - (_i * _copy_blength)) ); ); @@ -82,7 +87,7 @@ static inline void copy_predefined_data( const dt_elem_desc_t* ELEM, } static inline void copy_contiguous_loop( const dt_elem_desc_t* ELEM, - const ompi_datatype_t* DATATYPE, + const opal_datatype_t* DATATYPE, unsigned char* SOURCE_BASE, int32_t TOTAL_COUNT, uint32_t COUNT, @@ -97,14 +102,14 @@ static inline void copy_contiguous_loop( const dt_elem_desc_t* ELEM, size_t _copy_loops = (COUNT); uint32_t _i; - if( _loop->extent == (ptrdiff_t)_end_loop->size ) { /* the loop is contiguous */ + if( _loop->extent == (OPAL_PTRDIFF_TYPE)_end_loop->size ) { /* the loop is contiguous */ _copy_loops *= _end_loop->size; - OMPI_DDT_SAFEGUARD_POINTER( _source, _copy_loops, (SOURCE_BASE), + OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_loops, (SOURCE_BASE), (DATATYPE), (TOTAL_COUNT) ); MEMCPY( _destination, _source, _copy_loops ); } else { for( _i = 0; _i < _copy_loops; _i++ ) { - OMPI_DDT_SAFEGUARD_POINTER( _source, _end_loop->size, (SOURCE_BASE), + OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _end_loop->size, (SOURCE_BASE), (DATATYPE), (TOTAL_COUNT) ); DO_DEBUG( opal_output( 0, "copy 3. memcpy( %p, %p, %lu ) => space %lu\n", _destination, _source, (unsigned long)_end_loop->size, (unsigned long)(*(SPACE) - _i * _end_loop->size) ); ); @@ -125,8 +130,8 @@ static inline void copy_contiguous_loop( const dt_elem_desc_t* ELEM, copy_contiguous_loop( (ELEM), (DATATYPE), (SOURCE_BASE), (TOTAL_COUNT), \ (COUNT), (SOURCE), (DESTINATION), &(SPACE) ) -int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t count, - char* destination_base, char* source_base ) +int32_t opal_datatype_copy_content_same_ddt( const opal_datatype_t* datatype, int32_t count, + char* destination_base, char* source_base ) { dt_stack_t* pStack; /* pointer to the position on the stack */ int32_t stack_pos; /* index of the stack level */ @@ -138,7 +143,7 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t unsigned char *source = (unsigned char*)source_base, *destination = (unsigned char*)destination_base; - DO_DEBUG( opal_output( 0, "ompi_ddt_copy_content_same_ddt( %p, %d, dst %p, src %p )\n", + DO_DEBUG( opal_output( 0, "opal_datatype_copy_content_same_ddt( %p, %d, dst %p, src %p )\n", (void*)datatype, count, destination_base, source_base ); ); /* empty data ? then do nothing. This should normally be trapped * at a higher level. @@ -150,21 +155,21 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t /* If we have to copy a contiguous datatype then simply * do a memcpy. */ - if( datatype->flags & DT_FLAG_CONTIGUOUS ) { - ptrdiff_t extent = (datatype->ub - datatype->lb); + if( datatype->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { + OPAL_PTRDIFF_TYPE extent = (datatype->ub - datatype->lb); /* Now that we know the datatype is contiguous, we should move the 2 pointers * source and destination to the correct displacement. */ destination += datatype->true_lb; source += datatype->true_lb; - if( (ptrdiff_t)datatype->size == extent ) { /* all contiguous == no gaps around */ + if( (OPAL_PTRDIFF_TYPE)datatype->size == extent ) { /* all contiguous == no gaps around */ size_t total_length = iov_len_local; - size_t memcpy_chunk = ompi_datatype_memcpy_block_size; + size_t memcpy_chunk = opal_datatype_memcpy_block_size; while( total_length > 0 ) { if( memcpy_chunk > total_length ) memcpy_chunk = total_length; - OMPI_DDT_SAFEGUARD_POINTER( destination, memcpy_chunk, + OPAL_DATATYPE_SAFEGUARD_POINTER( destination, memcpy_chunk, (unsigned char*)destination_base, datatype, count ); - OMPI_DDT_SAFEGUARD_POINTER( source, memcpy_chunk, + OPAL_DATATYPE_SAFEGUARD_POINTER( source, memcpy_chunk, (unsigned char*)source_base, datatype, count ); DO_DEBUG( opal_output( 0, "copy c1. memcpy( %p, %p, %lu ) => space %lu\n", destination, source, (unsigned long)memcpy_chunk, (unsigned long)total_length ); ); @@ -176,9 +181,9 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t return 0; /* completed */ } for( pos_desc = 0; (int32_t)pos_desc < count; pos_desc++ ) { - OMPI_DDT_SAFEGUARD_POINTER( destination, datatype->size, + OPAL_DATATYPE_SAFEGUARD_POINTER( destination, datatype->size, (unsigned char*)destination_base, datatype, count ); - OMPI_DDT_SAFEGUARD_POINTER( source, datatype->size, + OPAL_DATATYPE_SAFEGUARD_POINTER( source, datatype->size, (unsigned char*)source_base, datatype, count ); DO_DEBUG( opal_output( 0, "copy c2. memcpy( %p, %p, %lu ) => space %lu\n", destination, source, (unsigned long)datatype->size, @@ -190,7 +195,7 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t return 0; /* completed */ } - pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->btypes[DT_LOOP] + 1) ); + pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->btypes[OPAL_DATATYPE_LOOP] + 1) ); pStack->count = count; pStack->index = -1; pStack->disp = 0; @@ -203,21 +208,21 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t description = datatype->desc.desc; } - if( description[0].elem.common.type == DT_LOOP ) + if( description[0].elem.common.type == OPAL_DATATYPE_LOOP ) count_desc = description[0].loop.loops; else count_desc = description[0].elem.count; pElem = &(description[pos_desc]); while( 1 ) { - while( OPAL_LIKELY(pElem->elem.common.flags & DT_FLAG_DATA) ) { + while( OPAL_LIKELY(pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA) ) { /* now here we have a basic datatype */ COPY_PREDEFINED_DATATYPE( pElem, datatype, (unsigned char*)source_base, count, count_desc, source, destination, iov_len_local ); pos_desc++; /* advance to the next data */ UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); } - if( DT_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ + if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ DO_DEBUG( opal_output( 0, "copy end_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", (int)pStack->count, stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ @@ -233,7 +238,7 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t if( pStack->index == -1 ) { pStack->disp += (datatype->ub - datatype->lb); } else { - assert( DT_LOOP == description[pStack->index].loop.common.type ); + assert( OPAL_DATATYPE_LOOP == description[pStack->index].loop.common.type ); pStack->disp += description[pStack->index].loop.extent; } } @@ -243,16 +248,16 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t DO_DEBUG( opal_output( 0, "copy new_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", (int)pStack->count, stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); } - if( DT_LOOP == pElem->elem.common.type ) { - ptrdiff_t local_disp = (ptrdiff_t)source; - if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) { + if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { + OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)source; + if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { COPY_CONTIGUOUS_LOOP( pElem, datatype, (unsigned char*)source_base, count, count_desc, source, destination, iov_len_local ); pos_desc += pElem->loop.items + 1; goto update_loop_description; } - local_disp = (ptrdiff_t)source - local_disp; - PUSH_STACK( pStack, stack_pos, pos_desc, DT_LOOP, count_desc, + local_disp = (OPAL_PTRDIFF_TYPE)source - local_disp; + PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; update_loop_description: /* update the current state */ diff --git a/opal/datatype/opal_datatype_create.c b/opal/datatype/opal_datatype_create.c new file mode 100644 index 0000000000..5780b71603 --- /dev/null +++ b/opal/datatype/opal_datatype_create.c @@ -0,0 +1,107 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" + +#include + +#include "opal/constants.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "limits.h" +#include "opal/prefetch.h" + +static void opal_datatype_construct( opal_datatype_t* pData ) +{ + int i; + + pData->size = 0; + pData->id = 0; + pData->nbElems = 0; + pData->bdt_used = 0; + for( i = 0; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) + pData->btypes[i] = 0; + pData->btypes[OPAL_DATATYPE_LOOP] = 0; + + pData->opt_desc.desc = NULL; + pData->opt_desc.length = 0; + pData->opt_desc.used = 0; + pData->align = 1; + pData->flags = OPAL_DATATYPE_FLAG_CONTIGUOUS; + pData->true_lb = LONG_MAX; + pData->true_ub = LONG_MIN; + pData->lb = LONG_MAX; + pData->ub = LONG_MIN; + pData->name[0] = '\0'; +} + +static void opal_datatype_destruct( opal_datatype_t* datatype ) +{ + if (!opal_datatype_is_predefined(datatype)) { + if( datatype->desc.desc != NULL ) { + free( datatype->desc.desc ); + datatype->desc.length = 0; + datatype->desc.used = 0; + } + if( datatype->opt_desc.desc != NULL ) { + if( datatype->opt_desc.desc != datatype->desc.desc ) + free( datatype->opt_desc.desc ); + datatype->opt_desc.length = 0; + datatype->opt_desc.used = 0; + datatype->opt_desc.desc = NULL; + } + } + /** + * As the default description and the optimized description can point to the + * same memory location we should keep the default location pointer until we + * know what we should do with the optimized description. + */ + datatype->desc.desc = NULL; + + /* make sure the name is set to empty */ + datatype->name[0] = '\0'; +} + +OBJ_CLASS_INSTANCE(opal_datatype_t, opal_object_t, opal_datatype_construct, opal_datatype_destruct); + +opal_datatype_t* opal_datatype_create( int32_t expectedSize ) +{ + opal_datatype_t* datatype = (opal_datatype_t*)OBJ_NEW(opal_datatype_t); + + if( expectedSize == -1 ) expectedSize = DT_INCREASE_STACK; + datatype->desc.length = expectedSize + 1; /* one for the fake elem at the end */ + datatype->desc.used = 0; + datatype->desc.desc = (dt_elem_desc_t*)calloc(datatype->desc.length, sizeof(dt_elem_desc_t)); + /* XXX: an OMPI-layer configured with OPAL_MAX_OBJECT_NAME different than the OPAL-layer will not work! */ + memset( datatype->name, 0, OPAL_MAX_OBJECT_NAME ); + return datatype; +} + +int32_t opal_datatype_create_desc( opal_datatype_t * datatype, int32_t expectedSize ) +{ + if( expectedSize == -1 ) + expectedSize = DT_INCREASE_STACK; + datatype->desc.length = expectedSize + 1; /* one for the fake elem at the end */ + datatype->desc.used = 0; + datatype->desc.desc = (dt_elem_desc_t*)calloc(datatype->desc.length, sizeof(dt_elem_desc_t)); + if (NULL == datatype->desc.desc) + return OPAL_ERR_OUT_OF_RESOURCE; + return OPAL_SUCCESS; +} diff --git a/opal/datatype/opal_datatype_create_contiguous.c b/opal/datatype/opal_datatype_create_contiguous.c new file mode 100644 index 0000000000..d4a5c40a4d --- /dev/null +++ b/opal/datatype/opal_datatype_create_contiguous.c @@ -0,0 +1,41 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" +#include "opal/constants.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" + +int32_t opal_datatype_create_contiguous( int count, const opal_datatype_t* oldType, + opal_datatype_t** newType ) +{ + opal_datatype_t* pdt; + + if( 0 == count ) { + pdt = opal_datatype_create( 0 ); + opal_datatype_add( pdt, &opal_datatype_null, 0, 0, 0 ); + } else { + pdt = opal_datatype_create( oldType->desc.used + 2 ); + opal_datatype_add( pdt, oldType, count, 0, (oldType->ub - oldType->lb) ); + } + *newType = pdt; + return OPAL_SUCCESS; +} diff --git a/ompi/datatype/dt_destroy.c b/opal/datatype/opal_datatype_destroy.c similarity index 58% rename from ompi/datatype/dt_destroy.c rename to opal/datatype/opal_datatype_destroy.c index 55f59dac06..d468cd07e8 100644 --- a/ompi/datatype/dt_destroy.c +++ b/opal/datatype/opal_datatype_destroy.c @@ -3,13 +3,14 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,19 +18,20 @@ * $HEADER$ */ -#include "ompi_config.h" -#include "ompi/constants.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_internal.h" +#include "opal_config.h" +#include "opal/constants.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" -int32_t ompi_ddt_destroy( ompi_datatype_t** dt ) +int32_t opal_datatype_destroy( opal_datatype_t** dt ) { - ompi_datatype_t* pData = *dt; + opal_datatype_t* pData = *dt; - if( (pData->flags & DT_FLAG_PREDEFINED) && (pData->super.obj_reference_count <= 1) ) - return OMPI_ERROR; + if( (pData->flags & OPAL_DATATYPE_FLAG_PREDEFINED) && + (pData->super.obj_reference_count <= 1) ) + return OPAL_ERROR; OBJ_RELEASE( pData ); *dt = NULL; - return OMPI_SUCCESS; + return OPAL_SUCCESS; } diff --git a/opal/datatype/opal_datatype_dump.c b/opal/datatype/opal_datatype_dump.c new file mode 100644 index 0000000000..8f57c4108d --- /dev/null +++ b/opal/datatype/opal_datatype_dump.c @@ -0,0 +1,148 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" + +#include +#include + +#include "opal/constants.h" +#include "opal/util/output.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" + +/******************************************************** + * Data dumping functions + ********************************************************/ + +int opal_datatype_contain_basic_datatypes( const opal_datatype_t* pData, char* ptr, size_t length ) +{ + int i; + int32_t index = 0; + uint64_t mask = 1; + + if( pData->flags & OPAL_DATATYPE_FLAG_USER_LB ) index += snprintf( ptr, length - index, "lb " ); + if( pData->flags & OPAL_DATATYPE_FLAG_USER_UB ) index += snprintf( ptr + index, length - index, "ub " ); + for( i = 0; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) { + if( pData->bdt_used & mask ) + index += snprintf( ptr + index, length - index, "%s ", opal_datatype_basicDatatypes[i]->name ); + mask <<= 1; + if( length <= (size_t)index ) break; + } + return index; +} + +int opal_datatype_dump_data_flags( unsigned short usflags, char* ptr, size_t length ) +{ + int index = 0; + if( length < 22 ) return 0; + index = snprintf( ptr, 22, "-----------[---][---]" ); /* set everything to - */ + if( usflags & OPAL_DATATYPE_FLAG_COMMITED ) ptr[1] = 'c'; + if( usflags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) ptr[2] = 'C'; + if( usflags & OPAL_DATATYPE_FLAG_OVERLAP ) ptr[3] = 'o'; + if( usflags & OPAL_DATATYPE_FLAG_USER_LB ) ptr[4] = 'l'; + if( usflags & OPAL_DATATYPE_FLAG_USER_UB ) ptr[5] = 'u'; + if( usflags & OPAL_DATATYPE_FLAG_PREDEFINED ) ptr[6] = 'P'; + if( !(usflags & OPAL_DATATYPE_FLAG_NO_GAPS) ) ptr[7] = 'G'; + if( usflags & OPAL_DATATYPE_FLAG_DATA ) ptr[8] = 'D'; + if( (usflags & OPAL_DATATYPE_FLAG_BASIC) == OPAL_DATATYPE_FLAG_BASIC ) ptr[9] = 'B'; + /* We know nothing about the upper level language! This is part of _ompi_dump_data_flags */ + /* ... */ + return index; +} + + +int opal_datatype_dump_data_desc( dt_elem_desc_t* pDesc, int nbElems, char* ptr, size_t length ) +{ + int i; + int32_t index = 0; + + for( i = 0; i < nbElems; i++ ) { + index += opal_datatype_dump_data_flags( pDesc->elem.common.flags, ptr + index, length ); + if( length <= (size_t)index ) break; + index += snprintf( ptr + index, length - index, "%15s ", opal_datatype_basicDatatypes[pDesc->elem.common.type]->name ); + if( length <= (size_t)index ) break; + if( OPAL_DATATYPE_LOOP == pDesc->elem.common.type ) + index += snprintf( ptr + index, length - index, "%d times the next %d elements extent %d\n", + (int)pDesc->loop.loops, (int)pDesc->loop.items, + (int)pDesc->loop.extent ); + else if( OPAL_DATATYPE_END_LOOP == pDesc->elem.common.type ) + index += snprintf( ptr + index, length - index, "prev %d elements first elem displacement %ld size of data %d\n", + (int)pDesc->end_loop.items, (long)pDesc->end_loop.first_elem_disp, + (int)pDesc->end_loop.size ); + else + index += snprintf( ptr + index, length - index, "count %d disp 0x%lx (%ld) extent %d (size %ld)\n", + (int)pDesc->elem.count, (long)pDesc->elem.disp, (long)pDesc->elem.disp, + (int)pDesc->elem.extent, (long)(pDesc->elem.count * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) ); + pDesc++; + + if( length <= (size_t)index ) break; + } + return index; +} + + +void opal_datatype_dump( const opal_datatype_t* pData ) +{ + size_t length; + int index = 0; + char* buffer; + + length = pData->opt_desc.used + pData->desc.used; + length = length * 100 + 500; + buffer = (char*)malloc( length ); + index += snprintf( buffer, length - index, "Datatype %p[%s] size %ld align %d id %d length %d used %d\n" + "true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n" + "nbElems %d loops %d flags %X (", + (void*)pData, pData->name, (long)pData->size, (int)pData->align, pData->id, (int)pData->desc.length, (int)pData->desc.used, + (long)pData->true_lb, (long)pData->true_ub, (long)(pData->true_ub - pData->true_lb), + (long)pData->lb, (long)pData->ub, (long)(pData->ub - pData->lb), + (int)pData->nbElems, (int)pData->btypes[OPAL_DATATYPE_LOOP], (int)pData->flags ); + /* dump the flags */ + if( pData->flags == OPAL_DATATYPE_FLAG_PREDEFINED ) + index += snprintf( buffer + index, length - index, "predefined " ); + else { + if( pData->flags & OPAL_DATATYPE_FLAG_COMMITED ) index += snprintf( buffer + index, length - index, "commited " ); + if( pData->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) index += snprintf( buffer + index, length - index, "contiguous " ); + } + index += snprintf( buffer + index, length - index, ")" ); + index += opal_datatype_dump_data_flags( pData->flags, buffer + index, length - index ); + { + index += snprintf( buffer + index, length - index, "\n contain " ); + index += opal_datatype_contain_basic_datatypes( pData, buffer + index, length - index ); + index += snprintf( buffer + index, length - index, "\n" ); + } + if( (pData->opt_desc.desc != pData->desc.desc) && (NULL != pData->opt_desc.desc) ) { + /* If the data is already committed print everything including the last + * fake OPAL_DATATYPE_END_LOOP entry. + */ + index += opal_datatype_dump_data_desc( pData->desc.desc, pData->desc.used + 1, buffer + index, length - index ); + index += snprintf( buffer + index, length - index, "Optimized description \n" ); + index += opal_datatype_dump_data_desc( pData->opt_desc.desc, pData->opt_desc.used + 1, buffer + index, length - index ); + } else { + index += opal_datatype_dump_data_desc( pData->desc.desc, pData->desc.used, buffer + index, length - index ); + index += snprintf( buffer + index, length - index, "No optimized description\n" ); + } + buffer[index] = '\0'; /* make sure we end the string with 0 */ + opal_output( 0, "%s\n", buffer ); + + free(buffer); +} diff --git a/ompi/datatype/fake_stack.c b/opal/datatype/opal_datatype_fake_stack.c similarity index 80% rename from ompi/datatype/fake_stack.c rename to opal/datatype/opal_datatype_fake_stack.c index ecc4819906..1cb436381b 100644 --- a/ompi/datatype/fake_stack.c +++ b/opal/datatype/opal_datatype_fake_stack.c @@ -3,13 +3,14 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,40 +18,43 @@ * $HEADER$ */ -#include "ompi_config.h" +#include "opal_config.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype_internal.h" +#include +#include #ifdef HAVE_ALLOCA_H #include #endif -#include -int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" + + +int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, size_t starting_point, const size_t* sizes ); static inline size_t -ompi_convertor_compute_remote_size( const ompi_datatype_t* pData, const size_t* sizes ) +opal_convertor_compute_remote_size( const opal_datatype_t* pData, const size_t* sizes ) { uint32_t i; size_t length = 0; - for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) { + for( i = OPAL_DATATYPE_FIRST_TYPE; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) { length += (pData->btypes[i] * sizes[i]); } return length; } -int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, +int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, size_t starting_point, const size_t* sizes ) { dt_stack_t* pStack; /* pointer to the position on the stack */ int pos_desc; /* actual position in the description of the derived datatype */ size_t lastLength = 0; - const ompi_datatype_t* pData = pConvertor->pDesc; + const opal_datatype_t* pData = pConvertor->pDesc; size_t loop_length, *remoteLength, remote_size; size_t resting_place = starting_point; dt_elem_desc_t* pElems; @@ -66,27 +70,27 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, pConvertor->stack_pos = 0; pStack = pConvertor->pStack; /* Fill the first position on the stack. This one correspond to the - * last fake DT_END_LOOP that we add to the data representation and + * last fake OPAL_DATATYPE_END_LOOP that we add to the data representation and * allow us to move quickly inside the datatype when we have a count. */ pElems = pConvertor->use_desc->desc; - if( (pConvertor->flags & CONVERTOR_HOMOGENEOUS) && (pData->flags & DT_FLAG_CONTIGUOUS) ) { + if( (pConvertor->flags & CONVERTOR_HOMOGENEOUS) && (pData->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) ) { /* Special case for contiguous datatypes */ int32_t cnt = (int32_t)(starting_point / pData->size); - ptrdiff_t extent = pData->ub - pData->lb; + OPAL_PTRDIFF_TYPE extent = pData->ub - pData->lb; loop_length = GET_FIRST_NON_LOOP( pElems ); pStack[0].disp = pElems[loop_length].elem.disp; - pStack[0].type = DT_LOOP; + pStack[0].type = OPAL_DATATYPE_LOOP; pStack[0].count = pConvertor->count - cnt; cnt = (int32_t)(starting_point - cnt * pData->size); /* number of bytes after the loop */ pStack[1].index = 0; - pStack[1].type = DT_BYTE; + pStack[1].type = OPAL_DATATYPE_UINT1; pStack[1].disp = pStack[0].disp; pStack[1].count = pData->size - cnt; - if( (ptrdiff_t)pData->size == extent ) { /* all elements are contiguous */ + if( (OPAL_PTRDIFF_TYPE)pData->size == extent ) { /* all elements are contiguous */ pStack[1].disp += starting_point; } else { /* each is contiguous but there are gaps inbetween */ pStack[1].disp += (pConvertor->count - pStack[0].count) * extent + cnt; @@ -94,11 +98,11 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, pConvertor->bConverted = starting_point; pConvertor->stack_pos = 1; - return OMPI_SUCCESS; + return OPAL_SUCCESS; } /* remove from the main loop all the complete datatypes */ - remote_size = ompi_convertor_compute_remote_size( pData, sizes ); + remote_size = opal_convertor_compute_remote_size( pData, sizes ); count = (int32_t)(starting_point / remote_size); resting_place -= (remote_size * count); pStack->count = pConvertor->count - count; @@ -108,7 +112,7 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, pStack->disp = count * (pData->ub - pData->lb) + pElems[loop_length].elem.disp; pos_desc = 0; - remoteLength = (size_t*)alloca( sizeof(size_t) * (pConvertor->pDesc->btypes[DT_LOOP] + 1)); + remoteLength = (size_t*)alloca( sizeof(size_t) * (pConvertor->pDesc->btypes[OPAL_DATATYPE_LOOP] + 1)); remoteLength[0] = 0; /* initial value set to ZERO */ loop_length = 0; @@ -116,9 +120,9 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, * when we finish the whole datatype. */ while( pos_desc < (int32_t)pConvertor->use_desc->used ) { - if( DT_END_LOOP == pElems->elem.common.type ) { /* end of the current loop */ + if( OPAL_DATATYPE_END_LOOP == pElems->elem.common.type ) { /* end of the current loop */ ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)pElems; - ptrdiff_t extent; + OPAL_PTRDIFF_TYPE extent; if( (loop_length * pStack->count) > resting_place ) { /* We will stop somewhere on this loop. To avoid moving inside the loop @@ -130,7 +134,7 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, if( pStack->index == -1 ) { extent = pData->ub - pData->lb; } else { - assert( DT_LOOP == (pElems - end_loop->items)->loop.common.type ); + assert( OPAL_DATATYPE_LOOP == (pElems - end_loop->items)->loop.common.type ); extent = ((ddt_loop_desc_t*)(pElems - end_loop->items))->extent; } pStack->count -= (cnt + 1); @@ -155,18 +159,18 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, loop_length = remoteLength[pConvertor->stack_pos]; continue; } - if( DT_LOOP == pElems->elem.common.type ) { + if( OPAL_DATATYPE_LOOP == pElems->elem.common.type ) { remoteLength[pConvertor->stack_pos] += loop_length; - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, pElems->loop.loops, pStack->disp ); pos_desc++; pElems++; remoteLength[pConvertor->stack_pos] = 0; loop_length = 0; /* starting a new loop */ } - while( pElems->elem.common.flags & DT_FLAG_DATA ) { + while( pElems->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ - const ompi_datatype_t* basic_type = BASIC_DDT_FROM_ELEM( (*pElems) ); + const opal_datatype_t* basic_type = BASIC_DDT_FROM_ELEM( (*pElems) ); lastLength = pElems->elem.count * basic_type->size; if( resting_place < lastLength ) { int32_t cnt = (int32_t)(resting_place / basic_type->size); @@ -178,7 +182,7 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, pConvertor->bConverted = starting_point - resting_place; DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pConvertor->pDesc->desc.desc, pConvertor->pDesc->name ); - return OMPI_SUCCESS; + return OPAL_SUCCESS; } loop_length += lastLength; resting_place -= lastLength; @@ -190,5 +194,5 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor, /* Correctly update the bConverted field */ pConvertor->flags |= CONVERTOR_COMPLETED; pConvertor->bConverted = pConvertor->local_size; - return OMPI_SUCCESS; + return OPAL_SUCCESS; } diff --git a/ompi/datatype/dt_get_count.c b/opal/datatype/opal_datatype_get_count.c similarity index 70% rename from ompi/datatype/dt_get_count.c rename to opal/datatype/opal_datatype_get_count.c index 6e18417db6..5ffb9da94a 100644 --- a/ompi/datatype/dt_get_count.c +++ b/opal/datatype/opal_datatype_get_count.c @@ -1,8 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,10 +11,10 @@ * $HEADER$ */ -#include "ompi_config.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype_internal.h" +#include "opal_config.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" #ifdef HAVE_ALLOCA_H #include @@ -27,7 +28,7 @@ * positive = number of basic elements inside * negative = some error occurs */ -int32_t ompi_ddt_get_element_count( const ompi_datatype_t* datatype, size_t iSize ) +int32_t opal_datatype_get_element_count( const opal_datatype_t* datatype, size_t iSize ) { dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ @@ -40,15 +41,15 @@ int32_t ompi_ddt_get_element_count( const ompi_datatype_t* datatype, size_t iSiz */ assert( (uint32_t)iSize <= datatype->size ); DUMP( "dt_count_elements( %p, %d )\n", (void*)datatype, iSize ); - pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->btypes[DT_LOOP] + 2) ); + pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->btypes[OPAL_DATATYPE_LOOP] + 2) ); pStack->count = 1; pStack->index = -1; pStack->disp = 0; pElems = datatype->desc.desc; pos_desc = 0; - while( 1 ) { /* loop forever the exit condition is on the last DT_END_LOOP */ - if( DT_END_LOOP == pElems[pos_desc].elem.common.type ) { /* end of the current loop */ + while( 1 ) { /* loop forever the exit condition is on the last OPAL_DATATYPE_END_LOOP */ + if( OPAL_DATATYPE_END_LOOP == pElems[pos_desc].elem.common.type ) { /* end of the current loop */ if( --(pStack->count) == 0 ) { /* end of loop */ stack_pos--; pStack--; if( stack_pos == -1 ) return nbElems; /* completed */ @@ -56,17 +57,17 @@ int32_t ompi_ddt_get_element_count( const ompi_datatype_t* datatype, size_t iSiz pos_desc = pStack->index + 1; continue; } - if( DT_LOOP == pElems[pos_desc].elem.common.type ) { + if( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ) { ddt_loop_desc_t* loop = &(pElems[pos_desc].loop); do { - PUSH_STACK( pStack, stack_pos, pos_desc, DT_LOOP, loop->loops, 0 ); + PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, loop->loops, 0 ); pos_desc++; - } while( DT_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */ + } while( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */ DDT_DUMP_STACK( pStack, stack_pos, pElems, "advance loops" ); } - while( pElems[pos_desc].elem.common.flags & DT_FLAG_DATA ) { + while( pElems[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ - const ompi_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]); + const opal_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]); local_size = pElems[pos_desc].elem.count * basic_type->size; if( local_size >= iSize ) { local_size = iSize / basic_type->size; @@ -81,7 +82,7 @@ int32_t ompi_ddt_get_element_count( const ompi_datatype_t* datatype, size_t iSiz } } -int32_t ompi_ddt_set_element_count( const ompi_datatype_t* datatype, uint32_t count, size_t* length ) +int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, uint32_t count, size_t* length ) { dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ @@ -92,7 +93,7 @@ int32_t ompi_ddt_set_element_count( const ompi_datatype_t* datatype, uint32_t co /** * Handle all complete multiple of the datatype. */ - for( pos_desc = 4; pos_desc < DT_MAX_PREDEFINED; pos_desc++ ) { + for( pos_desc = 4; pos_desc < OPAL_DATATYPE_MAX_PREDEFINED; pos_desc++ ) { local_length += datatype->btypes[pos_desc]; } pos_desc = count / local_length; @@ -103,15 +104,15 @@ int32_t ompi_ddt_set_element_count( const ompi_datatype_t* datatype, uint32_t co } DUMP( "dt_set_element_count( %p, %d )\n", (void*)datatype, count ); - pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->btypes[DT_LOOP] + 2) ); + pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (datatype->btypes[OPAL_DATATYPE_LOOP] + 2) ); pStack->count = 1; pStack->index = -1; pStack->disp = 0; pElems = datatype->desc.desc; pos_desc = 0; - while( 1 ) { /* loop forever the exit condition is on the last DT_END_LOOP */ - if( DT_END_LOOP == pElems[pos_desc].elem.common.type ) { /* end of the current loop */ + while( 1 ) { /* loop forever the exit condition is on the last OPAL_DATATYPE_END_LOOP */ + if( OPAL_DATATYPE_END_LOOP == pElems[pos_desc].elem.common.type ) { /* end of the current loop */ if( --(pStack->count) == 0 ) { /* end of loop */ stack_pos--; pStack--; if( stack_pos == -1 ) return 0; @@ -119,17 +120,17 @@ int32_t ompi_ddt_set_element_count( const ompi_datatype_t* datatype, uint32_t co pos_desc = pStack->index + 1; continue; } - if( DT_LOOP == pElems[pos_desc].elem.common.type ) { + if( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ) { ddt_loop_desc_t* loop = &(pElems[pos_desc].loop); do { - PUSH_STACK( pStack, stack_pos, pos_desc, DT_LOOP, loop->loops, 0 ); + PUSH_STACK( pStack, stack_pos, pos_desc, OPAL_DATATYPE_LOOP, loop->loops, 0 ); pos_desc++; - } while( DT_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */ + } while( OPAL_DATATYPE_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */ DDT_DUMP_STACK( pStack, stack_pos, pElems, "advance loops" ); } - while( pElems[pos_desc].elem.common.flags & DT_FLAG_DATA ) { + while( pElems[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ - const ompi_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]); + const opal_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]); local_length = pElems[pos_desc].elem.count; if( local_length >= count ) { *length += count * basic_type->size; diff --git a/opal/datatype/opal_datatype_internal.h b/opal/datatype/opal_datatype_internal.h new file mode 100644 index 0000000000..9aa49f71cb --- /dev/null +++ b/opal/datatype/opal_datatype_internal.h @@ -0,0 +1,487 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef OPAL_DATATYPE_INTERNAL_H_HAS_BEEN_INCLUDED +#define OPAL_DATATYPE_INTERNAL_H_HAS_BEEN_INCLUDED + +#include "opal_config.h" + +#include +#include + +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_STDINT_H +#include +#endif + +#if defined(VERBOSE) +#include "opal/util/output.h" + +extern int opal_datatype_dfd; + +# define DDT_DUMP_STACK( PSTACK, STACK_POS, PDESC, NAME ) \ + opal_datatype_dump_stack( (PSTACK), (STACK_POS), (PDESC), (NAME) ) +# if defined(ACCEPT_C99) +# define DUMP( ARGS... ) opal_output(opal_datatype_dfd, __VA_ARGS__) +# else +# if defined(__GNUC__) && !defined(__STDC__) +# define DUMP(ARGS...) opal_output( opal_datatype_dfd, ARGS) +# else +static inline void DUMP( char* fmt, ... ) +{ + va_list list; + + va_start( list, fmt ); + opal_output( opal_datatype_dfd, fmt, list ); + va_end( list ); +} +# define DUMP printf +# endif /* __GNUC__ && !__STDC__ */ +# endif /* ACCEPT_C99 */ +#else +# define DDT_DUMP_STACK( PSTACK, STACK_POS, PDESC, NAME ) +# if defined(ACCEPT_C99) +# define DUMP(ARGS...) +# else +# if defined(__GNUC__) && !defined(__STDC__) +# define DUMP(ARGS...) +# else + static inline void DUMP( char* fmt, ...) { +#if defined(__PGI) + /* Some copallers complain if we have ... and no + corresponding va_start() */ + va_list arglist; + va_start(arglist, fmt); + va_end(arglist); +#endif + } +# endif /* __GNUC__ && !__STDC__ */ +# endif /* ACCEPT_C99 */ +#endif /* VERBOSE */ + + +/* + * There 3 types of predefined data types. + * - the basic one composed by just one basic datatype which are + * definitively contiguous + * - the derived ones where the same basic type is used multiple times. + * They should be most of the time contiguous. + * - and finally the derived one where multiple basic types are used. + * Depending on the architecture they can be contiguous or not. + * + * At the OPAL-level we do not care from which language the datatype came from + * (C, C++ or FORTRAN), we only focus on their internal representation in + * the host memory. + * + * NOTE: This (and in ompi_datatype_internal.h) is the id-order to obey + */ +#define OPAL_DATATYPE_LOOP 0 +#define OPAL_DATATYPE_END_LOOP 1 +#define OPAL_DATATYPE_LB 2 +#define OPAL_DATATYPE_UB 3 +#define OPAL_DATATYPE_FIRST_TYPE 4 /* Number of first real type */ +#define OPAL_DATATYPE_INT1 4 +#define OPAL_DATATYPE_INT2 5 +#define OPAL_DATATYPE_INT4 6 +#define OPAL_DATATYPE_INT8 7 +#define OPAL_DATATYPE_INT16 8 +#define OPAL_DATATYPE_UINT1 9 +#define OPAL_DATATYPE_UINT2 10 +#define OPAL_DATATYPE_UINT4 11 +#define OPAL_DATATYPE_UINT8 12 +#define OPAL_DATATYPE_UINT16 13 +#define OPAL_DATATYPE_FLOAT2 14 +#define OPAL_DATATYPE_FLOAT4 15 +#define OPAL_DATATYPE_FLOAT8 16 +#define OPAL_DATATYPE_FLOAT12 17 +#define OPAL_DATATYPE_FLOAT16 18 +#define OPAL_DATATYPE_BOOL 19 +#define OPAL_DATATYPE_WCHAR 20 +#define OPAL_DATATYPE_UNAVAILABLE 21 + +#ifndef OPAL_DATATYPE_MAX_PREDEFINED +#define OPAL_DATATYPE_MAX_PREDEFINED 22 +#endif + +/* + * If the number of basic datatype should change update + * OPAL_DATATYPE_MAX_PREDEFINED in datatype.h + */ +#if OPAL_DATATYPE_MAX_PREDEFINED <= OPAL_DATATYPE_UNAVAILABLE +#error OPAL_DATATYPE_MAX_PREDEFINED should be updated to the next value after the OPAL_DATATYPE_UNAVAILABLE define +#endif + +#define DT_INCREASE_STACK 8 + +BEGIN_C_DECLS + +struct ddt_elem_id_description { + uint16_t flags; /**< flags for the record */ + uint16_t type; /**< the basic data type id */ +}; +typedef struct ddt_elem_id_description ddt_elem_id_description; + +/* the basic element. A data description is composed + * by a set of basic elements. + */ +struct ddt_elem_desc { + ddt_elem_id_description common; /**< basic data description and flags */ + uint32_t count; /**< number of blocks */ + uint32_t blocklen; /**< number of elements on each block */ + OPAL_PTRDIFF_TYPE extent; /**< extent of each block (in bytes) */ + OPAL_PTRDIFF_TYPE disp; /**< displacement of the first block */ +}; +typedef struct ddt_elem_desc ddt_elem_desc_t; + +struct ddt_loop_desc { + ddt_elem_id_description common; /**< basic data description and flags */ + uint32_t loops; /**< number of elements */ + uint32_t items; /**< number of items in the loop */ + size_t unused; /**< not used right now */ + OPAL_PTRDIFF_TYPE extent; /**< extent of the whole loop */ +}; +typedef struct ddt_loop_desc ddt_loop_desc_t; + +struct ddt_endloop_desc { + ddt_elem_id_description common; /**< basic data description and flags */ + uint32_t items; /**< number of elements */ + uint32_t unused; /**< not used right now */ + size_t size; /**< real size of the data in the loop */ + OPAL_PTRDIFF_TYPE first_elem_disp; /**< the displacement of the first block in the loop */ +}; +typedef struct ddt_endloop_desc ddt_endloop_desc_t; + +union dt_elem_desc { + ddt_elem_desc_t elem; + ddt_loop_desc_t loop; + ddt_endloop_desc_t end_loop; +}; + +#define CREATE_LOOP_START( _place, _count, _items, _extent, _flags ) \ + do { \ + (_place)->loop.common.type = OPAL_DATATYPE_LOOP; \ + (_place)->loop.common.flags = (_flags) & ~OPAL_DATATYPE_FLAG_DATA; \ + (_place)->loop.loops = (_count); \ + (_place)->loop.items = (_items); \ + (_place)->loop.extent = (_extent); \ + (_place)->loop.unused = -1; \ + } while(0) + +#define CREATE_LOOP_END( _place, _items, _first_item_disp, _size, _flags ) \ + do { \ + (_place)->end_loop.common.type = OPAL_DATATYPE_END_LOOP; \ + (_place)->end_loop.common.flags = (_flags) & ~OPAL_DATATYPE_FLAG_DATA; \ + (_place)->end_loop.items = (_items); \ + (_place)->end_loop.first_elem_disp = (_first_item_disp); \ + (_place)->end_loop.size = (_size); /* the size inside the loop */ \ + (_place)->end_loop.unused = -1; \ + } while(0) + +#define CREATE_ELEM( _place, _type, _flags, _count, _disp, _extent ) \ + do { \ + (_place)->elem.common.flags = (_flags) | OPAL_DATATYPE_FLAG_DATA; \ + (_place)->elem.common.type = (_type); \ + (_place)->elem.count = (_count); \ + (_place)->elem.disp = (_disp); \ + (_place)->elem.extent = (_extent); \ + (_place)->elem.blocklen = 1; \ + } while(0) +/* + * This array holds the descriptions desc.desc[2] of the predefined basic datatypes. + */ +extern union dt_elem_desc opal_datatype_predefined_elem_desc[2 * OPAL_DATATYPE_MAX_PREDEFINED]; +struct opal_datatype_t; +extern const struct opal_datatype_t* opal_datatype_basicDatatypes[OPAL_DATATYPE_MAX_PREDEFINED]; + +/* Other fields starting after bdt_used (index of OPAL_DATATYPE_LOOP should be ONE) */ +/* + * NOTE: The order of initialization *MUST* match the order of the OPAL_DATATYPE_-numbers. + * Unfortunateley, I don't get the preprocessor to replace + * OPAL_DATATYPE_INIT_BTYPES_ARRAY_ ## OPAL_DATATYPE ## NAME + * into + * OPAL_DATATYPE_INIT_BTYPES_ARRAY_[0-21], then order and naming would _not_ matter.... + */ +#define Z5 0, 0, 0, 0, 0 +#define Z10 Z5, Z5 +#define Z15 Z10, Z5 +#define Z20 Z10, Z10 +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_UNAVAILABLE { 0, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_LOOP { 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_END_LOOP { 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_LB { 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_UB { 0, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_INT1 { 0, 0, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_INT2 { Z5, 1, } /*5*/ +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_INT4 { Z5, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_INT8 { Z5, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_INT16 { Z5, 0, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_UINT1 { Z5, 0, 0, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_UINT2 { Z10, 1, } /*10*/ +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_UINT4 { Z10, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_UINT8 { Z10, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_UINT16 { Z10, 0, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_FLOAT2 { Z10, 0, 0, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_FLOAT4 { Z15, 1, } /*15*/ +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_FLOAT8 { Z15, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_FLOAT12 { Z15, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_FLOAT16 { Z15, 0, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_BOOL { Z15, 0, 0, 0, 0, 1, } +#define OPAL_DATATYPE_INIT_BTYPES_ARRAY_WCHAR { Z20, 1, } /*20*/ + +#define OPAL_DATATYPE_INIT_NAME(NAME) "OPAL_" # NAME + +/* + * Macro to initialize the main description for basic types, setting the pointer + * into the array opal_datatype_predefined_type_desc, which is initialized at + * runtime in opal_datatype_init(). Each basic type has two desc-elements.... + */ +#define OPAL_DATATYPE_INIT_DESC_PREDEFINED(NAME) \ + { \ + 1 /*length*/, 1/*used*/, \ + &(opal_datatype_predefined_elem_desc[2 * OPAL_DATATYPE_ ## NAME]) /*desc*/ \ + } +#define OPAL_DATATYPE_INIT_DESC_NULL {0 /*length*/, 0/*used*/, NULL /*desc*/} + +#define OPAL_DATATYPE_INITIALIZER_NULL( FLAGS ) \ + { \ + OPAL_OBJ_STATIC_INIT(opal_datatype_t), \ + OPAL_DATATYPE_FLAG_PREDEFINED | (FLAGS) /*flag*/, \ + 0 /*id*/, \ + 0 /*bdt_used*/, \ + 0 /*size*/, \ + 0 /*true_lb*/, 0 /*true_ub*/, 0 /*lb*/, 0 /*ub*/, \ + 0 /*align*/, \ + 1 /*nbElems*/, \ + OPAL_DATATYPE_INIT_NAME(NULL), /*name*/ \ + OPAL_DATATYPE_INIT_DESC_NULL, /*desc*/ \ + OPAL_DATATYPE_INIT_DESC_NULL, /*opt_desc*/ \ + OPAL_DATATYPE_INIT_BTYPES_ARRAY_UNAVAILABLE /*btypes*/ \ + } + +#define OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) \ + { \ + OPAL_OBJ_STATIC_INIT(opal_datatype_t), \ + OPAL_DATATYPE_FLAG_UNAVAILABLE | OPAL_DATATYPE_FLAG_PREDEFINED | (FLAGS) /*flag*/, \ + 0 /*id*/, \ + 0 /*bdt_used*/, \ + 0 /*size*/, \ + 0 /*true_lb*/, 0 /*true_ub*/, 0 /*lb*/, 0 /*ub*/, \ + 0 /*align*/, \ + 1 /*nbElems*/, \ + OPAL_DATATYPE_INIT_NAME(UNAVAILABLE), /*name*/ \ + OPAL_DATATYPE_INIT_DESC_PREDEFINED(UNAVAILABLE), /*desc*/ \ + OPAL_DATATYPE_INIT_DESC_PREDEFINED(UNAVAILABLE), /*opt_desc*/ \ + OPAL_DATATYPE_INIT_BTYPES_ARRAY_UNAVAILABLE /*btypes*/ \ + } + +#define OPAL_DATATYPE_INIT_BASIC_TYPE( TYPE, NAME, FLAGS ) \ + { \ + OPAL_OBJ_STATIC_INIT(opal_datatype_t), \ + OPAL_DATATYPE_FLAG_PREDEFINED | (FLAGS) /*flag*/, \ + TYPE /*id*/, \ + (((uint32_t)1)<<(TYPE)) /*bdt_used*/, \ + 0 /*size*/, \ + 0 /*true_lb*/, 0 /*true_ub*/, 0 /*lb*/, 0 /*ub*/, \ + 0 /*align*/, \ + 1 /*nbElems*/, \ + OPAL_DATATYPE_INIT_NAME(NAME), /*name*/ \ + OPAL_DATATYPE_INIT_DESC_NULL, /*desc*/ \ + OPAL_DATATYPE_INIT_DESC_NULL, /*opt_desc*/ \ + OPAL_DATATYPE_INIT_BTYPES_ARRAY_ ## NAME /*btypes*/ \ + } + + +#define OPAL_DATATYPE_INIT_BASIC_DATATYPE( TYPE, ALIGN, NAME, FLAGS ) \ + { \ + OPAL_OBJ_STATIC_INIT(opal_datatype_t), \ + OPAL_DATATYPE_FLAG_BASIC | (FLAGS) /*flag*/, \ + OPAL_DATATYPE_ ## NAME /*id*/, \ + (((uint32_t)1)<<(OPAL_DATATYPE_ ## NAME)) /*bdt_used*/, \ + sizeof(TYPE) /*size*/, \ + 0 /*true_lb*/, sizeof(TYPE) /*true_ub*/, 0 /*lb*/, sizeof(TYPE) /*ub*/, \ + (ALIGN) /*align*/, \ + 1 /*nbElems*/, \ + OPAL_DATATYPE_INIT_NAME(NAME) /*name*/, \ + OPAL_DATATYPE_INIT_DESC_PREDEFINED(NAME) /*desc*/, \ + OPAL_DATATYPE_INIT_DESC_PREDEFINED(NAME) /*opt_desc*/, \ + OPAL_DATATYPE_INIT_BTYPES_ARRAY_ ## NAME /*btypes*/ \ + } + + +#define OPAL_DATATYPE_INITIALIZER_LOOP(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_LOOP, LOOP, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_END_LOOP(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_END_LOOP, END_LOOP, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_LB(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_LB, LB, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_UB(FLAGS) OPAL_DATATYPE_INIT_BASIC_TYPE( OPAL_DATATYPE_UB, UB, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_INT1(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( int8_t, OPAL_ALIGNMENT_INT8, INT1, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_INT2(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( int16_t, OPAL_ALIGNMENT_INT16, INT2, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_INT4(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( int32_t, OPAL_ALIGNMENT_INT32, INT4, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_INT8(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( int64_t, OPAL_ALIGNMENT_INT64, INT8, FLAGS ) +#ifdef HAVE_INT128_T +#define OPAL_DATATYPE_INITIALIZER_INT16(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( int128_t, OPAL_ALIGNMENT_INT128, INT16, FLAGS ) +#else +#define OPAL_DATATYPE_INITIALIZER_INT16(FLAGS) OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) +/* #warning OPAL_DATATYPE_INITIALIZER_INT16 not available */ +#endif +#define OPAL_DATATYPE_INITIALIZER_UINT1(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( uint8_t, OPAL_ALIGNMENT_INT8, UINT1, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_UINT2(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( uint16_t, OPAL_ALIGNMENT_INT16, UINT2, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_UINT4(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( uint32_t, OPAL_ALIGNMENT_INT32, UINT4, FLAGS ) +#define OPAL_DATATYPE_INITIALIZER_UINT8(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( uint64_t, OPAL_ALIGNMENT_INT64, UINT8, FLAGS ) +#ifdef HAVE_UINT128_T +#define OPAL_DATATYPE_INITIALIZER_UINT16(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( uint128_t, OPAL_ALIGNMENT_INT128, UINT16, FLAGS ) +#else +#define OPAL_DATATYPE_INITIALIZER_UINT16(FLAGS) OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) +/* #warning OPAL_DATATYPE_INITIALIZER_UINT16 not available */ +#endif + +#if SIZEOF_FLOAT == 2 +#define OPAL_DATATYPE_INITIALIZER_FLOAT2(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( float, OPAL_ALIGNMENT_FLOAT, FLOAT2, FLAGS ) +#elif SIZEOF_DOUBLE == 2 +#define OPAL_DATATYPE_INITIALIZER_FLOAT2(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( double, OPAL_ALIGNMENT_DOUBLE, FLOAT2, FLAGS ) +#elif SIZEOF_LONG_DOUBLE == 2 +#define OPAL_DATATYPE_INITIALIZER_FLOAT2(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( long double, OPAL_ALIGNMENT_LONG_DOUBLE, FLOAT2, FLAGS ) +#else +#define OPAL_DATATYPE_INITIALIZER_FLOAT2(FLAGS) OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) +/* #warning OPAL_DATATYPE_INITIALIZER_FLOAT2 not available */ +#endif + +#if SIZEOF_FLOAT == 4 +#define OPAL_DATATYPE_INITIALIZER_FLOAT4(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( float, OPAL_ALIGNMENT_FLOAT, FLOAT4, FLAGS ) +#elif SIZEOF_DOUBLE == 4 +#define OPAL_DATATYPE_INITIALIZER_FLOAT4(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( double, OPAL_ALIGNMENT_DOUBLE, FLOAT4, FLAGS ) +#elif SIZEOF_LONG_DOUBLE == 4 +#define OPAL_DATATYPE_INITIALIZER_FLOAT4(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( long double, OPAL_ALIGNMENT_LONG_DOUBLE, FLOAT4, FLAGS ) +#else +#define OPAL_DATATYPE_INITIALIZER_FLOAT4(FLAGS) OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) +/* #warning OPAL_DATATYPE_INITIALIZER_FLOAT4 not available */ +#endif + +#if SIZEOF_FLOAT == 8 +#define OPAL_DATATYPE_INITIALIZER_FLOAT8(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( float, OPAL_ALIGNMENT_FLOAT, FLOAT8, FLAGS ) +#elif SIZEOF_DOUBLE == 8 +#define OPAL_DATATYPE_INITIALIZER_FLOAT8(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( double, OPAL_ALIGNMENT_DOUBLE, FLOAT8, FLAGS ) +#elif SIZEOF_LONG_DOUBLE == 8 +#define OPAL_DATATYPE_INITIALIZER_FLOAT8(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( long double, OPAL_ALIGNMENT_LONG_DOUBLE, FLOAT8, FLAGS ) +#else +#define OPAL_DATATYPE_INITIALIZER_FLOAT8(FLAGS) OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) +/* #warning OPAL_DATATYPE_INITIALIZER_FLOAT8 not available */ +#endif + +#if SIZEOF_FLOAT == 12 +#define OPAL_DATATYPE_INITIALIZER_FLOAT12(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( float, OPAL_ALIGNMENT_FLOAT, FLOAT12, FLAGS ) +#elif SIZEOF_DOUBLE == 12 +#define OPAL_DATATYPE_INITIALIZER_FLOAT12(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( double, OPAL_ALIGNMENT_DOUBLE, FLOAT12, FLAGS ) +#elif SIZEOF_LONG_DOUBLE == 12 +#define OPAL_DATATYPE_INITIALIZER_FLOAT12(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( long double, OPAL_ALIGNMENT_LONG_DOUBLE, FLOAT12, FLAGS ) +#else +#define OPAL_DATATYPE_INITIALIZER_FLOAT12(FLAGS) OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) +/* #warning OPAL_DATATYPE_INITIALIZER_FLOAT12 not available */ +#endif + +#if SIZEOF_FLOAT == 16 +#define OPAL_DATATYPE_INITIALIZER_FLOAT16(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( float, OPAL_ALIGNMENT_FLOAT, FLOAT16, FLAGS ) +#elif SIZEOF_DOUBLE == 16 +#define OPAL_DATATYPE_INITIALIZER_FLOAT16(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( double, OPAL_ALIGNMENT_DOUBLE, FLOAT16, FLAGS ) +#elif SIZEOF_LONG_DOUBLE == 16 +#define OPAL_DATATYPE_INITIALIZER_FLOAT16(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( long double, OPAL_ALIGNMENT_LONG_DOUBLE, FLOAT16, FLAGS ) +#else +#define OPAL_DATATYPE_INITIALIZER_FLOAT16(FLAGS) OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) +/* #warning OPAL_DATATYPE_INITIALIZER_FLOAT16 not available */ +#endif + +#define OPAL_DATATYPE_INITIALIZER_BOOL(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( _Bool, OPAL_ALIGNMENT_BOOL, BOOL, FLAGS ) + +#if OPAL_ALIGNMENT_WCHAR != 0 +#define OPAL_DATATYPE_INITIALIZER_WCHAR(FLAGS) OPAL_DATATYPE_INIT_BASIC_DATATYPE( wchar_t, OPAL_ALIGNMENT_WCHAR, WCHAR, FLAGS ) +#else +#define OPAL_DATATYPE_INITIALIZER_WCHAR(FLAGS) OPAL_DATATYPE_INITIALIZER_UNAVAILABLE( FLAGS ) +/* #warning OPAL_DATATYPE_INITIALIZER_WCHAR not available */ +#endif + + +#define BASIC_DDT_FROM_ELEM( ELEM ) (opal_datatype_basicDatatypes[(ELEM).elem.common.type]) + +#define SAVE_STACK( PSTACK, INDEX, TYPE, COUNT, DISP) \ +do { \ + (PSTACK)->index = (INDEX); \ + (PSTACK)->type = (TYPE); \ + (PSTACK)->count = (COUNT); \ + (PSTACK)->disp = (DISP); \ +} while(0) + +#define PUSH_STACK( PSTACK, STACK_POS, INDEX, TYPE, COUNT, DISP) \ +do { \ + dt_stack_t* pTempStack = (PSTACK) + 1; \ + SAVE_STACK( pTempStack, (INDEX), (TYPE), (COUNT), (DISP) ); \ + (STACK_POS)++; \ + (PSTACK) = pTempStack; \ +} while(0) + +#if OPAL_ENABLE_DEBUG +OPAL_DECLSPEC int opal_datatype_safeguard_pointer_debug_breakpoint( const void* actual_ptr, int length, + const void* initial_ptr, + const struct opal_datatype_t* pData, + int count ); +#define OPAL_DATATYPE_SAFEGUARD_POINTER( ACTPTR, LENGTH, INITPTR, PDATA, COUNT ) \ + { \ + unsigned char *__lower_bound = (INITPTR), *__upper_bound; \ + assert( ((LENGTH) != 0) && ((COUNT) != 0) ); \ + __lower_bound += (PDATA)->true_lb; \ + __upper_bound = (INITPTR) + (PDATA)->true_ub + \ + ((PDATA)->ub - (PDATA)->lb) * ((COUNT) - 1); \ + if( ((ACTPTR) < __lower_bound) || ((ACTPTR) >= __upper_bound) ) { \ + opal_datatype_safeguard_pointer_debug_breakpoint( (ACTPTR), (LENGTH), (INITPTR), (PDATA), (COUNT) ); \ + opal_output( 0, "%s:%d\n\tPointer %p size %lu is outside [%p,%p] for\n\tbase ptr %p count %d and data \n", \ + __FILE__, __LINE__, (ACTPTR), (unsigned long)(LENGTH), __lower_bound, __upper_bound, \ + (INITPTR), (COUNT) ); \ + opal_datatype_dump( (PDATA) ); \ + } \ + } + +#else +#define OPAL_DATATYPE_SAFEGUARD_POINTER( ACTPTR, LENGTH, INITPTR, PDATA, COUNT ) +#endif /* OPAL_ENABLE_DEBUG */ + +static inline int GET_FIRST_NON_LOOP( const union dt_elem_desc* _pElem ) +{ + int element_index = 0; + + /* We dont have to check for the end as we always put an END_LOOP + * at the end of all datatype descriptions. + */ + while( _pElem->elem.common.type == OPAL_DATATYPE_LOOP ) { + ++_pElem; element_index++; + } + return element_index; +} + +#define UPDATE_INTERNAL_COUNTERS( DESCRIPTION, POSITION, ELEMENT, COUNTER ) \ + do { \ + (ELEMENT) = &((DESCRIPTION)[(POSITION)]); \ + (COUNTER) = (ELEMENT)->elem.count; \ + } while (0) + +OPAL_DECLSPEC int opal_datatype_contain_basic_datatypes( const struct opal_datatype_t* pData, char* ptr, size_t length ); +OPAL_DECLSPEC int opal_datatype_dump_data_flags( unsigned short usflags, char* ptr, size_t length ); +OPAL_DECLSPEC int opal_datatype_dump_data_desc( union dt_elem_desc* pDesc, int nbElems, char* ptr, size_t length ); + +END_C_DECLS +#endif /* OPAL_DATATYPE_INTERNAL_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/datatype/datatype_memcpy.h b/opal/datatype/opal_datatype_memcpy.h similarity index 83% rename from ompi/datatype/datatype_memcpy.h rename to opal/datatype/opal_datatype_memcpy.h index 8e0a11dcd0..c6a5af87a3 100644 --- a/ompi/datatype/datatype_memcpy.h +++ b/opal/datatype/opal_datatype_memcpy.h @@ -1,8 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,8 +11,8 @@ * $HEADER$ */ -#ifndef DATATYPE_MEMCPY_H_HAS_BEEN_INCLUDED -#define DATATYPE_MEMCPY_H_HAS_BEEN_INCLUDED +#ifndef OPAL_DATATYPE_MEMCPY_H_HAS_BEEN_INCLUDED +#define OPAL_DATATYPE_MEMCPY_H_HAS_BEEN_INCLUDED extern void* mmx_memcpy( void* dst, const void* src, size_t n ); extern void* mmx2_memcpy( void* dst, const void* src, size_t n ); @@ -44,4 +45,4 @@ do { \ } while (0) #endif -#endif /* DATATYPE_MEMCPY_H_HAS_BEEN_INCLUDED */ +#endif /* OPAL_DATATYPE_MEMCPY_H_HAS_BEEN_INCLUDED */ diff --git a/opal/datatype/opal_datatype_module.c b/opal/datatype/opal_datatype_module.c new file mode 100644 index 0000000000..bf50325784 --- /dev/null +++ b/opal/datatype/opal_datatype_module.c @@ -0,0 +1,220 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" + +#include + +#include "opal/util/arch.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor_internal.h" +#include "opal/mca/base/mca_base_param.h" + +/* by default the debuging is turned off */ +int opal_datatype_dfd = -1; +int opal_unpack_debug = 0; +int opal_pack_debug = 0; +int opal_position_debug = 0; +int opal_copy_debug = 0; + +uint32_t opal_local_arch = 0xFFFFFFFF; + +/* Using this macro implies that at this point _all_ informations needed + * to fill up the datatype are known. + * We fill all the static information, the pointer to desc.desc is setup + * into an array, which is initialized at runtime. + * Everything is constant. + */ +OPAL_DECLSPEC const opal_datatype_t opal_datatype_null = OPAL_DATATYPE_INITIALIZER_NULL(0); + +OPAL_DECLSPEC const opal_datatype_t opal_datatype_loop = OPAL_DATATYPE_INITIALIZER_LOOP(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_end_loop = OPAL_DATATYPE_INITIALIZER_END_LOOP(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_lb = OPAL_DATATYPE_INITIALIZER_LB(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_ub = OPAL_DATATYPE_INITIALIZER_UB(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_int1 = OPAL_DATATYPE_INITIALIZER_INT1(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_int2 = OPAL_DATATYPE_INITIALIZER_INT2(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_int4 = OPAL_DATATYPE_INITIALIZER_INT4(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_int8 = OPAL_DATATYPE_INITIALIZER_INT8(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_int16 = OPAL_DATATYPE_INITIALIZER_INT16(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_uint1 = OPAL_DATATYPE_INITIALIZER_UINT1(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_uint2 = OPAL_DATATYPE_INITIALIZER_UINT2(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_uint4 = OPAL_DATATYPE_INITIALIZER_UINT4(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_uint8 = OPAL_DATATYPE_INITIALIZER_UINT8(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_uint16 = OPAL_DATATYPE_INITIALIZER_UINT16(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_float2 = OPAL_DATATYPE_INITIALIZER_FLOAT2(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_float4 = OPAL_DATATYPE_INITIALIZER_FLOAT4(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_float8 = OPAL_DATATYPE_INITIALIZER_FLOAT8(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_float12 = OPAL_DATATYPE_INITIALIZER_FLOAT12(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_float16 = OPAL_DATATYPE_INITIALIZER_FLOAT16(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_bool = OPAL_DATATYPE_INITIALIZER_BOOL(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_wchar = OPAL_DATATYPE_INITIALIZER_WCHAR(0); +OPAL_DECLSPEC const opal_datatype_t opal_datatype_unavailable = OPAL_DATATYPE_INITIALIZER_UNAVAILABLE(0); + +OPAL_DECLSPEC dt_elem_desc_t opal_datatype_predefined_elem_desc[2 * OPAL_DATATYPE_MAX_PREDEFINED]; + +/* NOTE: The order of this array *MUST* match the order in opal_datatype_basicDatatypes */ +OPAL_DECLSPEC const size_t opal_datatype_local_sizes[OPAL_DATATYPE_MAX_PREDEFINED] = +{ + 0, + 0, + 0, + 0, + 1, /* sizeof (int1_t) */ + 2, /* sizeof (int2_t) */ + 4, /* sizeof (int4_t) */ + 8, /* sizeof (int8_t) */ + 16, /* sizeof (int16_t) */ + 1, /* sizeof (uint1_t) */ + 2, /* sizeof (uint2_t) */ + 4, /* sizeof (uint4_t) */ + 8, /* sizeof (uint8_t) */ + 16, /* sizeof (uint16_t) */ + 2, /* sizeof (float2) */ + 4, /* sizeof (float4) */ + 8, /* sizeof (float8) */ + 12, /* sizeof (float12) */ + 16, /* sizeof (float16) */ + sizeof (_Bool), + sizeof (wchar_t), + 0 /* unavailable */ +}; + +/* + * NOTE: The order of this array *MUST* match what is listed in datatype.h + */ +OPAL_DECLSPEC const opal_datatype_t* opal_datatype_basicDatatypes[OPAL_DATATYPE_MAX_PREDEFINED] = { + &opal_datatype_loop, + &opal_datatype_end_loop, + &opal_datatype_lb, + &opal_datatype_ub, + &opal_datatype_int1, + &opal_datatype_int2, + &opal_datatype_int4, + &opal_datatype_int8, + &opal_datatype_int16, /* Yes, double-machine word integers are available */ + &opal_datatype_uint1, + &opal_datatype_uint2, + &opal_datatype_uint4, + &opal_datatype_uint8, + &opal_datatype_uint16, /* Yes, double-machine word integers are available */ + &opal_datatype_float2, + &opal_datatype_float4, + &opal_datatype_float8, + &opal_datatype_float12, + &opal_datatype_float16, + &opal_datatype_bool, + &opal_datatype_wchar, + &opal_datatype_unavailable +}; + + +int opal_datatype_register_params(void) +{ +#if OPAL_ENABLE_DEBUG + mca_base_param_reg_int_name( "mpi", "ddt_unpack_debug", + "Whether to output debugging information in the ddt unpack functions (nonzero = enabled)", + false, false, + opal_unpack_debug, &opal_unpack_debug ); + mca_base_param_reg_int_name( "mpi", "ddt_pack_debug", + "Whether to output debugging information in the ddt pack functions (nonzero = enabled)", + false, false, + opal_pack_debug, &opal_pack_debug ); + mca_base_param_reg_int_name( "mpi", "ddt_position_debug", + "Non zero lead to output generated by the datatype position functions", + false, false, 0, &opal_position_debug ); + + mca_base_param_reg_int_name( "mpi", "ddt_copy_debug", + "Whether to output debugging information in the ddt copy functions (nonzero = enabled)", + false, false, + opal_copy_debug, &opal_copy_debug ); +#endif /* OPAL_ENABLE_DEBUG */ + return OPAL_SUCCESS; +} + + +int32_t opal_datatype_init( void ) +{ + int32_t i; + + opal_arch_compute_local_id( &opal_local_arch ); + + for( i = OPAL_DATATYPE_FIRST_TYPE; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) { + const opal_datatype_t* datatype = opal_datatype_basicDatatypes[i]; + + /* All of the predefined OPAL types don't have any GAPS! */ + datatype->desc.desc[0].elem.common.flags = OPAL_DATATYPE_FLAG_PREDEFINED | + OPAL_DATATYPE_FLAG_DATA | + OPAL_DATATYPE_FLAG_CONTIGUOUS | + OPAL_DATATYPE_FLAG_NO_GAPS; + datatype->desc.desc[0].elem.common.type = i; + /* datatype->desc.desc[0].elem.blocklen XXX not set at the moment, it will be needed later */ + datatype->desc.desc[0].elem.count = 1; + datatype->desc.desc[0].elem.disp = 0; + datatype->desc.desc[0].elem.extent = datatype->size; + + datatype->desc.desc[1].end_loop.common.flags = 0; + datatype->desc.desc[1].end_loop.common.type = OPAL_DATATYPE_END_LOOP; + datatype->desc.desc[1].end_loop.items = 1; + datatype->desc.desc[1].end_loop.first_elem_disp = datatype->desc.desc[0].elem.disp; + datatype->desc.desc[1].end_loop.size = datatype->size; + + } + + return OPAL_SUCCESS; +} + + +int32_t opal_datatype_finalize( void ) +{ + /* As the synonyms are just copies of the internal data we should not free them. + * Anyway they are over the limit of OPAL_DATATYPE_MAX_PREDEFINED so they will never get freed. + */ + + /* As they are statically allocated they cannot be released. But we + * can call OBJ_DESTRUCT, just to free all internally allocated ressources. + */ +#if defined(VERBOSE) + if( opal_datatype_dfd != -1 ) + opal_output_close( opal_datatype_dfd ); + opal_datatype_dfd = -1; +#endif /* VERBOSE */ + + /* clear all master convertors */ + opal_convertor_destroy_masters(); + + return OPAL_SUCCESS; +} + +#if OPAL_ENABLE_DEBUG +/* + * Set a breakpoint to this function in your favorite debugger + * to make it stop on all pack and unpack errors. + */ +int opal_datatype_safeguard_pointer_debug_breakpoint( const void* actual_ptr, int length, + const void* initial_ptr, + const opal_datatype_t* pData, + int count ) +{ + return 0; +} +#endif /* OPAL_ENABLE_DEBUG */ diff --git a/ompi/datatype/dt_optimize.c b/opal/datatype/opal_datatype_optimize.c similarity index 69% rename from ompi/datatype/dt_optimize.c rename to opal/datatype/opal_datatype_optimize.c index 4d5f5fd0ae..52ae6d9c03 100644 --- a/ompi/datatype/dt_optimize.c +++ b/opal/datatype/opal_datatype_optimize.c @@ -3,13 +3,14 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,24 +18,26 @@ * $HEADER$ */ -#include "ompi_config.h" +#include "opal_config.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype_internal.h" +#include #ifdef HAVE_ALLOCA_H #include #endif #include -#define SET_EMPTY_ELEMENT( ELEM ) \ - do { \ - ddt_elem_desc_t* _elem = (ELEM); \ - _elem->common.flags = DT_FLAG_BASIC; \ - _elem->common.type = DT_LOOP; \ - _elem->count = 0; \ - _elem->disp = 0; \ - _elem->extent = 0; \ +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" + +#define SET_EMPTY_ELEMENT( ELEM ) \ + do { \ + ddt_elem_desc_t* _elem = (ELEM); \ + _elem->common.flags = OPAL_DATATYPE_FLAG_BASIC; \ + _elem->common.type = OPAL_DATATYPE_LOOP; \ + _elem->count = 0; \ + _elem->disp = 0; \ + _elem->extent = 0; \ } while (0) static inline int SAVE_OPTIMIZED_ELEMENT( dt_elem_desc_t* pElemDesc, @@ -50,10 +53,10 @@ static inline int SAVE_OPTIMIZED_ELEMENT( dt_elem_desc_t* pElemDesc, static inline int ADD_ELEMENT( dt_elem_desc_t* pElemDesc, ddt_elem_desc_t* opt_elem, uint16_t type, uint32_t count, - ptrdiff_t disp, int32_t extent ) + OPAL_PTRDIFF_TYPE disp, int32_t extent ) { if( 0 == opt_elem->count ) { - opt_elem->common.flags = DT_FLAG_BASIC; + opt_elem->common.flags = OPAL_DATATYPE_FLAG_BASIC; opt_elem->common.type = type; opt_elem->count = count; opt_elem->disp = disp; @@ -64,43 +67,43 @@ static inline int ADD_ELEMENT( dt_elem_desc_t* pElemDesc, } static int32_t -ompi_ddt_optimize_short( ompi_datatype_t* pData, +opal_datatype_optimize_short( opal_datatype_t* pData, int32_t count, dt_type_desc_t* pTypeDesc ) { dt_elem_desc_t* pElemDesc; ddt_elem_desc_t opt_elem; - ptrdiff_t last_disp = 0; + OPAL_PTRDIFF_TYPE last_disp = 0; dt_stack_t* pStack; /* pointer to the position on the stack */ int32_t pos_desc = 0; /* actual position in the description of the derived datatype */ - int32_t stack_pos = 0, last_type = DT_BYTE; - int32_t type = DT_LOOP, nbElems = 0, changes = 0; + int32_t stack_pos = 0, last_type = OPAL_DATATYPE_UINT1; + int32_t type = OPAL_DATATYPE_LOOP, nbElems = 0, changes = 0; int32_t optimized = 0, continuity; uint16_t last_flags = 0xFFFF; /* keep all for the first datatype */ - ptrdiff_t total_disp = 0, last_extent = 1; + OPAL_PTRDIFF_TYPE total_disp = 0, last_extent = 1; int32_t last_length = 0; uint32_t i; - pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (pData->btypes[DT_LOOP]+2) ); + pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (pData->btypes[OPAL_DATATYPE_LOOP]+2) ); SAVE_STACK( pStack, -1, 0, count, 0 ); - pTypeDesc->length = 2 * pData->desc.used + 1 /* for the fake DT_END_LOOP at the end */; + pTypeDesc->length = 2 * pData->desc.used + 1 /* for the fake OPAL_DATATYPE_END_LOOP at the end */; pTypeDesc->desc = pElemDesc = (dt_elem_desc_t*)malloc( sizeof(dt_elem_desc_t) * pTypeDesc->length ); pTypeDesc->used = 0; SET_EMPTY_ELEMENT( &opt_elem ); - assert( DT_END_LOOP == pData->desc.desc[pData->desc.used].elem.common.type ); - opt_elem.common.type = DT_LOOP; + assert( OPAL_DATATYPE_END_LOOP == pData->desc.desc[pData->desc.used].elem.common.type ); + opt_elem.common.type = OPAL_DATATYPE_LOOP; opt_elem.common.flags = 0xFFFF; /* keep all for the first datatype */ opt_elem.count = 0; opt_elem.disp = pData->desc.desc[pData->desc.used].end_loop.first_elem_disp; opt_elem.extent = 0; while( stack_pos >= 0 ) { - if( DT_END_LOOP == pData->desc.desc[pos_desc].elem.common.type ) { /* end of the current loop */ + if( OPAL_DATATYPE_END_LOOP == pData->desc.desc[pos_desc].elem.common.type ) { /* end of the current loop */ ddt_endloop_desc_t* end_loop = &(pData->desc.desc[pos_desc].end_loop); if( last_length != 0 ) { - CREATE_ELEM( pElemDesc, last_type, DT_FLAG_BASIC, last_length, last_disp, last_extent ); + CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); pElemDesc++; nbElems++; last_disp += last_length; last_length = 0; @@ -117,29 +120,29 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData, pos_desc++; continue; } - if( DT_LOOP == pData->desc.desc[pos_desc].elem.common.type ) { + if( OPAL_DATATYPE_LOOP == pData->desc.desc[pos_desc].elem.common.type ) { ddt_loop_desc_t* loop = (ddt_loop_desc_t*)&(pData->desc.desc[pos_desc]); ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)&(pData->desc.desc[pos_desc + loop->items]); int index = GET_FIRST_NON_LOOP( &(pData->desc.desc[pos_desc]) ); - ptrdiff_t loop_disp = pData->desc.desc[pos_desc + index].elem.disp; + OPAL_PTRDIFF_TYPE loop_disp = pData->desc.desc[pos_desc + index].elem.disp; - continuity = ((last_disp + last_length * (ptrdiff_t)ompi_ddt_basicDatatypes[last_type]->size) + continuity = ((last_disp + last_length * (OPAL_PTRDIFF_TYPE)opal_datatype_basicDatatypes[last_type]->size) == (total_disp + loop_disp)); - if( loop->common.flags & DT_FLAG_CONTIGUOUS ) { + if( loop->common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { /* the loop is contiguous or composed by contiguous elements with a gap */ - if( loop->extent == (ptrdiff_t)end_loop->size ) { + if( loop->extent == (OPAL_PTRDIFF_TYPE)end_loop->size ) { /* the whole loop is contiguous */ if( !continuity ) { if( 0 != last_length ) { - CREATE_ELEM( pElemDesc, last_type, DT_FLAG_BASIC, last_length, last_disp, last_extent ); + CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); pElemDesc++; nbElems++; last_length = 0; } last_disp = total_disp + loop_disp; } - last_length = (last_length * ompi_ddt_basicDatatypes[last_type]->size + last_length = (last_length * opal_datatype_basicDatatypes[last_type]->size + loop->loops * end_loop->size); - last_type = DT_BYTE; + last_type = OPAL_DATATYPE_UINT1; last_extent = 1; optimized++; } else { @@ -147,24 +150,24 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData, /* if the previous data is contiguous with this piece and it has a length not ZERO */ if( last_length != 0 ) { if( continuity ) { - last_length *= ompi_ddt_basicDatatypes[last_type]->size; + last_length *= opal_datatype_basicDatatypes[last_type]->size; last_length += end_loop->size; - last_type = DT_BYTE; + last_type = OPAL_DATATYPE_UINT1; last_extent = 1; counter--; } - CREATE_ELEM( pElemDesc, last_type, DT_FLAG_BASIC, last_length, last_disp, last_extent ); + CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); pElemDesc++; nbElems++; last_disp += last_length; last_length = 0; - last_type = DT_LOOP; + last_type = OPAL_DATATYPE_LOOP; } /* we have a gap in the begining or the end of the loop but the whole * loop can be merged in just one memcpy. */ CREATE_LOOP_START( pElemDesc, counter, 2, loop->extent, loop->common.flags ); pElemDesc++; nbElems++; - CREATE_ELEM( pElemDesc, DT_BYTE, DT_FLAG_BASIC, end_loop->size, loop_disp, 1); + CREATE_ELEM( pElemDesc, OPAL_DATATYPE_UINT1, OPAL_DATATYPE_FLAG_BASIC, end_loop->size, loop_disp, 1); pElemDesc++; nbElems++; CREATE_LOOP_END( pElemDesc, 2, end_loop->first_elem_disp, end_loop->size, end_loop->common.flags ); @@ -176,23 +179,23 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData, } else { ddt_elem_desc_t* elem = (ddt_elem_desc_t*)&(pData->desc.desc[pos_desc+1]); if( last_length != 0 ) { - CREATE_ELEM( pElemDesc, last_type, DT_FLAG_BASIC, last_length, last_disp, last_extent ); + CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); pElemDesc++; nbElems++; last_disp += last_length; last_length = 0; - last_type = DT_LOOP; + last_type = OPAL_DATATYPE_LOOP; } if( 2 == loop->items ) { /* small loop */ if( (1 == elem->count) - && (elem->extent == (ptrdiff_t)ompi_ddt_basicDatatypes[elem->common.type]->size) ) { - CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags & ~DT_FLAG_CONTIGUOUS, + && (elem->extent == (OPAL_PTRDIFF_TYPE)opal_datatype_basicDatatypes[elem->common.type]->size) ) { + CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags & ~OPAL_DATATYPE_FLAG_CONTIGUOUS, loop->loops, elem->disp, loop->extent ); pElemDesc++; nbElems++; pos_desc += loop->items + 1; changes++; optimized++; goto complete_loop; } else if( loop->loops < 3 ) { - ptrdiff_t elem_displ = elem->disp; + OPAL_PTRDIFF_TYPE elem_displ = elem->disp; for( i = 0; i < loop->loops; i++ ) { CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags, elem->count, elem_displ, elem->extent ); @@ -206,7 +209,7 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData, } CREATE_LOOP_START( pElemDesc, loop->loops, loop->items, loop->extent, loop->common.flags ); pElemDesc++; nbElems++; - PUSH_STACK( pStack, stack_pos, nbElems, DT_LOOP, loop->loops, total_disp ); + PUSH_STACK( pStack, stack_pos, nbElems, OPAL_DATATYPE_LOOP, loop->loops, total_disp ); pos_desc++; DDT_DUMP_STACK( pStack, stack_pos, pData->desc.desc, "advance loops" ); } @@ -214,14 +217,14 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData, total_disp = pStack->disp; /* update the displacement */ continue; } - while( pData->desc.desc[pos_desc].elem.common.flags & DT_FLAG_DATA ) { /* keep doing it until we reach a non datatype element */ + while( pData->desc.desc[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* keep doing it until we reach a non datatype element */ /* now here we have a basic datatype */ type = pData->desc.desc[pos_desc].elem.common.type; - continuity = ((last_disp + last_length * (ptrdiff_t)ompi_ddt_basicDatatypes[last_type]->size) + continuity = ((last_disp + last_length * (OPAL_PTRDIFF_TYPE)opal_datatype_basicDatatypes[last_type]->size) == (total_disp + pData->desc.desc[pos_desc].elem.disp)); - if( (pData->desc.desc[pos_desc].elem.common.flags & DT_FLAG_CONTIGUOUS) && continuity && - (pData->desc.desc[pos_desc].elem.extent == (int32_t)ompi_ddt_basicDatatypes[type]->size) ) { + if( (pData->desc.desc[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && continuity && + (pData->desc.desc[pos_desc].elem.extent == (int32_t)opal_datatype_basicDatatypes[type]->size) ) { if( type == last_type ) { last_length += pData->desc.desc[pos_desc].elem.count; last_extent = pData->desc.desc[pos_desc].elem.extent; @@ -231,9 +234,9 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData, last_length = pData->desc.desc[pos_desc].elem.count; last_extent = pData->desc.desc[pos_desc].elem.extent; } else { - last_length = last_length * ompi_ddt_basicDatatypes[last_type]->size + - pData->desc.desc[pos_desc].elem.count * ompi_ddt_basicDatatypes[type]->size; - last_type = DT_BYTE; + last_length = last_length * opal_datatype_basicDatatypes[last_type]->size + + pData->desc.desc[pos_desc].elem.count * opal_datatype_basicDatatypes[type]->size; + last_type = OPAL_DATATYPE_UINT1; last_extent = 1; optimized++; } @@ -241,7 +244,7 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData, last_flags &= pData->desc.desc[pos_desc].elem.common.flags; } else { if( last_length != 0 ) { - CREATE_ELEM( pElemDesc, last_type, DT_FLAG_BASIC, last_length, last_disp, last_extent ); + CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); pElemDesc++; nbElems++; } last_disp = total_disp + pData->desc.desc[pos_desc].elem.disp; @@ -254,22 +257,21 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData, } if( last_length != 0 ) { - CREATE_ELEM( pElemDesc, last_type, DT_FLAG_BASIC, last_length, last_disp, last_extent ); + CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); pElemDesc++; nbElems++; } /* cleanup the stack */ pTypeDesc->used = nbElems - 1; /* except the last fake END_LOOP */ - return OMPI_SUCCESS; + return OPAL_SUCCESS; } -int32_t ompi_ddt_commit( ompi_datatype_t** data ) +int32_t opal_datatype_commit( opal_datatype_t * pData ) { - ompi_datatype_t* pData = *data; ddt_endloop_desc_t* pLast = &(pData->desc.desc[pData->desc.used].end_loop); - ptrdiff_t first_elem_disp = 0; + OPAL_PTRDIFF_TYPE first_elem_disp = 0; - if( pData->flags & DT_FLAG_COMMITED ) return OMPI_SUCCESS; - pData->flags |= DT_FLAG_COMMITED; + if( pData->flags & OPAL_DATATYPE_FLAG_COMMITED ) return OPAL_SUCCESS; + pData->flags |= OPAL_DATATYPE_FLAG_COMMITED; /* We have to compute the displacement of the first non loop item in the * description. @@ -279,14 +281,14 @@ int32_t ompi_ddt_commit( ompi_datatype_t** data ) dt_elem_desc_t* pElem = pData->desc.desc; index = GET_FIRST_NON_LOOP( pElem ); - assert( pElem[index].elem.common.flags & DT_FLAG_DATA ); + assert( pElem[index].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ); first_elem_disp = pElem[index].elem.disp; } /* let's add a fake element at the end just to avoid useless comparaisons * in pack/unpack functions. */ - pLast->common.type = DT_END_LOOP; + pLast->common.type = OPAL_DATATYPE_END_LOOP; pLast->common.flags = 0; pLast->items = pData->desc.used; pLast->first_elem_disp = first_elem_disp; @@ -297,23 +299,23 @@ int32_t ompi_ddt_commit( ompi_datatype_t** data ) pData->opt_desc.length = 0; pData->opt_desc.desc = NULL; pData->opt_desc.used = 0; - return OMPI_SUCCESS; + return OPAL_SUCCESS; } /* If the data is contiguous is useless to generate an optimized version. */ - /*if( pData->size == (pData->true_ub - pData->true_lb) ) return OMPI_SUCCESS; */ + /*if( pData->size == (pData->true_ub - pData->true_lb) ) return OPAL_SUCCESS; */ - (void)ompi_ddt_optimize_short( pData, 1, &(pData->opt_desc) ); + (void)opal_datatype_optimize_short( pData, 1, &(pData->opt_desc) ); if( 0 != pData->opt_desc.used ) { /* let's add a fake element at the end just to avoid useless comparaisons * in pack/unpack functions. */ pLast = &(pData->opt_desc.desc[pData->opt_desc.used].end_loop); - pLast->common.type = DT_END_LOOP; + pLast->common.type = OPAL_DATATYPE_END_LOOP; pLast->common.flags = 0; pLast->items = pData->opt_desc.used; pLast->first_elem_disp = first_elem_disp; pLast->size = pData->size; } - return OMPI_SUCCESS; + return OPAL_SUCCESS; } diff --git a/ompi/datatype/datatype_pack.c b/opal/datatype/opal_datatype_pack.c similarity index 83% rename from ompi/datatype/datatype_pack.c rename to opal/datatype/opal_datatype_pack.c index 165fe6094d..63ddfbb57b 100644 --- a/ompi/datatype/datatype_pack.c +++ b/opal/datatype/opal_datatype_pack.c @@ -3,13 +3,14 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,29 +18,35 @@ * $HEADER$ */ -#include "ompi_config.h" -#include "ompi/datatype/convertor_internal.h" -#include "ompi/datatype/datatype_internal.h" +#include "opal_config.h" + +#include + +#include "opal/datatype/opal_convertor_internal.h" +#include "opal/datatype/opal_datatype_internal.h" #if OPAL_ENABLE_DEBUG -extern int ompi_pack_debug; -#define DO_DEBUG(INST) if( ompi_pack_debug ) { INST } + +#include "opal/util/output.h" + +extern int opal_pack_debug; +#define DO_DEBUG(INST) if( opal_pack_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ -#include "ompi/datatype/datatype_checksum.h" -#include "ompi/datatype/datatype_pack.h" -#include "ompi/datatype/datatype_prototypes.h" +#include "opal/datatype/opal_datatype_checksum.h" +#include "opal/datatype/opal_datatype_pack.h" +#include "opal/datatype/opal_datatype_prototypes.h" #if defined(CHECKSUM) -#define ompi_pack_homogeneous_contig_function ompi_pack_homogeneous_contig_checksum -#define ompi_pack_homogeneous_contig_with_gaps_function ompi_pack_homogeneous_contig_with_gaps_checksum -#define ompi_generic_simple_pack_function ompi_generic_simple_pack_checksum +#define opal_pack_homogeneous_contig_function opal_pack_homogeneous_contig_checksum +#define opal_pack_homogeneous_contig_with_gaps_function opal_pack_homogeneous_contig_with_gaps_checksum +#define opal_generic_simple_pack_function opal_generic_simple_pack_checksum #else -#define ompi_pack_homogeneous_contig_function ompi_pack_homogeneous_contig -#define ompi_pack_homogeneous_contig_with_gaps_function ompi_pack_homogeneous_contig_with_gaps -#define ompi_generic_simple_pack_function ompi_generic_simple_pack +#define opal_pack_homogeneous_contig_function opal_pack_homogeneous_contig +#define opal_pack_homogeneous_contig_with_gaps_function opal_pack_homogeneous_contig_with_gaps +#define opal_generic_simple_pack_function opal_generic_simple_pack #endif /* defined(CHECKSUM) */ @@ -50,7 +57,7 @@ extern int ompi_pack_debug; * the status with just the informations from pConvertor->bConverted. */ int32_t -ompi_pack_homogeneous_contig_function( ompi_convertor_t* pConv, +opal_pack_homogeneous_contig_function( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ) @@ -59,7 +66,7 @@ ompi_pack_homogeneous_contig_function( ompi_convertor_t* pConv, unsigned char *source_base = NULL; uint32_t iov_count; size_t length = pConv->local_size - pConv->bConverted, initial_amount = pConv->bConverted; - ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; + OPAL_PTRDIFF_TYPE initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; source_base = (pConv->pBaseBuf + initial_displ + pStack[0].disp + pStack[1].disp); @@ -75,7 +82,7 @@ ompi_pack_homogeneous_contig_function( ompi_convertor_t* pConv, COMPUTE_CSUM( iov[iov_count].iov_base, iov[iov_count].iov_len, pConv ); } else { /* contiguous data just memcpy the smallest data in the user buffer */ - OMPI_DDT_SAFEGUARD_POINTER( source_base, iov[iov_count].iov_len, + OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, iov[iov_count].iov_len, pConv->pBaseBuf, pConv->pDesc, pConv->count ); MEMCPY_CSUM( iov[iov_count].iov_base, source_base, iov[iov_count].iov_len, pConv ); } @@ -96,21 +103,21 @@ ompi_pack_homogeneous_contig_function( ompi_convertor_t* pConv, } int32_t -ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv, +opal_pack_homogeneous_contig_with_gaps_function( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ) { - const ompi_datatype_t* pData = pConv->pDesc; + const opal_datatype_t* pData = pConv->pDesc; dt_stack_t* pStack = pConv->pStack; unsigned char *user_memory, *packed_buffer; uint32_t i, index, iov_count; size_t max_allowed, total_bytes_converted = 0; - ptrdiff_t extent; - ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; + OPAL_PTRDIFF_TYPE extent; + OPAL_PTRDIFF_TYPE initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; extent = pData->ub - pData->lb; - assert( (pData->flags & DT_FLAG_CONTIGUOUS) && ((ptrdiff_t)pData->size != extent) ); + assert( (pData->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && ((OPAL_PTRDIFF_TYPE)pData->size != extent) ); /* Limit the amount of packed data to the data left over on this convertor */ max_allowed = pConv->local_size - pConv->bConverted; @@ -189,7 +196,7 @@ ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv, done = pConv->bConverted - i * pData->size; /* partial data from last pack */ if( done != 0 ) { /* still some data to copy from the last time */ done = pData->size - done; - OMPI_DDT_SAFEGUARD_POINTER( user_memory, done, pConv->pBaseBuf, pData, pConv->count ); + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, done, pConv->pBaseBuf, pData, pConv->count ); MEMCPY_CSUM( packed_buffer, user_memory, done, pConv ); packed_buffer += done; max_allowed -= done; @@ -199,7 +206,7 @@ ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv, counter = (uint32_t)(max_allowed / pData->size); if( counter > pConv->count ) counter = pConv->count; for( i = 0; i < counter; i++ ) { - OMPI_DDT_SAFEGUARD_POINTER( user_memory, pData->size, pConv->pBaseBuf, pData, pConv->count ); + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, pData->size, pConv->pBaseBuf, pData, pConv->count ); MEMCPY_CSUM( packed_buffer, user_memory, pData->size, pConv ); packed_buffer+= pData->size; user_memory += extent; @@ -210,7 +217,7 @@ ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv, /* If there is anything pending ... */ if( 0 != max_allowed ) { done = max_allowed; - OMPI_DDT_SAFEGUARD_POINTER( user_memory, done, pConv->pBaseBuf, pData, pConv->count ); + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, done, pConv->pBaseBuf, pData, pConv->count ); MEMCPY_CSUM( packed_buffer, user_memory, done, pConv ); packed_buffer += done; max_allowed = 0; @@ -237,12 +244,12 @@ ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv, * But first let's make some global assumptions: * - a datatype (with the flag DT_DATA set) will have the contiguous flags set if and only if * the data is really contiguous (extent equal with size) - * - for the DT_LOOP type the DT_CONTIGUOUS flag set means that the content of the loop is + * - for the OPAL_DATATYPE_LOOP type the DT_CONTIGUOUS flag set means that the content of the loop is * contiguous but with a gap in the begining or at the end. - * - the DT_CONTIGUOUS flag for the type DT_END_LOOP is meaningless. + * - the DT_CONTIGUOUS flag for the type OPAL_DATATYPE_END_LOOP is meaningless. */ int32_t -ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor, +opal_generic_simple_pack_function( opal_convertor_t* pConvertor, struct iovec* iov, uint32_t* out_size, size_t* max_data ) { @@ -252,12 +259,12 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor, size_t total_packed = 0; /* total amount packed this time */ dt_elem_desc_t* description; dt_elem_desc_t* pElem; - const ompi_datatype_t *pData = pConvertor->pDesc; + const opal_datatype_t *pData = pConvertor->pDesc; unsigned char *source_base, *destination; size_t iov_len_local; uint32_t iov_count; - DO_DEBUG( opal_output( 0, "ompi_convertor_generic_simple_pack( %p, {%p, %lu}, %d )\n", (void*)pConvertor, + DO_DEBUG( opal_output( 0, "opal_convertor_generic_simple_pack( %p, {%p, %lu}, %d )\n", (void*)pConvertor, iov[0].iov_base, (unsigned long)iov[0].iov_len, *out_size ); ); description = pConvertor->use_desc->desc; @@ -284,7 +291,7 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor, destination = (unsigned char *) iov[iov_count].iov_base; iov_len_local = iov[iov_count].iov_len; while( 1 ) { - while( pElem->elem.common.flags & DT_FLAG_DATA ) { + while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ PACK_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc, source_base, destination, iov_len_local ); @@ -296,7 +303,7 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor, } goto complete_loop; } - if( DT_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ + if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ DO_DEBUG( opal_output( 0, "pack end_loop count %d stack_pos %d" " pos_desc %d disp %ld space %lu\n", (int)pStack->count, pConvertor->stack_pos, @@ -317,7 +324,7 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor, if( pStack->index == -1 ) { pStack->disp += (pData->ub - pData->lb); } else { - assert( DT_LOOP == description[pStack->index].loop.common.type ); + assert( OPAL_DATATYPE_LOOP == description[pStack->index].loop.common.type ); pStack->disp += description[pStack->index].loop.extent; } } @@ -326,9 +333,9 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor, DO_DEBUG( opal_output( 0, "pack new_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", (int)pStack->count, pConvertor->stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); } - if( DT_LOOP == pElem->elem.common.type ) { - ptrdiff_t local_disp = (ptrdiff_t)source_base; - if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) { + if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { + OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)source_base; + if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { PACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc, source_base, destination, iov_len_local ); if( 0 == count_desc ) { /* completed */ @@ -337,8 +344,8 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor, } /* Save the stack with the correct last_count value. */ } - local_disp = (ptrdiff_t)source_base - local_disp; - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc, + local_disp = (OPAL_PTRDIFF_TYPE)source_base - local_disp; + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; update_loop_description: /* update the current state */ @@ -361,7 +368,7 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor, return 1; } /* I complete an element, next step I should go to the next one */ - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc, + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_INT8, count_desc, source_base - pStack->disp - pConvertor->pBaseBuf ); DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n", pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); diff --git a/ompi/datatype/datatype_pack.h b/opal/datatype/opal_datatype_pack.h similarity index 82% rename from ompi/datatype/datatype_pack.h rename to opal/datatype/opal_datatype_pack.h index d6a56b271e..71635528b3 100644 --- a/ompi/datatype/datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -1,8 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,10 +11,17 @@ * $HEADER$ */ -#ifndef DATATYPE_PACK_H_HAS_BEEN_INCLUDED -#define DATATYPE_PACK_H_HAS_BEEN_INCLUDED +#ifndef OPAL_DATATYPE_PACK_H_HAS_BEEN_INCLUDED +#define OPAL_DATATYPE_PACK_H_HAS_BEEN_INCLUDED -static inline void pack_predefined_data( ompi_convertor_t* CONVERTOR, +#include "opal_config.h" + +#include +#ifdef HAVE_STDINT_H +#include +#endif + +static inline void pack_predefined_data( opal_convertor_t* CONVERTOR, dt_elem_desc_t* ELEM, uint32_t* COUNT, unsigned char** SOURCE, @@ -25,16 +33,16 @@ static inline void pack_predefined_data( ompi_convertor_t* CONVERTOR, ddt_elem_desc_t* _elem = &((ELEM)->elem); unsigned char* _source = (*SOURCE) + _elem->disp; - _copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size; + _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; if( (_copy_count * _copy_blength) > *(SPACE) ) { _copy_count = (uint32_t)(*(SPACE) / _copy_blength); if( 0 == _copy_count ) return; /* nothing to do */ } - if( (ptrdiff_t)_copy_blength == _elem->extent ) { + if( (OPAL_PTRDIFF_TYPE)_copy_blength == _elem->extent ) { _copy_blength *= _copy_count; - /* the extent and the size of the basic datatype are equals */ - OMPI_DDT_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf, + /* the extent and the size of the basic datatype are equal */ + OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack 1. memcpy( %p, %p, %lu ) => space %lu\n", *(DESTINATION), _source, (unsigned long)_copy_blength, (unsigned long)(*(SPACE)) ); ); @@ -44,7 +52,7 @@ static inline void pack_predefined_data( ompi_convertor_t* CONVERTOR, } else { uint32_t _i; for( _i = 0; _i < _copy_count; _i++ ) { - OMPI_DDT_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", *(DESTINATION), _source, (unsigned long)_copy_blength, (unsigned long)(*(SPACE) - (_i * _copy_blength)) ); ); @@ -59,7 +67,7 @@ static inline void pack_predefined_data( ompi_convertor_t* CONVERTOR, *(COUNT) -= _copy_count; } -static inline void pack_contiguous_loop( ompi_convertor_t* CONVERTOR, +static inline void pack_contiguous_loop( opal_convertor_t* CONVERTOR, dt_elem_desc_t* ELEM, uint32_t* COUNT, unsigned char** SOURCE, @@ -75,7 +83,7 @@ static inline void pack_contiguous_loop( ompi_convertor_t* CONVERTOR, if( (_copy_loops * _end_loop->size) > *(SPACE) ) _copy_loops = (uint32_t)(*(SPACE) / _end_loop->size); for( _i = 0; _i < _copy_loops; _i++ ) { - OMPI_DDT_SAFEGUARD_POINTER( _source, _end_loop->size, (CONVERTOR)->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _end_loop->size, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack 3. memcpy( %p, %p, %lu ) => space %lu\n", *(DESTINATION), _source, (unsigned long)_end_loop->size, (unsigned long)(*(SPACE) - _i * _end_loop->size) ); ); @@ -99,4 +107,4 @@ pack_predefined_data( (CONVERTOR), (ELEM), &(COUNT), &(SOURCE), &(DESTINATION), #define PACK_CONTIGUOUS_LOOP( CONVERTOR, ELEM, COUNT, SOURCE, DESTINATION, SPACE ) \ pack_contiguous_loop( (CONVERTOR), (ELEM), &(COUNT), &(SOURCE), &(DESTINATION), &(SPACE) ) -#endif /* DATATYPE_PACK_H_HAS_BEEN_INCLUDED */ +#endif /* OPAL_DATATYPE_PACK_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/datatype/position.c b/opal/datatype/opal_datatype_position.c similarity index 84% rename from ompi/datatype/position.c rename to opal/datatype/opal_datatype_position.c index 04563a1a76..2c5b900152 100644 --- a/ompi/datatype/position.c +++ b/opal/datatype/opal_datatype_position.c @@ -3,13 +3,14 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,20 +18,24 @@ * $HEADER$ */ -#include "ompi_config.h" +#include "opal_config.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype_internal.h" +#include +#include #ifdef HAVE_ALLOCA_H #include #endif -#include + +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" #if OPAL_ENABLE_DEBUG -extern int ompi_position_debug; -#define DO_DEBUG(INST) if( ompi_position_debug ) { INST } +#include "opal/util/output.h" + +extern int opal_position_debug; +#define DO_DEBUG(INST) if( opal_position_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ @@ -41,12 +46,12 @@ extern int ompi_position_debug; * But first let's make some global assumptions: * - a datatype (with the flag DT_DATA set) will have the contiguous flags set if and only if * the data is really contiguous (extent equal with size) - * - for the DT_LOOP type the DT_CONTIGUOUS flag set means that the content of the loop is + * - for the OPAL_DATATYPE_LOOP type the DT_CONTIGUOUS flag set means that the content of the loop is * contiguous but with a gap in the begining or at the end. - * - the DT_CONTIGUOUS flag for the type DT_END_LOOP is meaningless. + * - the DT_CONTIGUOUS flag for the type OPAL_DATATYPE_END_LOOP is meaningless. */ -static inline void position_predefined_data( ompi_convertor_t* CONVERTOR, +static inline void position_predefined_data( opal_convertor_t* CONVERTOR, dt_elem_desc_t* ELEM, uint32_t* COUNT, unsigned char** POINTER, @@ -55,22 +60,22 @@ static inline void position_predefined_data( ompi_convertor_t* CONVERTOR, uint32_t _copy_count = *(COUNT); size_t _copy_blength; ddt_elem_desc_t* _elem = &((ELEM)->elem); - - _copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size; + + _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; if( (_copy_count * _copy_blength) > *(SPACE) ) { _copy_count = (uint32_t)(*(SPACE) / _copy_blength); if( 0 == _copy_count ) return; /* nothing to do */ } _copy_blength *= _copy_count; - - OMPI_DDT_SAFEGUARD_POINTER( *(POINTER) + _elem->disp, _copy_blength, (CONVERTOR)->pBaseBuf, + + OPAL_DATATYPE_SAFEGUARD_POINTER( *(POINTER) + _elem->disp, _copy_blength, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); *(POINTER) += (_copy_count * _elem->extent); *(SPACE) -= _copy_blength; *(COUNT) -= _copy_count; } -static inline void position_contiguous_loop( ompi_convertor_t* CONVERTOR, +static inline void position_contiguous_loop( opal_convertor_t* CONVERTOR, dt_elem_desc_t* ELEM, uint32_t* COUNT, unsigned char** POINTER, @@ -79,10 +84,10 @@ static inline void position_contiguous_loop( ompi_convertor_t* CONVERTOR, ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM); ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + (ELEM)->loop.items); uint32_t _copy_loops = *(COUNT); - + if( (_copy_loops * _end_loop->size) > *(SPACE) ) _copy_loops = (uint32_t)(*(SPACE) / _end_loop->size); - OMPI_DDT_SAFEGUARD_POINTER( *(POINTER) + _end_loop->first_elem_disp, + OPAL_DATATYPE_SAFEGUARD_POINTER( *(POINTER) + _end_loop->first_elem_disp, (_copy_loops - 1) * _loop->extent + _end_loop->size, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); *(POINTER) += _copy_loops * _loop->extent; @@ -96,7 +101,7 @@ static inline void position_contiguous_loop( ompi_convertor_t* CONVERTOR, #define POSITION_CONTIGUOUS_LOOP( CONVERTOR, ELEM, COUNT, POSITION, SPACE ) \ position_contiguous_loop( (CONVERTOR), (ELEM), &(COUNT), &(POSITION), &(SPACE) ) -int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, +int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, size_t* position ) { dt_stack_t* pStack; /* pointer to the position on the stack */ @@ -107,9 +112,9 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, dt_elem_desc_t* pElem; unsigned char *base_pointer = pConvertor->pBaseBuf; size_t iov_len_local; - ptrdiff_t extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb; + OPAL_PTRDIFF_TYPE extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb; - DUMP( "ompi_convertor_generic_simple_position( %p, &%ld )\n", (void*)pConvertor, (long)*position ); + DUMP( "opal_convertor_generic_simple_position( %p, &%ld )\n", (void*)pConvertor, (long)*position ); /* We dont want to have to parse the datatype multiple times. What we are interested in * here is to compute the number of completed datatypes that we can move forward, update @@ -143,16 +148,16 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, count_desc = (uint32_t)pStack->count; pStack--; pConvertor->stack_pos--; - pElem = &(description[pos_desc]); + pElem = &(description[pos_desc]); base_pointer += pStack->disp; - + DO_DEBUG( opal_output( 0, "position start pos_desc %d count_desc %d disp %llx\n" "stack_pos %d pos_desc %d count_desc %d disp %llx\n", pos_desc, count_desc, (unsigned long long)(base_pointer - pConvertor->pBaseBuf), pConvertor->stack_pos, pStack->index, (int)pStack->count, (unsigned long long)pStack->disp ); ); while( 1 ) { - if( DT_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ + if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ DO_DEBUG( opal_output( 0, "position end_loop count %d stack_pos %d pos_desc %d disp %llx space %lu\n", (int)pStack->count, pConvertor->stack_pos, pos_desc, (unsigned long long)pStack->disp, (unsigned long)iov_len_local ); ); @@ -169,7 +174,7 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, if( pStack->index == -1 ) { pStack->disp += extent; } else { - assert( DT_LOOP == description[pStack->index].loop.common.type ); + assert( OPAL_DATATYPE_LOOP == description[pStack->index].loop.common.type ); pStack->disp += description[pStack->index].loop.extent; } pos_desc = pStack->index + 1; @@ -180,9 +185,9 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, (int)pStack->count, pConvertor->stack_pos, pos_desc, (unsigned long long)pStack->disp, (unsigned long)iov_len_local ); ); } - if( DT_LOOP == pElem->elem.common.type ) { - ptrdiff_t local_disp = (ptrdiff_t)base_pointer; - if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) { + if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { + OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)base_pointer; + if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { POSITION_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc, base_pointer, iov_len_local ); if( 0 == count_desc ) { /* completed */ @@ -191,8 +196,8 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, } /* Save the stack with the correct last_count value. */ } - local_disp = (ptrdiff_t)base_pointer - local_disp; - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc, + local_disp = (OPAL_PTRDIFF_TYPE)base_pointer - local_disp; + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp ); pos_desc++; update_loop_description: /* update the current state */ @@ -204,7 +209,7 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, (unsigned long long)pStack->disp, (unsigned long)iov_len_local ); ); continue; } - while( pElem->elem.common.flags & DT_FLAG_DATA ) { + while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ POSITION_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc, base_pointer, iov_len_local ); @@ -226,7 +231,7 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, if( !(pConvertor->flags & CONVERTOR_COMPLETED) ) { /* I complete an element, next step I should go to the next one */ - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc, + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_UINT1, count_desc, base_pointer - pStack->disp - pConvertor->pBaseBuf ); DO_DEBUG( opal_output( 0, "position save stack stack_pos %d pos_desc %d count_desc %d disp %llx\n", pConvertor->stack_pos, pStack->index, (int)pStack->count, (unsigned long long)pStack->disp ); ); @@ -234,4 +239,3 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor, } return 1; } - diff --git a/ompi/datatype/datatype_prototypes.h b/opal/datatype/opal_datatype_prototypes.h similarity index 61% rename from ompi/datatype/datatype_prototypes.h rename to opal/datatype/opal_datatype_prototypes.h index 4f342b1384..1216f15ce6 100644 --- a/ompi/datatype/datatype_prototypes.h +++ b/opal/datatype/opal_datatype_prototypes.h @@ -1,8 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,58 +11,66 @@ * $HEADER$ */ -#ifndef DATATYPE_PROTOTYPES_H_HAS_BEEN_INCLUDED -#define DATATYPE_PROTOTYPES_H_HAS_BEEN_INCLUDED +#ifndef OPAL_DATATYPE_PROTOTYPES_H_HAS_BEEN_INCLUDED +#define OPAL_DATATYPE_PROTOTYPES_H_HAS_BEEN_INCLUDED -#include "ompi_config.h" +#include "opal_config.h" +/* + * First the public ones + */ + +OPAL_DECLSPEC int32_t +opal_unpack_general( opal_convertor_t* pConvertor, + struct iovec* iov, uint32_t* out_size, + size_t* max_data ); +OPAL_DECLSPEC int32_t +opal_unpack_general_checksum( opal_convertor_t* pConvertor, + struct iovec* iov, uint32_t* out_size, + size_t* max_data ); + +/* + * Now the internal functions + */ int32_t -ompi_pack_homogeneous_contig( ompi_convertor_t* pConv, +opal_pack_homogeneous_contig( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ); int32_t -ompi_pack_homogeneous_contig_checksum( ompi_convertor_t* pConv, +opal_pack_homogeneous_contig_checksum( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ); int32_t -ompi_pack_homogeneous_contig_with_gaps( ompi_convertor_t* pConv, +opal_pack_homogeneous_contig_with_gaps( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ); int32_t -ompi_pack_homogeneous_contig_with_gaps_checksum( ompi_convertor_t* pConv, +opal_pack_homogeneous_contig_with_gaps_checksum( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ); int32_t -ompi_generic_simple_pack( ompi_convertor_t* pConvertor, +opal_generic_simple_pack( opal_convertor_t* pConvertor, struct iovec* iov, uint32_t* out_size, size_t* max_data ); int32_t -ompi_generic_simple_pack_checksum( ompi_convertor_t* pConvertor, +opal_generic_simple_pack_checksum( opal_convertor_t* pConvertor, struct iovec* iov, uint32_t* out_size, size_t* max_data ); int32_t -ompi_unpack_general( ompi_convertor_t* pConvertor, - struct iovec* iov, uint32_t* out_size, - size_t* max_data ); -int32_t -ompi_unpack_general_checksum( ompi_convertor_t* pConvertor, - struct iovec* iov, uint32_t* out_size, - size_t* max_data ); -int32_t -ompi_unpack_homogeneous_contig( ompi_convertor_t* pConv, +opal_unpack_homogeneous_contig( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ); int32_t -ompi_unpack_homogeneous_contig_checksum( ompi_convertor_t* pConv, +opal_unpack_homogeneous_contig_checksum( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ); int32_t -ompi_generic_simple_unpack( ompi_convertor_t* pConvertor, +opal_generic_simple_unpack( opal_convertor_t* pConvertor, struct iovec* iov, uint32_t* out_size, size_t* max_data ); int32_t -ompi_generic_simple_unpack_checksum( ompi_convertor_t* pConvertor, +opal_generic_simple_unpack_checksum( opal_convertor_t* pConvertor, struct iovec* iov, uint32_t* out_size, size_t* max_data ); -#endif /* DATATYPE_PROTOTYPES_H_HAS_BEEN_INCLUDED */ +#endif /* OPAL_DATATYPE_PROTOTYPES_H_HAS_BEEN_INCLUDED */ diff --git a/opal/datatype/opal_datatype_resize.c b/opal/datatype/opal_datatype_resize.c new file mode 100644 index 0000000000..37379889ee --- /dev/null +++ b/opal/datatype/opal_datatype_resize.c @@ -0,0 +1,30 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" +#include "opal/constants.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" + +int32_t opal_datatype_resize( opal_datatype_t* type, OPAL_PTRDIFF_TYPE lb, OPAL_PTRDIFF_TYPE extent ) +{ + type->lb = lb; + type->ub = lb + extent; + + type->flags &= ~OPAL_DATATYPE_FLAG_NO_GAPS; + if( (extent == (OPAL_PTRDIFF_TYPE)type->size) && + (type->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) ) { + type->flags |= OPAL_DATATYPE_FLAG_NO_GAPS; + } + return OPAL_SUCCESS; +} diff --git a/ompi/datatype/datatype_unpack.c b/opal/datatype/opal_datatype_unpack.c similarity index 80% rename from ompi/datatype/datatype_unpack.c rename to opal/datatype/opal_datatype_unpack.c index 45b2fc9f4f..116a582417 100644 --- a/ompi/datatype/datatype_unpack.c +++ b/opal/datatype/opal_datatype_unpack.c @@ -3,14 +3,14 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008 UT-Battelle, LLC + * Copyright (c) 2008-2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -18,33 +18,35 @@ * $HEADER$ */ -#include "ompi_config.h" +#include "opal_config.h" + +#include #include -#include "ompi/datatype/convertor_internal.h" -#include "ompi/datatype/datatype_internal.h" - -#include +#include "opal/datatype/opal_convertor_internal.h" +#include "opal/datatype/opal_datatype_internal.h" #if OPAL_ENABLE_DEBUG -extern int ompi_unpack_debug; -#define DO_DEBUG(INST) if( ompi_unpack_debug ) { INST } +#include "opal/util/output.h" + +extern int opal_unpack_debug; +#define DO_DEBUG(INST) if( opal_unpack_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ -#include "ompi/datatype/datatype_checksum.h" -#include "ompi/datatype/datatype_unpack.h" -#include "ompi/datatype/datatype_prototypes.h" +#include "opal/datatype/opal_datatype_checksum.h" +#include "opal/datatype/opal_datatype_unpack.h" +#include "opal/datatype/opal_datatype_prototypes.h" #if defined(CHECKSUM) -#define ompi_unpack_general_function ompi_unpack_general_checksum -#define ompi_unpack_homogeneous_contig_function ompi_unpack_homogeneous_contig_checksum -#define ompi_generic_simple_unpack_function ompi_generic_simple_unpack_checksum +#define opal_unpack_general_function opal_unpack_general_checksum +#define opal_unpack_homogeneous_contig_function opal_unpack_homogeneous_contig_checksum +#define opal_generic_simple_unpack_function opal_generic_simple_unpack_checksum #else -#define ompi_unpack_general_function ompi_unpack_general -#define ompi_unpack_homogeneous_contig_function ompi_unpack_homogeneous_contig -#define ompi_generic_simple_unpack_function ompi_generic_simple_unpack +#define opal_unpack_general_function opal_unpack_general +#define opal_unpack_homogeneous_contig_function opal_unpack_homogeneous_contig +#define opal_generic_simple_unpack_function opal_generic_simple_unpack #endif /* defined(CHECKSUM) */ /* @@ -54,27 +56,27 @@ extern int ompi_unpack_debug; */ /* Convert data from multiple input buffers (as received from the network layer) * to a contiguous output buffer with a predefined size. - * return OMPI_SUCCESS if everything went OK and if there is still room before the complete + * return OPAL_SUCCESS if everything went OK and if there is still room before the complete * conversion of the data (need additional call with others input buffers ) * 1 if everything went fine and the data was completly converted * -1 something wrong occurs. */ int32_t -ompi_unpack_general_function( ompi_convertor_t* pConvertor, +opal_unpack_general_function( opal_convertor_t* pConvertor, struct iovec* iov, uint32_t* out_size, size_t* max_data ) { - dt_stack_t* pStack; /* pointer to the position on the stack */ - uint32_t pos_desc; /* actual position in the description of the derived datatype */ - int32_t count_desc; /* the number of items already done in the actual pos_desc */ - int type = DT_CHAR; /* type at current position */ - ptrdiff_t advance; /* number of bytes that we should advance the buffer */ - ptrdiff_t disp_desc = 0; /* compute displacement for truncated data */ - size_t bConverted = 0; /* number of bytes converted this time */ - const ompi_convertor_master_t* master = pConvertor->master; + dt_stack_t* pStack; /* pointer to the position on the stack */ + uint32_t pos_desc; /* actual position in the description of the derived datatype */ + int32_t count_desc; /* the number of items already done in the actual pos_desc */ + int type = OPAL_DATATYPE_INT8; /* type at current position */ + OPAL_PTRDIFF_TYPE advance; /* number of bytes that we should advance the buffer */ + OPAL_PTRDIFF_TYPE disp_desc = 0; /* compute displacement for truncated data */ + size_t bConverted = 0; /* number of bytes converted this time */ + const opal_convertor_master_t* master = pConvertor->master; dt_elem_desc_t* description; - ptrdiff_t extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb; + OPAL_PTRDIFF_TYPE extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb; size_t oCount = extent * pConvertor->count; size_t iCount, total_bytes_converted = 0; char* pInput; @@ -98,7 +100,7 @@ ompi_unpack_general_function( ompi_convertor_t* pConvertor, pInput = iov[iov_count].iov_base; iCount = iov[iov_count].iov_len; while( 1 ) { - if( DT_END_LOOP == description[pos_desc].elem.common.type ) { /* end of the current loop */ + if( OPAL_DATATYPE_END_LOOP == description[pos_desc].elem.common.type ) { /* end of the current loop */ if( --(pStack->count) == 0 ) { /* end of loop */ if( pConvertor->stack_pos == 0 ) { goto save_and_return; /* completed */ @@ -111,29 +113,29 @@ ompi_unpack_general_function( ompi_convertor_t* pConvertor, if( pStack->index == -1 ) { pStack->disp += extent; } else { - assert( DT_LOOP == description[pStack->index].elem.common.type ); + assert( OPAL_DATATYPE_LOOP == description[pStack->index].elem.common.type ); pStack->disp += description[pStack->index].loop.extent; } } count_desc = description[pos_desc].elem.count; disp_desc = description[pos_desc].elem.disp; } - if( DT_LOOP == description[pos_desc].elem.common.type ) { + if( OPAL_DATATYPE_LOOP == description[pos_desc].elem.common.type ) { do { PUSH_STACK( pStack, pConvertor->stack_pos, - pos_desc, DT_LOOP, description[pos_desc].loop.loops, pStack->disp ); + pos_desc, OPAL_DATATYPE_LOOP, description[pos_desc].loop.loops, pStack->disp ); pos_desc++; - } while( DT_LOOP == description[pos_desc].loop.common.type ); /* let's start another loop */ + } while( OPAL_DATATYPE_LOOP == description[pos_desc].loop.common.type ); /* let's start another loop */ DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, description, "advance loops" ); /* update the current state */ count_desc = description[pos_desc].elem.count; disp_desc = description[pos_desc].elem.disp; } - while( description[pos_desc].elem.common.flags & DT_FLAG_DATA ) { + while( description[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ type = description[pos_desc].elem.common.type; rc = master->pFunctions[type]( pConvertor, count_desc, - pInput, iCount, ompi_ddt_basicDatatypes[type]->size, + pInput, iCount, opal_datatype_basicDatatypes[type]->size, pConvertor->pBaseBuf + pStack->disp + disp_desc, oCount, description[pos_desc].elem.extent, &advance ); iCount -= advance; /* decrease the available space in the buffer */ @@ -181,22 +183,22 @@ ompi_unpack_general_function( ompi_convertor_t* pConvertor, * the ones that have gaps in the beginning and/or at the end but where the data to * be unpacked is contiguous. However, this function only work for homogeneous cases * and the datatype that are contiguous and where the extent is equal to the size are - * taken in account directly in the ompi_convertor_unpack function (in convertor.c) for + * taken in account directly in the opal_convertor_unpack function (in convertor.c) for * the homogeneous case. */ int32_t -ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv, +opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv, struct iovec* iov, uint32_t* out_size, size_t* max_data ) { - const ompi_datatype_t *pData = pConv->pDesc; + const opal_datatype_t *pData = pConv->pDesc; unsigned char *user_memory, *packed_buffer; uint32_t iov_count, i; size_t bConverted, remaining, length, initial_bytes_converted = pConv->bConverted; dt_stack_t* stack = pConv->pStack; - ptrdiff_t extent = pData->ub - pData->lb; - ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; + OPAL_PTRDIFF_TYPE extent = pData->ub - pData->lb; + OPAL_PTRDIFF_TYPE initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( pBaseBuf %p, iov_count %d )\n", pConv->pBaseBuf, *out_size ); ); @@ -208,13 +210,13 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv, bConverted = remaining; /* how much will get unpacked this time */ user_memory = pConv->pBaseBuf + initial_displ; - if( (ptrdiff_t)pData->size == extent ) { + if( (OPAL_PTRDIFF_TYPE)pData->size == extent ) { user_memory += pConv->bConverted; DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( user_memory %p, packed_buffer %p length %lu\n", user_memory, packed_buffer, (unsigned long)remaining ); ); /* contiguous data or basic datatype with count */ - OMPI_DDT_SAFEGUARD_POINTER( user_memory, remaining, + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, remaining, pConv->pBaseBuf, pData, pConv->count ); DO_DEBUG( opal_output( 0, "1. unpack contig dest %p src %p length %lu\n", user_memory, packed_buffer, (unsigned long)remaining ); ); @@ -232,7 +234,7 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv, if( length != 0 ) { length = pData->size - length; if( length <= remaining ) { - OMPI_DDT_SAFEGUARD_POINTER( user_memory, length, pConv->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, length, pConv->pBaseBuf, pData, pConv->count ); DO_DEBUG( opal_output( 0, "2. unpack dest %p src %p length %lu\n", user_memory, packed_buffer, (unsigned long)length ); ); @@ -243,7 +245,7 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv, } } for( i = 0; pData->size <= remaining; i++ ) { - OMPI_DDT_SAFEGUARD_POINTER( user_memory, pData->size, pConv->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, pData->size, pConv->pBaseBuf, pData, pConv->count ); DO_DEBUG( opal_output( 0, "3. unpack dest %p src %p length %lu\n", user_memory, packed_buffer, (unsigned long)pData->size ); ); @@ -256,7 +258,7 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv, stack[1].disp = remaining; /* copy the last bits */ if( remaining != 0 ) { - OMPI_DDT_SAFEGUARD_POINTER( user_memory, remaining, pConv->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, remaining, pConv->pBaseBuf, pData, pConv->count ); DO_DEBUG( opal_output( 0, "4. unpack dest %p src %p length %lu\n", user_memory, packed_buffer, (unsigned long)remaining ); ); @@ -288,16 +290,16 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv, * of the exponent or mantissa). */ static inline uint32_t -ompi_unpack_partial_datatype( ompi_convertor_t* pConvertor, dt_elem_desc_t* pElem, +opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pElem, unsigned char* partial_data, - ptrdiff_t start_position, ptrdiff_t end_position, + OPAL_PTRDIFF_TYPE start_position, OPAL_PTRDIFF_TYPE end_position, unsigned char** user_buffer ) { char unused_byte = 0x7F, saved_data[16]; unsigned char temporary[16], *temporary_buffer = temporary; unsigned char* real_data = *user_buffer + pElem->elem.disp; uint32_t i, length, count_desc = 1; - size_t data_length = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size; + size_t data_length = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; DO_DEBUG( opal_output( 0, "unpack partial data start %lu end %lu data_length %lu user %p\n" "\tbConverted %lu total_length %lu count %d\n", @@ -326,7 +328,7 @@ ompi_unpack_partial_datatype( ompi_convertor_t* pConvertor, dt_elem_desc_t* pEle temporary_buffer, *user_buffer, data_length ); /* reload the length as it is reset by the macro */ - data_length = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size; + data_length = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; /* For every occurence of the unused byte move data from the saved * buffer back into the user memory. @@ -344,28 +346,28 @@ ompi_unpack_partial_datatype( ompi_convertor_t* pConvertor, dt_elem_desc_t* pEle * But first let's make some global assumptions: * - a datatype (with the flag DT_DATA set) will have the contiguous flags set if and only if * the data is really contiguous (extent equal with size) - * - for the DT_LOOP type the DT_CONTIGUOUS flag set means that the content of the loop is + * - for the OPAL_DATATYPE_LOOP type the DT_CONTIGUOUS flag set means that the content of the loop is * contiguous but with a gap in the begining or at the end. - * - the DT_CONTIGUOUS flag for the type DT_END_LOOP is meaningless. + * - the DT_CONTIGUOUS flag for the type OPAL_DATATYPE_END_LOOP is meaningless. */ int32_t -ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor, +opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, struct iovec* iov, uint32_t* out_size, size_t* max_data ) { dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ uint32_t count_desc; /* the number of items already done in the actual pos_desc */ - uint16_t type = DT_MAX_PREDEFINED; /* type at current position */ + uint16_t type = OPAL_DATATYPE_MAX_PREDEFINED; /* type at current position */ size_t total_unpacked = 0; /* total size unpacked this time */ dt_elem_desc_t* description; dt_elem_desc_t* pElem; - const ompi_datatype_t *pData = pConvertor->pDesc; + const opal_datatype_t *pData = pConvertor->pDesc; unsigned char *user_memory_base, *packed_buffer; size_t iov_len_local; uint32_t iov_count; - DO_DEBUG( opal_output( 0, "ompi_convertor_generic_simple_unpack( %p, {%p, %lu}, %u )\n", + DO_DEBUG( opal_output( 0, "opal_convertor_generic_simple_unpack( %p, {%p, %lu}, %u )\n", (void*)pConvertor, iov[0].iov_base, (unsigned long)iov[0].iov_len, *out_size ); ); description = pConvertor->use_desc->desc; @@ -393,12 +395,12 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor, packed_buffer = (unsigned char *) iov[iov_count].iov_base; iov_len_local = iov[iov_count].iov_len; if( 0 != pConvertor->partial_length ) { - size_t element_length = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size; + size_t element_length = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; size_t missing_length = element_length - pConvertor->partial_length; - assert( pElem->elem.common.flags & DT_FLAG_DATA ); + assert( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ); COMPUTE_CSUM( packed_buffer, missing_length, pConvertor ); - ompi_unpack_partial_datatype( pConvertor, pElem, + opal_unpack_partial_datatype( pConvertor, pElem, packed_buffer, pConvertor->partial_length, element_length, &user_memory_base ); @@ -413,7 +415,7 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor, pConvertor->partial_length = 0; /* nothing more inside */ } while( 1 ) { - while( pElem->elem.common.flags & DT_FLAG_DATA ) { + while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ UNPACK_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc, packed_buffer, user_memory_base, iov_len_local ); @@ -424,16 +426,16 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor, continue; } type = pElem->elem.common.type; - assert( type < DT_MAX_PREDEFINED ); + assert( type < OPAL_DATATYPE_MAX_PREDEFINED ); if( 0 != iov_len_local ) { unsigned char* temp = user_memory_base; /* We have some partial data here. Let's copy it into the convertor * and keep it hot until the next round. */ - assert( iov_len_local < ompi_ddt_basicDatatypes[type]->size ); + assert( iov_len_local < opal_datatype_basicDatatypes[type]->size ); COMPUTE_CSUM( packed_buffer, iov_len_local, pConvertor ); - ompi_unpack_partial_datatype( pConvertor, pElem, + opal_unpack_partial_datatype( pConvertor, pElem, packed_buffer, 0, iov_len_local, &temp ); @@ -442,7 +444,7 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor, } goto complete_loop; } - if( DT_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ + if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ DO_DEBUG( opal_output( 0, "unpack end_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", (int)pStack->count, pConvertor->stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); @@ -460,7 +462,7 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor, if( pStack->index == -1 ) { pStack->disp += (pData->ub - pData->lb); } else { - assert( DT_LOOP == description[pStack->index].loop.common.type ); + assert( OPAL_DATATYPE_LOOP == description[pStack->index].loop.common.type ); pStack->disp += description[pStack->index].loop.extent; } } @@ -470,9 +472,9 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor, (int)pStack->count, pConvertor->stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); } - if( DT_LOOP == pElem->elem.common.type ) { - ptrdiff_t local_disp = (ptrdiff_t)user_memory_base; - if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) { + if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { + OPAL_PTRDIFF_TYPE local_disp = (OPAL_PTRDIFF_TYPE)user_memory_base; + if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { UNPACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc, packed_buffer, user_memory_base, iov_len_local ); if( 0 == count_desc ) { /* completed */ @@ -481,8 +483,8 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor, } /* Save the stack with the correct last_count value. */ } - local_disp = (ptrdiff_t)user_memory_base - local_disp; - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc, + local_disp = (OPAL_PTRDIFF_TYPE)user_memory_base - local_disp; + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; update_loop_description: /* update the current state */ @@ -504,7 +506,7 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor, return 1; } /* I complete an element, next step I should go to the next one */ - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc, + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_UINT1, count_desc, user_memory_base - pStack->disp - pConvertor->pBaseBuf ); DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n", pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); diff --git a/ompi/datatype/datatype_unpack.h b/opal/datatype/opal_datatype_unpack.h similarity index 80% rename from ompi/datatype/datatype_unpack.h rename to opal/datatype/opal_datatype_unpack.h index 8dde1bc23c..4dbeee991d 100644 --- a/ompi/datatype/datatype_unpack.h +++ b/opal/datatype/opal_datatype_unpack.h @@ -1,8 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2009 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,10 +11,20 @@ * $HEADER$ */ -#ifndef DATATYPE_UNPACK_H_HAS_BEEN_INCLUDED -#define DATATYPE_UNPACK_H_HAS_BEEN_INCLUDED +#ifndef OPAL_DATATYPE_UNPACK_H_HAS_BEEN_INCLUDED +#define OPAL_DATATYPE_UNPACK_H_HAS_BEEN_INCLUDED -static inline void unpack_predefined_data( ompi_convertor_t* CONVERTOR, /* the convertor */ +#include "opal_config.h" + +#include +#ifdef HAVE_STDINT_H +#include +#endif + +#include "opal/datatype/opal_convertor.h" + + +static inline void unpack_predefined_data( opal_convertor_t* CONVERTOR, /* the convertor */ dt_elem_desc_t* ELEM, /* the element description */ uint32_t* COUNT, /* the number of elements */ unsigned char** SOURCE, /* the source pointer */ @@ -25,16 +36,16 @@ static inline void unpack_predefined_data( ompi_convertor_t* CONVERTOR, /* the c ddt_elem_desc_t* _elem = &((ELEM)->elem); unsigned char* _destination = (*DESTINATION) + _elem->disp; - _copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size; + _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; if( (_copy_count * _copy_blength) > *(SPACE) ) { _copy_count = (uint32_t)(*(SPACE) / _copy_blength); if( 0 == _copy_count ) return; /* nothing to do */ } - if( _copy_blength == (uint32_t)_elem->extent ) { + if( (OPAL_PTRDIFF_TYPE)_copy_blength == _elem->extent ) { _copy_blength *= _copy_count; - /* the extent and the size of the basic datatype are equals */ - OMPI_DDT_SAFEGUARD_POINTER( _destination, _copy_blength, (CONVERTOR)->pBaseBuf, + /* the extent and the size of the basic datatype are equal */ + OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _copy_blength, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "unpack 1. memcpy( %p, %p, %lu ) => space %lu\n", _destination, *(SOURCE), (unsigned long)_copy_blength, (unsigned long)(*(SPACE)) ); ); @@ -44,7 +55,7 @@ static inline void unpack_predefined_data( ompi_convertor_t* CONVERTOR, /* the c } else { uint32_t _i; for( _i = 0; _i < _copy_count; _i++ ) { - OMPI_DDT_SAFEGUARD_POINTER( _destination, _copy_blength, (CONVERTOR)->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _copy_blength, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "unpack 2. memcpy( %p, %p, %lu ) => space %lu\n", _destination, *(SOURCE), (unsigned long)_copy_blength, (unsigned long)(*(SPACE) - (_i * _copy_blength)) ); ); @@ -59,7 +70,7 @@ static inline void unpack_predefined_data( ompi_convertor_t* CONVERTOR, /* the c *(COUNT) -= _copy_count; } -static inline void unpack_contiguous_loop( ompi_convertor_t* CONVERTOR, +static inline void unpack_contiguous_loop( opal_convertor_t* CONVERTOR, dt_elem_desc_t* ELEM, uint32_t* COUNT, unsigned char** SOURCE, @@ -75,7 +86,7 @@ static inline void unpack_contiguous_loop( ompi_convertor_t* CONVERTOR, if( (_copy_loops * _end_loop->size) > *(SPACE) ) _copy_loops = (uint32_t)(*(SPACE) / _end_loop->size); for( _i = 0; _i < _copy_loops; _i++ ) { - OMPI_DDT_SAFEGUARD_POINTER( _destination, _end_loop->size, (CONVERTOR)->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _end_loop->size, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "unpack 3. memcpy( %p, %p, %lu ) => space %lu\n", _destination, *(SOURCE), (unsigned long)_end_loop->size, (unsigned long)(*(SPACE) - _i * _end_loop->size) ); ); @@ -94,4 +105,4 @@ static inline void unpack_contiguous_loop( ompi_convertor_t* CONVERTOR, #define UNPACK_CONTIGUOUS_LOOP( CONVERTOR, ELEM, COUNT, SOURCE, DESTINATION, SPACE ) \ unpack_contiguous_loop( (CONVERTOR), (ELEM), &(COUNT), &(SOURCE), &(DESTINATION), &(SPACE) ) -#endif /* DATATYPE_UNPACK_H_HAS_BEEN_INCLUDED */ +#endif /* OPAL_DATATYPE_UNPACK_H_HAS_BEEN_INCLUDED */ diff --git a/opal/runtime/opal_init.c b/opal/runtime/opal_init.c index b722db730d..cf44ca8671 100644 --- a/opal/runtime/opal_init.c +++ b/opal/runtime/opal_init.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +31,7 @@ #include "opal/mca/base/base.h" #include "opal/runtime/opal.h" #include "opal/util/net.h" +#include "opal/datatype/opal_datatype.h" #include "opal/mca/installdirs/base/base.h" #include "opal/mca/memory/base/base.h" #include "opal/mca/memcpy/base/base.h" @@ -293,6 +295,12 @@ opal_init(void) opal_paffinity_base_open(); opal_paffinity_base_select(); + /* initialize the datatype engine */ + if (OPAL_SUCCESS != (ret = opal_datatype_init ())) { + error = "opal_datatype_init"; + goto return_error; + } + /* the memcpy component should be one of the first who get * loaded in order to make sure we ddo have all the available * versions of memcpy correctly configured. diff --git a/opal/runtime/opal_params.c b/opal/runtime/opal_params.c index da84470b95..a049074e81 100644 --- a/opal/runtime/opal_params.c +++ b/opal/runtime/opal_params.c @@ -12,6 +12,7 @@ * Copyright (c) 2006 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -28,6 +29,7 @@ #include "opal/constants.h" #include "opal/runtime/opal.h" +#include "opal/datatype/opal_datatype.h" #include "opal/mca/base/mca_base_param.h" #include "opal/threads/mutex.h" @@ -101,6 +103,6 @@ int opal_register_params(void) if (value) opal_mutex_check_locks = true; } #endif - - return OPAL_SUCCESS; + /* The ddt engine has a few parameters */ + return opal_datatype_register_params(); } diff --git a/test/datatype/Makefile.am b/test/datatype/Makefile.am index eb5517dead..021f788453 100644 --- a/test/datatype/Makefile.am +++ b/test/datatype/Makefile.am @@ -3,6 +3,7 @@ # of Tennessee Research Foundation. All rights # reserved. # Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -10,7 +11,7 @@ # $HEADER$ # -TESTS = checksum position ddt_test ddt_raw +TESTS = checksum position ddt_test ddt_raw opal_datatype_test check_PROGRAMS = $(TESTS) to_self ddt_pack @@ -38,3 +39,8 @@ position_LDADD = $(top_builddir)/ompi/libmpi.la to_self_SOURCES = to_self.c to_self_LDFLAGS = $(WRAPPER_EXTRA_LDFLAGS) to_self_LDADD = $(top_builddir)/ompi/libmpi.la + +opal_datatype_test_SOURCES = opal_datatype_test.c +opal_datatype_test_LDFLAGS = $(WRAPPER_EXTRA_LDFLAGS) +opal_datatype_test_LDADD = opal_ddt_lib.o $(top_builddir)/opal/libopen-pal.la + diff --git a/test/datatype/checksum.c b/test/datatype/checksum.c index fc65acabb3..bb7ed92d48 100644 --- a/test/datatype/checksum.c +++ b/test/datatype/checksum.c @@ -11,9 +11,9 @@ */ #include "ompi_config.h" -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/datatype_checksum.h" +#include "opal/datatype/opal_convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_datatype_checksum.h" #include #include @@ -36,14 +36,14 @@ int main( int argc, char* argv[] ) size_t max_data; uint32_t pack_checksum, contiguous_checksum, sparse_checksum, manual_checksum; struct iovec iov[2]; - ompi_convertor_t* convertor; + opal_convertor_t* convertor; - ompi_ddt_init(); + ompi_datatype_init(); srandom( (int)time(NULL) ); /*srandomdev();*/ - ompi_ddt_create_vector( SIZE, 1, 2, MPI_INT, &sparse ); - ompi_ddt_commit( &sparse ); + ompi_datatype_create_vector( SIZE, 1, 2, MPI_INT, &sparse ); + ompi_datatype_commit( &sparse ); sparse_array = (my_data_t*)malloc( sizeof(my_data_t) * SIZE ); array = (int*)malloc( sizeof(int) * SIZE ); @@ -61,16 +61,16 @@ int main( int argc, char* argv[] ) * Pack the sparse data into the packed array. This simulate the first step * of the buffered operation. */ - convertor = ompi_convertor_create( ompi_mpi_local_arch, 0 ); - ompi_convertor_personalize( convertor, CONVERTOR_WITH_CHECKSUM, NULL ); - ompi_convertor_prepare_for_send( convertor, sparse, SIZE, sparse_array ); + convertor = opal_convertor_create( opal_local_arch, 0 ); + opal_convertor_personalize( convertor, CONVERTOR_WITH_CHECKSUM, NULL ); + opal_convertor_prepare_for_send( convertor, &(sparse->super), SIZE, sparse_array ); iov[0].iov_base = packed; iov[0].iov_len = sizeof(int) * SIZE; max_data = iov[0].iov_len; iov_count = 1; - ompi_convertor_pack( convertor, iov, &iov_count, &max_data ); + opal_convertor_pack( convertor, iov, &iov_count, &max_data ); pack_checksum = convertor->checksum; OBJ_RELEASE(convertor); @@ -79,16 +79,16 @@ int main( int argc, char* argv[] ) * Now move the data from the packed array into the fragment to * be sent over the network (still simulation). */ - convertor = ompi_convertor_create( ompi_mpi_local_arch, 0 ); - ompi_convertor_personalize( convertor, CONVERTOR_WITH_CHECKSUM, NULL ); - ompi_convertor_prepare_for_send( convertor, MPI_INT, SIZE, packed ); + convertor = opal_convertor_create( opal_local_arch, 0 ); + opal_convertor_personalize( convertor, CONVERTOR_WITH_CHECKSUM, NULL ); + opal_convertor_prepare_for_send( convertor, &(ompi_mpi_int.dt.super), SIZE, packed ); iov[0].iov_base = array; iov[0].iov_len = sizeof(int) * SIZE; max_data = iov[0].iov_len; iov_count = 1; - ompi_convertor_pack( convertor, iov, &iov_count, &max_data ); + opal_convertor_pack( convertor, iov, &iov_count, &max_data ); contiguous_checksum = convertor->checksum; OBJ_RELEASE(convertor); @@ -98,9 +98,9 @@ int main( int argc, char* argv[] ) * the network and now we unpack it in the user memory using 2 * separate iovec. */ - convertor = ompi_convertor_create( ompi_mpi_local_arch, 0 ); - ompi_convertor_personalize( convertor, CONVERTOR_WITH_CHECKSUM, NULL ); - ompi_convertor_prepare_for_recv( convertor, sparse, SIZE, sparse_array ); + convertor = opal_convertor_create( opal_local_arch, 0 ); + opal_convertor_personalize( convertor, CONVERTOR_WITH_CHECKSUM, NULL ); + opal_convertor_prepare_for_recv( convertor, &(sparse->super), SIZE, sparse_array ); max_data = sizeof(int) * SIZE; iov[0].iov_base = array; @@ -109,7 +109,7 @@ int main( int argc, char* argv[] ) iov[1].iov_len = max_data - iov[0].iov_len; iov_count = 2; - ompi_convertor_unpack( convertor, iov, &iov_count, &max_data ); + opal_convertor_unpack( convertor, iov, &iov_count, &max_data ); sparse_checksum = convertor->checksum; OBJ_RELEASE(convertor); diff --git a/test/datatype/ddt_lib.c b/test/datatype/ddt_lib.c index c81f51b12d..015419d316 100644 --- a/test/datatype/ddt_lib.c +++ b/test/datatype/ddt_lib.c @@ -11,6 +11,7 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 Sun Microsystems Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -59,9 +60,9 @@ ompi_datatype_t* create_inversed_vector( ompi_datatype_t* type, int length ) { ompi_datatype_t* type1; - ompi_ddt_create_vector( length, 1, 2, type, &type1 ); + ompi_datatype_create_vector( length, 1, 2, type, &type1 ); - ompi_ddt_commit( &type1 ); + ompi_datatype_commit( &type1 ); return type1; } @@ -73,9 +74,9 @@ int mpich_typeub( void ) int blens[2]; ompi_datatype_t *type1, *type2, *type3, *types[2]; - ompi_ddt_create_vector( 2, 1, 4, &ompi_mpi_int, &type1 ); - ompi_ddt_commit( &type1 ); - ompi_ddt_get_extent( type1, &lb, &extent ); + ompi_datatype_create_vector( 2, 1, 4, &ompi_mpi_int.dt, &type1 ); + ompi_datatype_commit( &type1 ); + ompi_datatype_get_extent( type1, &lb, &extent ); extent1 = 5 * sizeof(int); if (extent != extent1) { printf("EXTENT 1 %ld != %ld\n", (long)extent, (long)extent1); @@ -88,14 +89,14 @@ int mpich_typeub( void ) displ[0] = 0; displ[1] = sizeof(int)*4; types[0] = type1; - types[1] = &ompi_mpi_ub; /*ompi_ddt_basicDatatypes[DT_UB];*/ + types[1] = &ompi_mpi_ub.dt; /*ompi_datatype_basicDatatypes[DT_UB];*/ extent2 = displ[1]; /* using MPI_UB and Type_struct, monkey with the extent, making it 16 */ - ompi_ddt_create_struct( 2, blens, displ, types, &type2 ); - ompi_ddt_commit( &type2 ); - ompi_ddt_get_extent( type2, &lb, &extent ); + ompi_datatype_create_struct( 2, blens, displ, types, &type2 ); + ompi_datatype_commit( &type2 ); + ompi_datatype_get_extent( type2, &lb, &extent ); if (extent != extent2) { printf("EXTENT 2 %ld != %ld\n", (long)extent, (long)extent2); errs++; @@ -108,13 +109,13 @@ int mpich_typeub( void ) */ displ[1] = sizeof(int); types[0] = type2; - types[1] = &ompi_mpi_ub; /*ompi_ddt_basicDatatypes[DT_UB];*/ + types[1] = &ompi_mpi_ub.dt; /*ompi_datatype_basicDatatypes[DT_UB];*/ extent3 = extent2; - ompi_ddt_create_struct( 2, blens, displ, types, &type3 ); - ompi_ddt_commit( &type3 ); + ompi_datatype_create_struct( 2, blens, displ, types, &type3 ); + ompi_datatype_commit( &type3 ); - ompi_ddt_get_extent( type3, &lb, &extent ); + ompi_datatype_get_extent( type3, &lb, &extent ); if (extent != extent3) { printf("EXTENT 3 %ld != %ld\n", (long)extent, (long)extent3); errs++; @@ -140,15 +141,15 @@ int mpich_typeub2( void ) disp[0] = -3; disp[1] = 0; disp[2] = 6; - types[0] = &ompi_mpi_lb; /* ompi_ddt_basicDatatypes[DT_LB]; */ - types[1] = &ompi_mpi_int; /* ompi_ddt_basicDatatypes[DT_INT]; */ - types[2] = &ompi_mpi_ub; /* ompi_ddt_basicDatatypes[DT_UB]; */ + types[0] = &ompi_mpi_lb.dt; /* ompi_datatype_basicDatatypes[DT_LB]; */ + types[1] = &ompi_mpi_int.dt; /* ompi_datatype_basicDatatypes[DT_INT]; */ + types[2] = &ompi_mpi_ub.dt; /* ompi_datatype_basicDatatypes[DT_UB]; */ - ompi_ddt_create_struct(3,blocklen,disp, types,&dt1); - ompi_ddt_commit(&dt1); + ompi_datatype_create_struct(3,blocklen,disp, types,&dt1); + ompi_datatype_commit(&dt1); - ompi_ddt_type_lb(dt1, &lb); ompi_ddt_type_ub(dt1, &ub); - ompi_ddt_type_extent(dt1,&ex1); ompi_ddt_type_size(dt1,&sz1); + ompi_datatype_type_lb(dt1, &lb); ompi_datatype_type_ub(dt1, &ub); + ompi_datatype_type_extent(dt1,&ex1); ompi_datatype_type_size(dt1,&sz1); /* Values should be lb = -3, ub = 6 extent 9; size depends on implementation */ if (lb != -3 || ub != 6 || ex1 != 9) { @@ -158,9 +159,9 @@ int mpich_typeub2( void ) else printf("Example 3.26 type1 correct\n" ); - ompi_ddt_create_contiguous(2,dt1,&dt2); - ompi_ddt_type_lb(dt2, &lb); ompi_ddt_type_ub(dt2, &ub); - ompi_ddt_type_extent(dt2,&ex2); ompi_ddt_type_size(dt2,&sz2); + ompi_datatype_create_contiguous(2,dt1,&dt2); + ompi_datatype_type_lb(dt2, &lb); ompi_datatype_type_ub(dt2, &ub); + ompi_datatype_type_extent(dt2,&ex2); ompi_datatype_type_size(dt2,&sz2); /* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */ if (lb != -3 || ub != 15 || ex2 != 18) { printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8); @@ -170,9 +171,9 @@ int mpich_typeub2( void ) else printf("Example 3.26 type1 correct\n" ); OBJ_RELEASE( dt2 ); assert( dt2 == NULL ); - ompi_ddt_create_contiguous(2,dt1,&dt2); - ompi_ddt_type_lb(dt2, &lb); ompi_ddt_type_ub(dt2, &ub); - ompi_ddt_type_extent(dt2,&ex2); ompi_ddt_type_size(dt2,&sz2); + ompi_datatype_create_contiguous(2,dt1,&dt2); + ompi_datatype_type_lb(dt2, &lb); ompi_datatype_type_ub(dt2, &ub); + ompi_datatype_type_extent(dt2,&ex2); ompi_datatype_type_size(dt2,&sz2); /* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */ if (lb != -3 || ub != 15 || ex2 != 18) { printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8); @@ -186,11 +187,11 @@ int mpich_typeub2( void ) blocklen[0]=1; blocklen[1]=1; disp[0]=0; disp[1]=ex1; - ompi_ddt_create_struct(2, blocklen, disp, types, &dt3); - ompi_ddt_commit(&dt3); + ompi_datatype_create_struct(2, blocklen, disp, types, &dt3); + ompi_datatype_commit(&dt3); - ompi_ddt_type_lb(dt3, &lb); ompi_ddt_type_ub(dt3, &ub); - ompi_ddt_type_extent(dt3,&ex3); ompi_ddt_type_size(dt3,&sz3); + ompi_datatype_type_lb(dt3, &lb); ompi_datatype_type_ub(dt3, &ub); + ompi_datatype_type_extent(dt3,&ex3); ompi_datatype_type_size(dt3,&sz3); /* Another way to express type2 */ if (lb != -3 || ub != 15 || ex3 != 18) { printf("type3 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8); @@ -220,13 +221,13 @@ int mpich_typeub3( void ) disp[0] = -3; disp[1] = 0; disp[2] = 6; - types[0] = &ompi_mpi_lb; /* ompi_ddt_basicDatatypes[DT_LB]; */ - types[1] = &ompi_mpi_int; /* ompi_ddt_basicDatatypes[DT_INT]; */ - types[2] = &ompi_mpi_ub; /* ompi_ddt_basicDatatypes[DT_UB]; */ + types[0] = &ompi_mpi_lb.dt; /* ompi_datatype_basicDatatypes[DT_LB]; */ + types[1] = &ompi_mpi_int.dt; /* ompi_datatype_basicDatatypes[DT_INT]; */ + types[2] = &ompi_mpi_ub.dt; /* ompi_datatype_basicDatatypes[DT_UB]; */ /* Generate samples for contiguous, hindexed, hvector, indexed, and vector (struct and contiguous tested in typeub2) */ - ompi_ddt_create_struct(3,blocklen,disp, types,&dt1); - ompi_ddt_commit(&dt1); + ompi_datatype_create_struct(3,blocklen,disp, types,&dt1); + ompi_datatype_commit(&dt1); /* This type is the same as in typeub2, and is tested there */ types[0]=dt1; types[1]=dt1; @@ -234,11 +235,11 @@ int mpich_typeub3( void ) disp[0]=-4; disp[1]=7; idisp[0]=-4; idisp[1]=7; - ompi_ddt_create_hindexed( 2, blocklen, disp, dt1, &dt2 ); - ompi_ddt_commit( &dt2 ); + ompi_datatype_create_hindexed( 2, blocklen, disp, dt1, &dt2 ); + ompi_datatype_commit( &dt2 ); - ompi_ddt_type_lb( dt2, &lb ); ompi_ddt_type_ub( dt2, &ub ); - ompi_ddt_type_extent( dt2, &ex ); ompi_ddt_type_size( dt2, &sz ); + ompi_datatype_type_lb( dt2, &lb ); ompi_datatype_type_ub( dt2, &ub ); + ompi_datatype_type_extent( dt2, &ex ); ompi_datatype_type_size( dt2, &sz ); if (lb != -7 || ub != 13 || ex != 20) { printf("hindexed lb %d ub %d extent %d size %d\n", (int)-7, (int)13, (int)20, (int)sz); @@ -248,11 +249,11 @@ int mpich_typeub3( void ) else printf( "hindexed ok\n" ); - ompi_ddt_create_indexed( 2, blocklen, idisp, dt1, &dt3 ); - ompi_ddt_commit( &dt3 ); + ompi_datatype_create_indexed( 2, blocklen, idisp, dt1, &dt3 ); + ompi_datatype_commit( &dt3 ); - ompi_ddt_type_lb( dt3, &lb ); ompi_ddt_type_ub( dt3, &ub ); - ompi_ddt_type_extent( dt3, &ex ); ompi_ddt_type_size( dt3, &sz ); + ompi_datatype_type_lb( dt3, &lb ); ompi_datatype_type_ub( dt3, &ub ); + ompi_datatype_type_extent( dt3, &ex ); ompi_datatype_type_size( dt3, &sz ); if (lb != -39 || ub != 69 || ex != 108) { printf("indexed lb %d ub %d extent %d size %d\n", (int)-39, (int)69, (int)108, (int)sz); @@ -262,11 +263,11 @@ int mpich_typeub3( void ) else printf( "indexed ok\n" ); - ompi_ddt_create_hvector( 2, 1, 14, dt1, &dt4 ); - ompi_ddt_commit( &dt4 ); + ompi_datatype_create_hvector( 2, 1, 14, dt1, &dt4 ); + ompi_datatype_commit( &dt4 ); - ompi_ddt_type_lb( dt4, &lb ); ompi_ddt_type_ub( dt4, &ub ); - ompi_ddt_type_extent( dt4, &ex ); ompi_ddt_type_size( dt4, &sz ); + ompi_datatype_type_lb( dt4, &lb ); ompi_datatype_type_ub( dt4, &ub ); + ompi_datatype_type_extent( dt4, &ex ); ompi_datatype_type_size( dt4, &sz ); if (lb != -3 || ub != 20 || ex != 23) { printf("hvector lb %d ub %d extent %d size %d\n", (int)-3, (int)20, (int)23, (int)sz); @@ -276,11 +277,11 @@ int mpich_typeub3( void ) else printf( "hvector ok\n" ); - ompi_ddt_create_vector( 2, 1, 14, dt1, &dt5 ); - ompi_ddt_commit( &dt5 ); + ompi_datatype_create_vector( 2, 1, 14, dt1, &dt5 ); + ompi_datatype_commit( &dt5 ); - ompi_ddt_type_lb( dt5, &lb ); ompi_ddt_type_ub( dt5, &ub ); - ompi_ddt_type_extent( dt5, &ex ); ompi_ddt_type_size( dt5, &sz ); + ompi_datatype_type_lb( dt5, &lb ); ompi_datatype_type_ub( dt5, &ub ); + ompi_datatype_type_extent( dt5, &ex ); ompi_datatype_type_size( dt5, &sz ); if (lb != -3 || ub != 132 || ex != 135) { printf("vector lb %d ub %d extent %d size %d\n", (int)-3, (int)132, (int)135, (int)sz); @@ -363,11 +364,11 @@ ompi_datatype_t* upper_matrix( unsigned int mat_size ) blocklen[i] = mat_size - i; } - ompi_ddt_create_indexed( mat_size, blocklen, disp, &ompi_mpi_double, + ompi_datatype_create_indexed( mat_size, blocklen, disp, &ompi_mpi_double.dt, &upper ); - ompi_ddt_commit( &upper ); + ompi_datatype_commit( &upper ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( upper ); + ompi_datatype_dump( upper ); } free( disp ); free( blocklen ); @@ -388,7 +389,7 @@ ompi_datatype_t* lower_matrix( unsigned int mat_size ) blocklen[i] = i; } - ompi_ddt_create_indexed( mat_size, blocklen, disp, &ompi_mpi_double, + ompi_datatype_create_indexed( mat_size, blocklen, disp, &ompi_mpi_double.dt, &upper ); free( disp ); free( blocklen ); @@ -406,9 +407,9 @@ ompi_datatype_t* test_matrix_borders( unsigned int size, unsigned int width ) disp[1] = (size - width) * sizeof(double); blocklen[1] = width; - ompi_ddt_create_indexed( 2, blocklen, disp, &ompi_mpi_double, + ompi_datatype_create_indexed( 2, blocklen, disp, &ompi_mpi_double.dt, &pdt_line ); - ompi_ddt_create_contiguous( size, pdt_line, &pdt ); + ompi_datatype_create_contiguous( size, pdt_line, &pdt ); OBJ_RELEASE( pdt_line ); /*assert( pdt_line == NULL );*/ return pdt; } @@ -418,24 +419,24 @@ ompi_datatype_t* test_contiguous( void ) ompi_datatype_t *pdt, *pdt1, *pdt2; printf( "test contiguous (alignement)\n" ); - ompi_ddt_create_contiguous(0, &ompi_mpi_datatype_null, &pdt1); - ompi_ddt_add( pdt1, &ompi_mpi_double, 1, 0, -1 ); + ompi_datatype_create_contiguous(0, &ompi_mpi_datatype_null.dt, &pdt1); + ompi_datatype_add( pdt1, &ompi_mpi_double.dt, 1, 0, -1 ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt1 ); + ompi_datatype_dump( pdt1 ); } - ompi_ddt_add( pdt1, &ompi_mpi_char, 1, 8, -1 ); + ompi_datatype_add( pdt1, &ompi_mpi_char.dt, 1, 8, -1 ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt1 ); + ompi_datatype_dump( pdt1 ); } - ompi_ddt_create_contiguous( 4, pdt1, &pdt2 ); + ompi_datatype_create_contiguous( 4, pdt1, &pdt2 ); OBJ_RELEASE( pdt1 ); /*assert( pdt1 == NULL );*/ if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt2 ); + ompi_datatype_dump( pdt2 ); } - ompi_ddt_create_contiguous( 2, pdt2, &pdt ); + ompi_datatype_create_contiguous( 2, pdt2, &pdt ); OBJ_RELEASE( pdt2 ); /*assert( pdt2 == NULL );*/ if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } return pdt; } @@ -451,15 +452,15 @@ ompi_datatype_t* test_struct_char_double( void ) int lengths[] = {1, 1}; MPI_Aint displ[] = {0, 0}; ompi_datatype_t *pdt; - ompi_datatype_t* types[] = { &ompi_mpi_char, &ompi_mpi_double }; + ompi_datatype_t* types[] = { &ompi_mpi_char.dt, &ompi_mpi_double.dt}; displ[0] = (char*)&(data.c) - (char*)&(data); displ[1] = (char*)&(data.d) - (char*)&(data); - ompi_ddt_create_struct( 2, lengths, displ, types, &pdt ); - ompi_ddt_commit( &pdt ); + ompi_datatype_create_struct( 2, lengths, displ, types, &pdt ); + ompi_datatype_commit( &pdt ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } return pdt; } @@ -468,10 +469,10 @@ ompi_datatype_t* test_create_twice_two_doubles( void ) { ompi_datatype_t* pdt; - ompi_ddt_create_vector( 2, 2, 5, &ompi_mpi_double, &pdt ); - ompi_ddt_commit( &pdt ); + ompi_datatype_create_vector( 2, 2, 5, &ompi_mpi_double.dt, &pdt ); + ompi_datatype_commit( &pdt ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } return pdt; } @@ -508,10 +509,10 @@ ompi_datatype_t* test_create_blacs_type( void ) { ompi_datatype_t *pdt; - ompi_ddt_create_indexed( 18, blacs_length, blacs_indices, &ompi_mpi_int, &pdt ); - ompi_ddt_commit( &pdt ); + ompi_datatype_create_indexed( 18, blacs_length, blacs_indices, &ompi_mpi_int.dt, &pdt ); + ompi_datatype_commit( &pdt ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } return pdt; } @@ -520,10 +521,10 @@ ompi_datatype_t* test_create_blacs_type1( ompi_datatype_t* base_type ) { ompi_datatype_t *pdt; - ompi_ddt_create_vector( 7, 1, 3, base_type, &pdt ); - ompi_ddt_commit( &pdt ); + ompi_datatype_create_vector( 7, 1, 3, base_type, &pdt ); + ompi_datatype_commit( &pdt ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } return pdt; } @@ -532,37 +533,37 @@ ompi_datatype_t* test_create_blacs_type2( ompi_datatype_t* base_type ) { ompi_datatype_t *pdt; - ompi_ddt_create_vector( 7, 1, 2, base_type, &pdt ); - ompi_ddt_commit( &pdt ); + ompi_datatype_create_vector( 7, 1, 2, base_type, &pdt ); + ompi_datatype_commit( &pdt ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } return pdt; } ompi_datatype_t* test_struct( void ) { - ompi_datatype_t* types[] = { &ompi_mpi_float /* ompi_ddt_basicDatatypes[DT_FLOAT] */, + ompi_datatype_t* types[] = { &ompi_mpi_float.dt /* ompi_datatype_basicDatatypes[DT_FLOAT] */, NULL, - &ompi_mpi_char /* ompi_ddt_basicDatatypes[DT_CHAR] */ }; + &ompi_mpi_char.dt /* ompi_datatype_basicDatatypes[DT_CHAR] */ }; int lengths[] = { 2, 1, 3 }; MPI_Aint disp[] = { 0, 16, 26 }; ompi_datatype_t* pdt, *pdt1; printf( "test struct\n" ); - ompi_ddt_create_contiguous(0, &ompi_mpi_datatype_null, &pdt1); - ompi_ddt_add( pdt1, &ompi_mpi_double, 1, 0, -1 ); - ompi_ddt_add( pdt1, &ompi_mpi_char, 1, 8, -1 ); + ompi_datatype_create_contiguous(0, &ompi_mpi_datatype_null.dt, &pdt1); + ompi_datatype_add( pdt1, &ompi_mpi_double.dt, 1, 0, -1 ); + ompi_datatype_add( pdt1, &ompi_mpi_char.dt, 1, 8, -1 ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt1 ); + ompi_datatype_dump( pdt1 ); } types[1] = pdt1; - ompi_ddt_create_struct( 3, lengths, disp, types, &pdt ); + ompi_datatype_create_struct( 3, lengths, disp, types, &pdt ); OBJ_RELEASE( pdt1 ); /*assert( pdt1 == NULL );*/ if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } return pdt; } @@ -586,51 +587,51 @@ ompi_datatype_t* create_strange_dt( void ) { sdata_intern v[2]; MPI_Aint displ[3]; - ompi_datatype_t* types[3] = { &ompi_mpi_int }; + ompi_datatype_t* types[3] = { &ompi_mpi_int.dt }; sstrange t[2]; int pBlock[3] = {1, 10, 1}, dispi[3]; ompi_datatype_t *pdt, *pdt1, *pdt2, *pdtTemp; dispi[0] = (int)((char*)&(v[0].i1) - (char*)&(v[0])); /* 0 */ dispi[1] = (int)(((char*)(&(v[0].i2)) - (char*)&(v[0])) / sizeof(int)); /* 2 */ - ompi_ddt_create_indexed_block( 2, 1, dispi, &ompi_mpi_int, &pdtTemp ); + ompi_datatype_create_indexed_block( 2, 1, dispi, &ompi_mpi_int.dt, &pdtTemp ); #ifdef USE_RESIZED /* optional */ displ[0] = 0; displ[1] = (char*)&(v[1]) - (char*)&(v[0]); - ompi_ddt_create_resized( pdtTemp, displ[0], displ[1], &pdt1 ); + ompi_datatype_create_resized( pdtTemp, displ[0], displ[1], &pdt1 ); OBJ_RELEASE( pdtTemp ); assert( pdtTemp == NULL ); #else pdt1 = pdtTemp; #endif /* USE_RESIZED */ types[1] = pdt1; - types[2] = &ompi_mpi_int; + types[2] = &ompi_mpi_int.dt; displ[0] = 0; displ[1] = (long)((char*)&(t[0].v[0]) - (char*)&(t[0])); displ[2] = (long)((char*)&(t[0].last) - (char*)&(t[0])); - ompi_ddt_create_struct( 3, pBlock, displ, types, &pdtTemp ); + ompi_datatype_create_struct( 3, pBlock, displ, types, &pdtTemp ); #ifdef USE_RESIZED /* optional */ displ[1] = (char*)&(t[1]) - (char*)&(t[0]); - ompi_ddt_create_resized( pdtTemp, displ[0], displ[1], &pdt2 ); + ompi_datatype_create_resized( pdtTemp, displ[0], displ[1], &pdt2 ); OBJ_RELEASE( pdtTemp ); assert( pdtTemp == NULL ); #else pdt2 = pdtTemp; #endif /* USE_RESIZED */ - ompi_ddt_create_contiguous( SSTRANGE_CNT, pdt2, &pdt ); + ompi_datatype_create_contiguous( SSTRANGE_CNT, pdt2, &pdt ); OBJ_RELEASE( pdt1 ); OBJ_RELEASE( pdt2 ); printf( "\nStrange datatype BEFORE COMMIT\n" ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } - ompi_ddt_commit( &pdt ); + ompi_datatype_commit( &pdt ); printf( "\nStrange datatype AFTER COMMIT\n" ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } return pdt; } @@ -639,8 +640,8 @@ ompi_datatype_t* create_contiguous_type( const ompi_datatype_t* data, int count { ompi_datatype_t* contiguous; - ompi_ddt_create_contiguous( count, data, &contiguous ); - ompi_ddt_commit( &contiguous ); + ompi_datatype_create_contiguous( count, data, &contiguous ); + ompi_datatype_commit( &contiguous ); return contiguous; } @@ -648,8 +649,8 @@ ompi_datatype_t* create_vector_type( const ompi_datatype_t* data, int count, int { ompi_datatype_t* vector; - ompi_ddt_create_vector( count, length, stride, data, &vector ); - ompi_ddt_commit( &vector ); + ompi_datatype_create_vector( count, length, stride, data, &vector ); + ompi_datatype_commit( &vector ); return vector; } diff --git a/test/datatype/ddt_lib.h b/test/datatype/ddt_lib.h index 33f3b27037..b7c698218f 100644 --- a/test/datatype/ddt_lib.h +++ b/test/datatype/ddt_lib.h @@ -19,7 +19,7 @@ */ #include "ompi_config.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include #include #ifdef HAVE_SYS_TIME_H diff --git a/test/datatype/ddt_pack.c b/test/datatype/ddt_pack.c index cbb8c7dcf1..1cb02e0114 100644 --- a/test/datatype/ddt_pack.c +++ b/test/datatype/ddt_pack.c @@ -19,8 +19,8 @@ */ #include "ompi_config.h" -#include "ompi/datatype/datatype.h" -#include "ompi/datatype/convertor.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/datatype/opal_convertor.h" #include "ompi/proc/proc.h" #ifdef HAVE_STDLIB_H @@ -48,12 +48,12 @@ main(int argc, char* argv[]) /* Basic test... */ printf("---> Basic test with MPI_INT\n"); - packed_ddt_len = ompi_ddt_pack_description_length(MPI_INT); + packed_ddt_len = ompi_datatype_pack_description_length(MPI_INT); ptr = payload = malloc(packed_ddt_len); - ret = ompi_ddt_get_pack_description(MPI_INT, &packed_ddt); + ret = ompi_datatype_get_pack_description(MPI_INT, &packed_ddt); if (ret != 0) goto cleanup; memcpy(payload, packed_ddt, packed_ddt_len); - unpacked_dt = ompi_ddt_create_from_packed_description(&payload, + unpacked_dt = ompi_datatype_create_from_packed_description(&payload, ompi_proc_local()); free(ptr); if (unpacked_dt == MPI_INT) { @@ -78,12 +78,12 @@ main(int argc, char* argv[]) ret = MPI_Type_commit(&newType); if (ret != 0) goto cleanup; - packed_ddt_len = ompi_ddt_pack_description_length(newType); + packed_ddt_len = ompi_datatype_pack_description_length(newType); ptr = payload = malloc(packed_ddt_len); - ret = ompi_ddt_get_pack_description(newType, &packed_ddt); + ret = ompi_datatype_get_pack_description(newType, &packed_ddt); if (ret != 0) goto cleanup; memcpy(payload, packed_ddt, packed_ddt_len); - unpacked_dt = ompi_ddt_create_from_packed_description(&payload, + unpacked_dt = ompi_datatype_create_from_packed_description(&payload, ompi_proc_local()); free(ptr); if (unpacked_dt != NULL) { @@ -107,12 +107,12 @@ main(int argc, char* argv[]) ret = MPI_Type_commit(&struct_type); if (ret != 0) goto cleanup; - packed_ddt_len = ompi_ddt_pack_description_length(struct_type); + packed_ddt_len = ompi_datatype_pack_description_length(struct_type); ptr = payload = malloc(packed_ddt_len); - ret = ompi_ddt_get_pack_description(struct_type, &packed_ddt); + ret = ompi_datatype_get_pack_description(struct_type, &packed_ddt); if (ret != 0) goto cleanup; memcpy(payload, packed_ddt, packed_ddt_len); - unpacked_dt = ompi_ddt_create_from_packed_description(&payload, + unpacked_dt = ompi_datatype_create_from_packed_description(&payload, ompi_proc_local()); free(ptr); if (unpacked_dt != NULL) { diff --git a/test/datatype/ddt_raw.c b/test/datatype/ddt_raw.c index 077893ea50..eea9004de0 100644 --- a/test/datatype/ddt_raw.c +++ b/test/datatype/ddt_raw.c @@ -20,7 +20,7 @@ #include "ompi_config.h" #include "ddt_lib.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include #include #ifdef HAVE_SYS_TIME_H @@ -44,9 +44,9 @@ uint32_t remote_arch; static int test_upper( unsigned int length ) { ompi_datatype_t *pdt; - ompi_convertor_t * pConv; + opal_convertor_t * pConv; int rc; - unsigned int i, j, iov_count, split_chunk, total_length; + unsigned int i, iov_count, split_chunk, total_length; size_t max_data; struct iovec iov[5]; TIMER_DATA_TYPE start, end; @@ -58,8 +58,8 @@ static int test_upper( unsigned int length ) total_length = length * (length + 1) * ( sizeof(double) / 2); - pConv = ompi_convertor_create( remote_arch, 0 ); - if( OMPI_SUCCESS != ompi_convertor_prepare_for_send( pConv, pdt, 1, NULL ) ) { + pConv = opal_convertor_create( remote_arch, 0 ); + if( OMPI_SUCCESS != opal_convertor_prepare_for_send( pConv, &(pdt->super), 1, NULL ) ) { printf( "Cannot attach the datatype to a convertor\n" ); return OMPI_ERROR; } @@ -70,7 +70,7 @@ static int test_upper( unsigned int length ) for( i = total_length; i > 0; ) { iov_count = 5; max_data = 0; - ompi_convertor_raw( pConv, iov, &iov_count, &max_data ); + opal_convertor_raw( pConv, iov, &iov_count, &max_data ); i -= max_data; } GET_TIME( end ); @@ -78,7 +78,7 @@ static int test_upper( unsigned int length ) printf( "complete raw in %ld microsec\n", total_time ); /* test the automatic destruction pf the data */ - ompi_ddt_destroy( &pdt ); assert( pdt == NULL ); + ompi_datatype_destroy( &pdt ); assert( pdt == NULL ); OBJ_RELEASE( pConv ); return rc; @@ -96,7 +96,7 @@ static int test_upper( unsigned int length ) static int local_copy_ddt_raw( ompi_datatype_t* pdt, int count, int iov_num ) { struct iovec* iov; - ompi_convertor_t* convertor; + opal_convertor_t* convertor; TIMER_DATA_TYPE start, end; long total_time; int i; @@ -105,15 +105,15 @@ static int local_copy_ddt_raw( ompi_datatype_t* pdt, int count, int iov_num ) iov = (struct iovec*)malloc(iov_num * sizeof(struct iovec)); - convertor = ompi_convertor_create( remote_arch, 0 ); - if( OMPI_SUCCESS != ompi_convertor_prepare_for_send( convertor, pdt, count, NULL ) ) { + convertor = opal_convertor_create( remote_arch, 0 ); + if( OMPI_SUCCESS != opal_convertor_prepare_for_send( convertor, &(pdt->super), count, NULL ) ) { printf( "Cannot attach the datatype to a convertor\n" ); return OMPI_ERROR; } - remaining_length = count * pdt->size; + remaining_length = count * pdt->super.size; GET_TIME( start ); - while( 0 == ompi_convertor_raw(convertor, iov, &iov_count, &max_data) ) { + while( 0 == opal_convertor_raw(convertor, iov, &iov_count, &max_data) ) { #if 0 printf( "New raw extraction (iov_count = %d, max_data = %zu)\n", iov_count, max_data ); @@ -148,14 +148,14 @@ int main( int argc, char* argv[] ) ompi_datatype_t *pdt, *pdt1, *pdt2, *pdt3; int rc, length = 500, iov_num = 5; - ompi_ddt_init(); + ompi_datatype_init(); /** * By default simulate homogeneous architectures. */ - remote_arch = ompi_mpi_local_arch; + remote_arch = opal_local_arch; printf( "\n\n#\n * TEST INVERSED VECTOR\n #\n\n" ); - pdt = create_inversed_vector( &ompi_mpi_int, 10 ); + pdt = create_inversed_vector( &ompi_mpi_int.dt, 10 ); if( outputFlags & CHECK_PACK_UNPACK ) { local_copy_ddt_raw(pdt, 100, iov_num); } @@ -188,7 +188,7 @@ int main( int argc, char* argv[] ) printf( "\n\n#\n * TEST MATRIX BORDERS\n #\n\n" ); pdt = test_matrix_borders( length, 100 ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } OBJ_RELEASE( pdt ); assert( pdt == NULL ); @@ -199,30 +199,30 @@ int main( int argc, char* argv[] ) pdt = test_struct(); OBJ_RELEASE( pdt ); assert( pdt == NULL ); - ompi_ddt_create_contiguous(0, &ompi_mpi_datatype_null, &pdt1); - ompi_ddt_create_contiguous(0, &ompi_mpi_datatype_null, &pdt2); - ompi_ddt_create_contiguous(0, &ompi_mpi_datatype_null, &pdt3); + ompi_datatype_create_contiguous(0, &ompi_mpi_datatype_null.dt, &pdt1); + ompi_datatype_create_contiguous(0, &ompi_mpi_datatype_null.dt, &pdt2); + ompi_datatype_create_contiguous(0, &ompi_mpi_datatype_null.dt, &pdt3); - ompi_ddt_add( pdt3, &ompi_mpi_int, 10, 0, -1 ); - ompi_ddt_add( pdt3, &ompi_mpi_float, 5, 10 * sizeof(int), -1 ); + ompi_datatype_add( pdt3, &ompi_mpi_int.dt, 10, 0, -1 ); + ompi_datatype_add( pdt3, &ompi_mpi_float.dt, 5, 10 * sizeof(int), -1 ); - ompi_ddt_add( pdt2, &ompi_mpi_float, 1, 0, -1 ); - ompi_ddt_add( pdt2, pdt3, 3, sizeof(int) * 1, -1 ); + ompi_datatype_add( pdt2, &ompi_mpi_float.dt, 1, 0, -1 ); + ompi_datatype_add( pdt2, pdt3, 3, sizeof(int) * 1, -1 ); - ompi_ddt_add( pdt1, &ompi_mpi_long_long_int, 5, 0, -1 ); - ompi_ddt_add( pdt1, &ompi_mpi_long_double, 2, sizeof(long long) * 5, -1 ); + ompi_datatype_add( pdt1, &ompi_mpi_long_long_int.dt, 5, 0, -1 ); + ompi_datatype_add( pdt1, &ompi_mpi_long_double.dt, 2, sizeof(long long) * 5, -1 ); printf( ">>--------------------------------------------<<\n" ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt1 ); + ompi_datatype_dump( pdt1 ); } printf( ">>--------------------------------------------<<\n" ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt2 ); + ompi_datatype_dump( pdt2 ); } printf( ">>--------------------------------------------<<\n" ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt3 ); + ompi_datatype_dump( pdt3 ); } OBJ_RELEASE( pdt1 ); assert( pdt1 == NULL ); @@ -269,7 +269,7 @@ int main( int argc, char* argv[] ) printf( "Vector data-type (450 times 10 double stride 11)\n" ); pdt = create_vector_type( MPI_DOUBLE, 450, 10, 11 ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } if( outputFlags & CHECK_PACK_UNPACK ) { local_copy_ddt_raw(pdt, 1, iov_num); @@ -297,7 +297,7 @@ int main( int argc, char* argv[] ) pdt = test_create_blacs_type(); if( outputFlags & CHECK_PACK_UNPACK ) { if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } local_copy_ddt_raw(pdt, 4500, iov_num); } @@ -305,7 +305,7 @@ int main( int argc, char* argv[] ) OBJ_RELEASE( pdt ); assert( pdt == NULL ); printf( ">>--------------------------------------------<<\n" ); - pdt1 = test_create_blacs_type1( &ompi_mpi_int ); + pdt1 = test_create_blacs_type1( &ompi_mpi_int.dt ); if( outputFlags & CHECK_PACK_UNPACK ) { local_copy_ddt_raw( pdt1, 1, iov_num ); } @@ -313,7 +313,7 @@ int main( int argc, char* argv[] ) OBJ_RELEASE( pdt1 ); assert( pdt1 == NULL ); /* clean-ups all data allocations */ - ompi_ddt_finalize(); + ompi_datatype_finalize(); return OMPI_SUCCESS; } diff --git a/test/datatype/ddt_test.c b/test/datatype/ddt_test.c index aeb58655ae..ebbb2f9615 100644 --- a/test/datatype/ddt_test.c +++ b/test/datatype/ddt_test.c @@ -20,7 +20,7 @@ #include "ompi_config.h" #include "ddt_lib.h" -#include "ompi/datatype/convertor.h" +#include "opal/datatype/opal_convertor.h" #include #include #ifdef HAVE_SYS_TIME_H @@ -46,7 +46,7 @@ static int test_upper( unsigned int length ) { double *mat1, *mat2, *inbuf; ompi_datatype_t *pdt; - ompi_convertor_t * pConv; + opal_convertor_t * pConv; char *ptr; int rc; unsigned int i, j, iov_count, split_chunk, total_length; @@ -75,8 +75,8 @@ static int test_upper( unsigned int length ) } } inbuf = (double*)ptr; - pConv = ompi_convertor_create( remote_arch, 0 ); - if( OMPI_SUCCESS != ompi_convertor_prepare_for_recv( pConv, pdt, 1, mat2 ) ) { + pConv = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( pConv, &(pdt->super), 1, mat2 ) ) { printf( "Cannot attach the datatype to a convertor\n" ); return OMPI_ERROR; } @@ -92,7 +92,7 @@ static int test_upper( unsigned int length ) a.iov_len = split_chunk; iov_count = 1; max_data = split_chunk; - ompi_convertor_unpack( pConv, &a, &iov_count, &max_data ); + opal_convertor_unpack( pConv, &a, &iov_count, &max_data ); ptr += max_data; i -= max_data; if( mat2[0] != inbuf[0] ) assert(0); @@ -106,7 +106,7 @@ static int test_upper( unsigned int length ) free( mat2 ); /* test the automatic destruction pf the data */ - ompi_ddt_destroy( &pdt ); assert( pdt == NULL ); + ompi_datatype_destroy( &pdt ); assert( pdt == NULL ); OBJ_RELEASE( pConv ); return rc; @@ -128,7 +128,7 @@ static int local_copy_ddt_count( ompi_datatype_t* pdt, int count ) TIMER_DATA_TYPE start, end; long total_time; - ompi_ddt_type_extent( pdt, &extent ); + ompi_datatype_type_extent( pdt, &extent ); pdst = malloc( extent * count ); psrc = malloc( extent * count ); @@ -143,7 +143,7 @@ static int local_copy_ddt_count( ompi_datatype_t* pdt, int count ) cache_trash(); /* make sure the cache is useless */ GET_TIME( start ); - if( OMPI_SUCCESS != ompi_ddt_copy_content_same_ddt( pdt, count, pdst, psrc ) ) { + if( OMPI_SUCCESS != ompi_datatype_copy_content_same_ddt( pdt, count, pdst, psrc ) ) { printf( "Unable to copy the datatype in the function local_copy_ddt_count." " Is the datatype committed ?\n" ); } @@ -163,7 +163,7 @@ local_copy_with_convertor_2datatypes( ompi_datatype_t* send_type, int send_count { MPI_Aint send_extent, recv_extent; void *pdst = NULL, *psrc = NULL, *ptemp = NULL; - ompi_convertor_t *send_convertor = NULL, *recv_convertor = NULL; + opal_convertor_t *send_convertor = NULL, *recv_convertor = NULL; struct iovec iov; uint32_t iov_count; size_t max_data; @@ -171,8 +171,8 @@ local_copy_with_convertor_2datatypes( ompi_datatype_t* send_type, int send_count TIMER_DATA_TYPE start, end, unpack_start, unpack_end; long total_time, unpack_time = 0; - ompi_ddt_type_extent( send_type, &send_extent ); - ompi_ddt_type_extent( recv_type, &recv_extent ); + ompi_datatype_type_extent( send_type, &send_extent ); + ompi_datatype_type_extent( recv_type, &recv_extent ); pdst = malloc( recv_extent * recv_count ); psrc = malloc( send_extent * send_count ); @@ -186,13 +186,13 @@ local_copy_with_convertor_2datatypes( ompi_datatype_t* send_type, int send_count } memset( pdst, 0, recv_count * recv_extent ); - send_convertor = ompi_convertor_create( remote_arch, 0 ); - if( OMPI_SUCCESS != ompi_convertor_prepare_for_send( send_convertor, send_type, send_count, psrc ) ) { + send_convertor = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_send( send_convertor, &(send_type->super), send_count, psrc ) ) { printf( "Unable to create the send convertor. Is the datatype committed ?\n" ); goto clean_and_return; } - recv_convertor = ompi_convertor_create( remote_arch, 0 ); - if( OMPI_SUCCESS != ompi_convertor_prepare_for_recv( recv_convertor, recv_type, recv_count, pdst ) ) { + recv_convertor = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( recv_convertor, &(recv_type->super), recv_count, pdst ) ) { printf( "Unable to create the recv convertor. Is the datatype committed ?\n" ); goto clean_and_return; } @@ -214,12 +214,12 @@ local_copy_with_convertor_2datatypes( ompi_datatype_t* send_type, int send_count iov.iov_len = chunk; if( done1 == 0 ) { - done1 = ompi_convertor_pack( send_convertor, &iov, &iov_count, &max_data ); + done1 = opal_convertor_pack( send_convertor, &iov, &iov_count, &max_data ); } if( done2 == 0 ) { GET_TIME( unpack_start ); - done2 = ompi_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data ); + done2 = opal_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data ); GET_TIME( unpack_end ); unpack_time += ELAPSED_TIME( unpack_start, unpack_end ); } @@ -248,7 +248,7 @@ static int local_copy_with_convertor( ompi_datatype_t* pdt, int count, int chunk { MPI_Aint extent; void *pdst = NULL, *psrc = NULL, *ptemp = NULL; - ompi_convertor_t *send_convertor = NULL, *recv_convertor = NULL; + opal_convertor_t *send_convertor = NULL, *recv_convertor = NULL; struct iovec iov; uint32_t iov_count; size_t max_data; @@ -256,7 +256,7 @@ static int local_copy_with_convertor( ompi_datatype_t* pdt, int count, int chunk TIMER_DATA_TYPE start, end, unpack_start, unpack_end; long total_time, unpack_time = 0; - ompi_ddt_type_extent( pdt, &extent ); + ompi_datatype_type_extent( pdt, &extent ); pdst = malloc( extent * count ); psrc = malloc( extent * count ); @@ -268,14 +268,14 @@ static int local_copy_with_convertor( ompi_datatype_t* pdt, int count, int chunk } memset( pdst, 0, count * extent ); - send_convertor = ompi_convertor_create( remote_arch, 0 ); - if( OMPI_SUCCESS != ompi_convertor_prepare_for_send( send_convertor, pdt, count, psrc ) ) { + send_convertor = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_send( send_convertor, &(pdt->super), count, psrc ) ) { printf( "Unable to create the send convertor. Is the datatype committed ?\n" ); goto clean_and_return; } - recv_convertor = ompi_convertor_create( remote_arch, 0 ); - if( OMPI_SUCCESS != ompi_convertor_prepare_for_recv( recv_convertor, pdt, count, pdst ) ) { + recv_convertor = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( recv_convertor, &(pdt->super), count, pdst ) ) { printf( "Unable to create the recv convertor. Is the datatype committed ?\n" ); goto clean_and_return; } @@ -297,12 +297,12 @@ static int local_copy_with_convertor( ompi_datatype_t* pdt, int count, int chunk iov.iov_len = chunk; if( done1 == 0 ) { - done1 = ompi_convertor_pack( send_convertor, &iov, &iov_count, &max_data ); + done1 = opal_convertor_pack( send_convertor, &iov, &iov_count, &max_data ); } if( done2 == 0 ) { GET_TIME( unpack_start ); - done2 = ompi_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data ); + done2 = opal_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data ); GET_TIME( unpack_end ); unpack_time += ELAPSED_TIME( unpack_start, unpack_end ); } @@ -336,14 +336,14 @@ int main( int argc, char* argv[] ) ompi_datatype_t *pdt, *pdt1, *pdt2, *pdt3; int rc, length = 500; - ompi_ddt_init(); + ompi_datatype_init(); /** * By default simulate homogeneous architectures. */ - remote_arch = ompi_mpi_local_arch; + remote_arch = opal_local_arch; printf( "\n\n#\n * TEST INVERSED VECTOR\n #\n\n" ); - pdt = create_inversed_vector( &ompi_mpi_int, 10 ); + pdt = create_inversed_vector( &ompi_mpi_int.dt, 10 ); if( outputFlags & CHECK_PACK_UNPACK ) { local_copy_ddt_count(pdt, 100); local_copy_with_convertor(pdt, 100, 956); @@ -379,7 +379,7 @@ int main( int argc, char* argv[] ) printf( "\n\n#\n * TEST MATRIX BORDERS\n #\n\n" ); pdt = test_matrix_borders( length, 100 ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); } OBJ_RELEASE( pdt ); assert( pdt == NULL ); @@ -390,30 +390,30 @@ int main( int argc, char* argv[] ) pdt = test_struct(); OBJ_RELEASE( pdt ); assert( pdt == NULL ); - ompi_ddt_create_contiguous(0, &ompi_mpi_datatype_null, &pdt1); - ompi_ddt_create_contiguous(0, &ompi_mpi_datatype_null, &pdt2); - ompi_ddt_create_contiguous(0, &ompi_mpi_datatype_null, &pdt3); + ompi_datatype_create_contiguous(0, &ompi_mpi_datatype_null.dt, &pdt1); + ompi_datatype_create_contiguous(0, &ompi_mpi_datatype_null.dt, &pdt2); + ompi_datatype_create_contiguous(0, &ompi_mpi_datatype_null.dt, &pdt3); - ompi_ddt_add( pdt3, &ompi_mpi_int, 10, 0, -1 ); - ompi_ddt_add( pdt3, &ompi_mpi_float, 5, 10 * sizeof(int), -1 ); + ompi_datatype_add( pdt3, &ompi_mpi_int.dt, 10, 0, -1 ); + ompi_datatype_add( pdt3, &ompi_mpi_float.dt, 5, 10 * sizeof(int), -1 ); - ompi_ddt_add( pdt2, &ompi_mpi_float, 1, 0, -1 ); - ompi_ddt_add( pdt2, pdt3, 3, sizeof(int) * 1, -1 ); + ompi_datatype_add( pdt2, &ompi_mpi_float.dt, 1, 0, -1 ); + ompi_datatype_add( pdt2, pdt3, 3, sizeof(int) * 1, -1 ); - ompi_ddt_add( pdt1, &ompi_mpi_long_long_int, 5, 0, -1 ); - ompi_ddt_add( pdt1, &ompi_mpi_long_double, 2, sizeof(long long) * 5, -1 ); + ompi_datatype_add( pdt1, &ompi_mpi_long_long_int.dt, 5, 0, -1 ); + ompi_datatype_add( pdt1, &ompi_mpi_long_double.dt, 2, sizeof(long long) * 5, -1 ); printf( ">>--------------------------------------------<<\n" ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt1 ); + ompi_datatype_dump( pdt1 ); } printf( ">>--------------------------------------------<<\n" ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt2 ); + ompi_datatype_dump( pdt2 ); } printf( ">>--------------------------------------------<<\n" ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_ddt_dump( pdt3 ); + ompi_datatype_dump( pdt3 ); } OBJ_RELEASE( pdt1 ); assert( pdt1 == NULL ); @@ -473,7 +473,7 @@ int main( int argc, char* argv[] ) printf( ">>--------------------------------------------<<\n" ); printf( "Vector data-type (450 times 10 double stride 11)\n" ); pdt = create_vector_type( MPI_DOUBLE, 450, 10, 11 ); - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); if( outputFlags & CHECK_PACK_UNPACK ) { local_copy_ddt_count(pdt, 1); local_copy_with_convertor( pdt, 1, 12 ); @@ -511,7 +511,7 @@ int main( int argc, char* argv[] ) printf( ">>--------------------------------------------<<\n" ); pdt = test_create_blacs_type(); if( outputFlags & CHECK_PACK_UNPACK ) { - ompi_ddt_dump( pdt ); + ompi_datatype_dump( pdt ); local_copy_ddt_count(pdt, 4500); local_copy_with_convertor( pdt, 4500, 956 ); local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 956 ); @@ -524,8 +524,8 @@ int main( int argc, char* argv[] ) OBJ_RELEASE( pdt ); assert( pdt == NULL ); printf( ">>--------------------------------------------<<\n" ); - pdt1 = test_create_blacs_type1( &ompi_mpi_int ); - pdt2 = test_create_blacs_type2( &ompi_mpi_int ); + pdt1 = test_create_blacs_type1( &ompi_mpi_int.dt ); + pdt2 = test_create_blacs_type2( &ompi_mpi_int.dt ); if( outputFlags & CHECK_PACK_UNPACK ) { local_copy_with_convertor_2datatypes( pdt1, 1, pdt2, 1, 100 ); } @@ -534,7 +534,7 @@ int main( int argc, char* argv[] ) OBJ_RELEASE( pdt2 ); assert( pdt2 == NULL ); /* clean-ups all data allocations */ - ompi_ddt_finalize(); + ompi_datatype_finalize(); return OMPI_SUCCESS; } diff --git a/test/datatype/opal_datatype_test.c b/test/datatype/opal_datatype_test.c new file mode 100644 index 0000000000..741facfe0d --- /dev/null +++ b/test/datatype/opal_datatype_test.c @@ -0,0 +1,546 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2006 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2006 Sun Microsystems Inc. All rights reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" +#include "opal_ddt_lib.h" +#include "opal/datatype/opal_datatype.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "opal/datatype/opal_convertor.h" +#include +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include +#include + +/* Compile with: +gcc -DHAVE_CONFIG_H -I. -I../../include -I../.. -I../../include -I../../../ompi-trunk/opal -I../../../ompi-trunk/orte -g opal_datatype_test.c -o opal_datatype_test +*/ + +#define TIMER_DATA_TYPE struct timeval +#define GET_TIME(TV) gettimeofday( &(TV), NULL ) +#define ELAPSED_TIME(TSTART, TEND) (((TEND).tv_sec - (TSTART).tv_sec) * 1000000 + ((TEND).tv_usec - (TSTART).tv_usec)) + +uint32_t remote_arch; + +static int test_upper( unsigned int length ) +{ + double *mat1, *mat2, *inbuf; + opal_datatype_t *pdt; + opal_convertor_t * pConv; + char *ptr; + int rc; + unsigned int i, j, iov_count, split_chunk, total_length; + size_t max_data; + struct iovec a; + TIMER_DATA_TYPE start, end; + long total_time; + + printf( "test upper matrix\n" ); + pdt = upper_matrix( length ); + opal_datatype_dump( pdt ); + + mat1 = malloc( length * length * sizeof(double) ); + init_random_upper_matrix( length, mat1 ); + mat2 = calloc( length * length, sizeof(double) ); + + total_length = length * (length + 1) * ( sizeof(double) / 2); + inbuf = (double*)malloc( total_length ); + ptr = (char*)inbuf; + /* copy upper matrix in the array simulating the input buffer */ + for( i = 0; i < length; i++ ) { + uint32_t pos = i * length + i; + for( j = i; j < length; j++, pos++ ) { + *inbuf = mat1[pos]; + inbuf++; + } + } + inbuf = (double*)ptr; + pConv = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( pConv, pdt, 1, mat2 ) ) { + printf( "Cannot attach the datatype to a convertor\n" ); + return OPAL_ERROR; + } + + GET_TIME( start ); + split_chunk = (length + 1) * sizeof(double); + /* split_chunk = (total_length + 1) * sizeof(double); */ + for( i = total_length; i > 0; ) { + if( i <= split_chunk ) { /* equal test just to be able to set a breakpoint */ + split_chunk = i; + } + a.iov_base = ptr; + a.iov_len = split_chunk; + iov_count = 1; + max_data = split_chunk; + opal_convertor_unpack( pConv, &a, &iov_count, &max_data ); + ptr += max_data; + i -= max_data; + if( mat2[0] != inbuf[0] ) assert(0); + } + GET_TIME( end ); + total_time = ELAPSED_TIME( start, end ); + printf( "complete unpacking in %ld microsec\n", total_time ); + free( inbuf ); + rc = check_diag_matrix( length, mat1, mat2 ); + free( mat1 ); + free( mat2 ); + + /* test the automatic destruction pf the data */ + opal_datatype_destroy( &pdt ); + assert( pdt == NULL ); + + OBJ_RELEASE( pConv ); + return rc; +} + + +/** + * Conversion function. They deal with data-types in 3 ways, always making local copies. + * In order to allow performance testings, there are 3 functions: + * - one copying directly from one memory location to another one using the + * data-type copy function. + * - one which use a 2 convertors created with the same data-type + * - and one using 2 convertors created from different data-types. + * + */ +static int local_copy_ddt_count( opal_datatype_t* pdt, int count ) +{ + OPAL_PTRDIFF_TYPE extent; + void *pdst, *psrc; + TIMER_DATA_TYPE start, end; + long total_time; + + opal_datatype_type_extent( pdt, &extent ); + + pdst = malloc( extent * count ); + psrc = malloc( extent * count ); + + { + int i; + for( i = 0; i < (count * extent); i++ ) + ((char*)psrc)[i] = i % 128 + 32; + } + memset( pdst, 0, count * extent ); + + cache_trash(); /* make sure the cache is useless */ + + GET_TIME( start ); + if( OPAL_SUCCESS != opal_datatype_copy_content_same_ddt( pdt, count, pdst, psrc ) ) { + printf( "Unable to copy the datatype in the function local_copy_ddt_count." + " Is the datatype committed ?\n" ); + } + GET_TIME( end ); + total_time = ELAPSED_TIME( start, end ); + printf( "direct local copy in %ld microsec\n", total_time ); + free( pdst ); + free( psrc ); + + return OPAL_SUCCESS; +} + +static int +local_copy_with_convertor_2datatypes( opal_datatype_t* send_type, int send_count, + opal_datatype_t* recv_type, int recv_count, + int chunk ) +{ + OPAL_PTRDIFF_TYPE send_extent, recv_extent; + void *pdst = NULL, *psrc = NULL, *ptemp = NULL; + opal_convertor_t *send_convertor = NULL, *recv_convertor = NULL; + struct iovec iov; + uint32_t iov_count; + size_t max_data; + int32_t length = 0, done1 = 0, done2 = 0; + TIMER_DATA_TYPE start, end, unpack_start, unpack_end; + long total_time, unpack_time = 0; + + opal_datatype_type_extent( send_type, &send_extent ); + opal_datatype_type_extent( recv_type, &recv_extent ); + + pdst = malloc( recv_extent * recv_count ); + psrc = malloc( send_extent * send_count ); + ptemp = malloc( chunk ); + + /* fill up the receiver with ZEROS */ + { + int i; + for( i = 0; i < (send_count * send_extent); i++ ) + ((char*)psrc)[i] = i % 128 + 32; + } + memset( pdst, 0, recv_count * recv_extent ); + + send_convertor = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_send( send_convertor, send_type, send_count, psrc ) ) { + printf( "Unable to create the send convertor. Is the datatype committed ?\n" ); + goto clean_and_return; + } + recv_convertor = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( recv_convertor, recv_type, recv_count, pdst ) ) { + printf( "Unable to create the recv convertor. Is the datatype committed ?\n" ); + goto clean_and_return; + } + + cache_trash(); /* make sure the cache is useless */ + + GET_TIME( start ); + while( (done1 & done2) != 1 ) { + /* They are supposed to finish in exactly the same time. */ + if( done1 | done2 ) { + printf( "WRONG !!! the send is %s but the receive is %s in local_copy_with_convertor_2datatypes\n", + (done1 ? "finish" : "not finish"), + (done2 ? "finish" : "not finish") ); + } + + max_data = chunk; + iov_count = 1; + iov.iov_base = ptemp; + iov.iov_len = chunk; + + if( done1 == 0 ) { + done1 = opal_convertor_pack( send_convertor, &iov, &iov_count, &max_data ); + } + + if( done2 == 0 ) { + GET_TIME( unpack_start ); + done2 = opal_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data ); + GET_TIME( unpack_end ); + unpack_time += ELAPSED_TIME( unpack_start, unpack_end ); + } + + length += max_data; + } + GET_TIME( end ); + total_time = ELAPSED_TIME( start, end ); + printf( "copying different data-types using convertors in %ld microsec\n", total_time ); + printf( "\t unpack in %ld microsec [pack in %ld microsec]\n", unpack_time, + total_time - unpack_time ); + clean_and_return: + if( send_convertor != NULL ) { + OBJ_RELEASE( send_convertor ); assert( send_convertor == NULL ); + } + if( recv_convertor != NULL ) { + OBJ_RELEASE( recv_convertor ); assert( recv_convertor == NULL ); + } + if( NULL != pdst ) free( pdst ); + if( NULL != psrc ) free( psrc ); + if( NULL != ptemp ) free( ptemp ); + return OPAL_SUCCESS; +} + + +static int local_copy_with_convertor( opal_datatype_t* pdt, int count, int chunk ) +{ + OPAL_PTRDIFF_TYPE extent; + void *pdst = NULL, *psrc = NULL, *ptemp = NULL; + opal_convertor_t *send_convertor = NULL, *recv_convertor = NULL; + struct iovec iov; + uint32_t iov_count; + size_t max_data; + int32_t length = 0, done1 = 0, done2 = 0; + TIMER_DATA_TYPE start, end, unpack_start, unpack_end; + long total_time, unpack_time = 0; + + opal_datatype_type_extent( pdt, &extent ); + + pdst = malloc( extent * count ); + psrc = malloc( extent * count ); + ptemp = malloc( chunk ); + + { + int i = 0; + for( ; i < (count * extent); ((char*)psrc)[i] = i % 128 + 32, i++ ); + } + memset( pdst, 0, count * extent ); + + send_convertor = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_send( send_convertor, pdt, count, psrc ) ) { + printf( "Unable to create the send convertor. Is the datatype committed ?\n" ); + goto clean_and_return; + } + + recv_convertor = opal_convertor_create( remote_arch, 0 ); + if( OPAL_SUCCESS != opal_convertor_prepare_for_recv( recv_convertor, pdt, count, pdst ) ) { + printf( "Unable to create the recv convertor. Is the datatype committed ?\n" ); + goto clean_and_return; + } + + cache_trash(); /* make sure the cache is useless */ + + GET_TIME( start ); + while( (done1 & done2) != 1 ) { + /* They are supposed to finish in exactly the same time. */ + if( done1 | done2 ) { + printf( "WRONG !!! the send is %s but the receive is %s in local_copy_with_convertor\n", + (done1 ? "finish" : "not finish"), + (done2 ? "finish" : "not finish") ); + } + + max_data = chunk; + iov_count = 1; + iov.iov_base = ptemp; + iov.iov_len = chunk; + + if( done1 == 0 ) { + done1 = opal_convertor_pack( send_convertor, &iov, &iov_count, &max_data ); + } + + if( done2 == 0 ) { + GET_TIME( unpack_start ); + done2 = opal_convertor_unpack( recv_convertor, &iov, &iov_count, &max_data ); + GET_TIME( unpack_end ); + unpack_time += ELAPSED_TIME( unpack_start, unpack_end ); + } + + length += max_data; + } + GET_TIME( end ); + total_time = ELAPSED_TIME( start, end ); + printf( "copying same data-type using convertors in %ld microsec\n", total_time ); + printf( "\t unpack in %ld microsec [pack in %ld microsec]\n", unpack_time, + total_time - unpack_time ); + clean_and_return: + if( NULL != send_convertor ) OBJ_RELEASE( send_convertor ); + if( NULL != recv_convertor ) OBJ_RELEASE( recv_convertor ); + + if( NULL != pdst ) free( pdst ); + if( NULL != psrc ) free( psrc ); + if( NULL != ptemp ) free( ptemp ); + return OPAL_SUCCESS; +} + +/** + * Main function. Call several tests and print-out the results. It try to stress the convertor + * using difficult data-type constructions as well as strange segment sizes for the conversion. + * Usually, it is able to detect most of the data-type and convertor problems. Any modifications + * on the data-type engine should first pass all the tests from this file, before going into other + * tests. + */ +int main( int argc, char* argv[] ) +{ + opal_datatype_t *pdt, *pdt1, *pdt2, *pdt3; + int rc, length = 500; + + opal_datatype_init(); + + /** + * By default simulate homogeneous architectures. + */ + remote_arch = opal_local_arch; + printf( "\n\n#\n * TEST CREATE CONTIGUOUS\n #\n\n" ); + pdt = create_contiguous_type( &opal_datatype_int1, 10 ); + if( outputFlags & CHECK_PACK_UNPACK ) { + local_copy_ddt_count(pdt, 100); + local_copy_with_convertor(pdt, 100, 956); + } + + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + printf( "\n\n#\n * TEST STRANGE DATATYPE\n #\n\n" ); + pdt = create_strange_dt(); + if( outputFlags & CHECK_PACK_UNPACK ) { + local_copy_ddt_count(pdt, 1); + local_copy_with_convertor(pdt, 1, 956); + } + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + + + printf( "\n\n#\n * TEST UPPER TRIANGULAR MATRIX (size 100)\n #\n\n" ); + pdt = upper_matrix(100); + if( outputFlags & CHECK_PACK_UNPACK ) { + local_copy_ddt_count(pdt, 1); + local_copy_with_convertor(pdt, 1, 48); + } + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + + mpich_typeub(); + mpich_typeub2(); + mpich_typeub3(); + + printf( "\n\n#\n * TEST UPPER MATRIX\n #\n\n" ); + rc = test_upper( length ); + if( rc == 0 ) + printf( "decode [PASSED]\n" ); + else + printf( "decode [NOT PASSED]\n" ); + + printf( "\n\n#\n * TEST MATRIX BORDERS\n #\n\n" ); + pdt = test_matrix_borders( length, 100 ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + + + printf( "\n\n#\n * TEST CONTIGUOUS\n #\n\n" ); + pdt = test_contiguous(); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + printf( "\n\n#\n * TEST STRUCT\n #\n\n" ); + pdt = test_struct(); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + + opal_datatype_create_contiguous(0, &opal_datatype_null, &pdt1); + opal_datatype_create_contiguous(0, &opal_datatype_null, &pdt2); + opal_datatype_create_contiguous(0, &opal_datatype_null, &pdt3); + + opal_datatype_add( pdt3, &opal_datatype_int4, 10, 0, -1 ); + opal_datatype_add( pdt3, &opal_datatype_float4, 5, 10 * sizeof(int), -1 ); + + opal_datatype_add( pdt2, &opal_datatype_float4, 1, 0, -1 ); + opal_datatype_add( pdt2, pdt3, 3, sizeof(int) * 1, -1 ); + + opal_datatype_add( pdt1, &opal_datatype_int8, 5, 0, -1 ); + opal_datatype_add( pdt1, &opal_datatype_float16, 2, sizeof(long long) * 5, -1 ); + + printf( ">>--------------------------------------------<<\n" ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt1 ); + } + printf( ">>--------------------------------------------<<\n" ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt2 ); + } + printf( ">>--------------------------------------------<<\n" ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt3 ); + } + + OBJ_RELEASE( pdt1 ); assert( pdt1 == NULL ); + OBJ_RELEASE( pdt2 ); assert( pdt2 == NULL ); + OBJ_RELEASE( pdt3 ); assert( pdt3 == NULL ); + + printf( ">>--------------------------------------------<<\n" ); + printf( " Contiguous data-type (opal_datatype_float8)\n" ); + pdt = &opal_datatype_float8; + if( outputFlags & CHECK_PACK_UNPACK ) { + local_copy_ddt_count(pdt, 4500); + local_copy_with_convertor( pdt, 4500, 12 ); + local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 12 ); + } + printf( ">>--------------------------------------------<<\n" ); + + printf( ">>--------------------------------------------<<\n" ); + if( outputFlags & CHECK_PACK_UNPACK ) { + printf( "Contiguous multiple data-type (4500*1)\n" ); + pdt = create_contiguous_type( &opal_datatype_float8, 4500 ); + local_copy_ddt_count(pdt, 1); + local_copy_with_convertor( pdt, 1, 12 ); + local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 12 ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + printf( "Contiguous multiple data-type (450*10)\n" ); + pdt = create_contiguous_type( &opal_datatype_float8, 450 ); + local_copy_ddt_count(pdt, 10); + local_copy_with_convertor( pdt, 10, 12 ); + local_copy_with_convertor_2datatypes( pdt, 10, pdt, 10, 12 ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + printf( "Contiguous multiple data-type (45*100)\n" ); + pdt = create_contiguous_type( &opal_datatype_float8, 45 ); + local_copy_ddt_count(pdt, 100); + local_copy_with_convertor( pdt, 100, 12 ); + local_copy_with_convertor_2datatypes( pdt, 100, pdt, 100, 12 ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + printf( "Contiguous multiple data-type (100*45)\n" ); + pdt = create_contiguous_type( &opal_datatype_float8, 100 ); + local_copy_ddt_count(pdt, 45); + local_copy_with_convertor( pdt, 45, 12 ); + local_copy_with_convertor_2datatypes( pdt, 45, pdt, 45, 12 ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + printf( "Contiguous multiple data-type (10*450)\n" ); + pdt = create_contiguous_type( &opal_datatype_float8, 10 ); + local_copy_ddt_count(pdt, 450); + local_copy_with_convertor( pdt, 450, 12 ); + local_copy_with_convertor_2datatypes( pdt, 450, pdt, 450, 12 ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + printf( "Contiguous multiple data-type (1*4500)\n" ); + pdt = create_contiguous_type( &opal_datatype_float8, 1 ); + local_copy_ddt_count(pdt, 4500); + local_copy_with_convertor( pdt, 4500, 12 ); + local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 12 ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + } + printf( ">>--------------------------------------------<<\n" ); + printf( ">>--------------------------------------------<<\n" ); + printf( "Vector data-type (450 times 10 double stride 11)\n" ); + pdt = create_vector_type( &opal_datatype_float8, 450, 10, 11 ); + opal_datatype_dump( pdt ); + if( outputFlags & CHECK_PACK_UNPACK ) { + local_copy_ddt_count(pdt, 1); + local_copy_with_convertor( pdt, 1, 12 ); + local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 12 ); + local_copy_with_convertor( pdt, 1, 82 ); + local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 82 ); + local_copy_with_convertor( pdt, 1, 6000 ); + local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 6000 ); + local_copy_with_convertor( pdt, 1, 36000 ); + local_copy_with_convertor_2datatypes( pdt, 1, pdt, 1, 36000 ); + } + printf( ">>--------------------------------------------<<\n" ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + + printf( ">>--------------------------------------------<<\n" ); + pdt = test_struct_char_double(); + if( outputFlags & CHECK_PACK_UNPACK ) { + local_copy_ddt_count(pdt, 4500); + local_copy_with_convertor( pdt, 4500, 12 ); + local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 12 ); + } + printf( ">>--------------------------------------------<<\n" ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + + printf( ">>--------------------------------------------<<\n" ); + pdt = test_create_twice_two_doubles(); + if( outputFlags & CHECK_PACK_UNPACK ) { + local_copy_ddt_count(pdt, 4500); + local_copy_with_convertor( pdt, 4500, 12 ); + local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 12 ); + } + printf( ">>--------------------------------------------<<\n" ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + + printf( ">>--------------------------------------------<<\n" ); + pdt = test_create_blacs_type(); + if( outputFlags & CHECK_PACK_UNPACK ) { + opal_datatype_dump( pdt ); + local_copy_ddt_count(pdt, 4500); + local_copy_with_convertor( pdt, 4500, 956 ); + local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 956 ); + local_copy_with_convertor( pdt, 4500, 16*1024 ); + local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 16*1024 ); + local_copy_with_convertor( pdt, 4500, 64*1024 ); + local_copy_with_convertor_2datatypes( pdt, 4500, pdt, 4500, 64*1024 ); + } + printf( ">>--------------------------------------------<<\n" ); + OBJ_RELEASE( pdt ); assert( pdt == NULL ); + + printf( ">>--------------------------------------------<<\n" ); + pdt1 = test_create_blacs_type1( &opal_datatype_int4 ); + pdt2 = test_create_blacs_type2( &opal_datatype_int4 ); + if( outputFlags & CHECK_PACK_UNPACK ) { + local_copy_with_convertor_2datatypes( pdt1, 1, pdt2, 1, 100 ); + } + printf( ">>--------------------------------------------<<\n" ); + OBJ_RELEASE( pdt1 ); assert( pdt1 == NULL ); + OBJ_RELEASE( pdt2 ); assert( pdt2 == NULL ); + + /* clean-ups all data allocations */ + opal_datatype_finalize(); + + return OPAL_SUCCESS; +} diff --git a/test/datatype/opal_ddt_lib.c b/test/datatype/opal_ddt_lib.c new file mode 100644 index 0000000000..e05bb061c6 --- /dev/null +++ b/test/datatype/opal_ddt_lib.c @@ -0,0 +1,850 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" + +#include +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif +#include "opal_ddt_lib.h" + +#include "opal/constants.h" +#include "opal/datatype/opal_datatype.h" + + +uint32_t outputFlags = 0; + +static int32_t opal_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp, + const opal_datatype_t* oldType, opal_datatype_t** newType ); +static int32_t opal_datatype_create_hindexed( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, + const opal_datatype_t* oldType, opal_datatype_t** newType ); +static int32_t opal_datatype_create_struct( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, + opal_datatype_t* const * pTypes, opal_datatype_t** newType ); +static int32_t opal_datatype_create_vector( int count, int bLength, int stride, + const opal_datatype_t* oldType, opal_datatype_t** newType ); +static int32_t opal_datatype_create_hvector( int count, int bLength, OPAL_PTRDIFF_TYPE stride, + const opal_datatype_t* oldType, opal_datatype_t** newType ); + + +/** + * Cache cleanup. + */ +#define CACHE_SIZE (4*1024*1024) +void cache_trash( void ) +{ + char* buffer; + + buffer = (char*)malloc( sizeof(char) * CACHE_SIZE ); + memset( buffer, 1, CACHE_SIZE ); + memset( buffer, 0xff, CACHE_SIZE ); + free( buffer ); +} + +opal_datatype_t* test_create_twice_two_doubles( void ) +{ + opal_datatype_t* pdt; + + opal_datatype_create_vector( 2, 2, 5, &opal_datatype_float8, &pdt ); + opal_datatype_commit( pdt ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + return pdt; +} + + +/* + Datatype 0x832cf28 size 0 align 1 id 0 length 4 used 0 + true_lb 0 true_ub 0 (true_extent 0) lb 0 ub 0 (extent 0) + nbElems 0 loops 0 flags 6 (commited contiguous )-cC--------[---][---] + contain 13 disp 0x420 (1056) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x478 (1144) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x4d0 (1232) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x528 (1320) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x580 (1408) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x5d8 (1496) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 13 disp 0x630 (1584) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 12 disp 0x68c (1676) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 11 disp 0x6e8 (1768) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 10 disp 0x744 (1860) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 9 disp 0x7a0 (1952) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 8 disp 0x7fc (2044) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 7 disp 0x858 (2136) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 6 disp 0x8b4 (2228) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 5 disp 0x910 (2320) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 4 disp 0x96c (2412) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 3 disp 0x9c8 (2504) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 2 disp 0xa24 (2596) extent 4 + --C-----D*-[ C ][INT] MPI_INT count 1 disp 0xa80 (2688) extent 4 +*/ +static int blacs_length[] = { 13, 13, 13, 13, 13, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; +static int blacs_indices[] = { 1144/4, 1232/4, 1320/4, 1408/4, 1496/4, 1584/4, 1676/4, 1768/4, + 1860/4, 1952/4, 2044/4, 2136/4, 2228/4, 2320/4, 2412/4, 2504/4, + 2596/4, 2688/4 }; +opal_datatype_t* test_create_blacs_type( void ) +{ + opal_datatype_t *pdt; + + opal_datatype_create_indexed( 18, blacs_length, blacs_indices, &opal_datatype_int4, &pdt ); + opal_datatype_commit( pdt ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + return pdt; +} + +opal_datatype_t* test_create_blacs_type1( opal_datatype_t* base_type ) +{ + opal_datatype_t *pdt; + + opal_datatype_create_vector( 7, 1, 3, base_type, &pdt ); + opal_datatype_commit( pdt ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + return pdt; +} + +opal_datatype_t* test_create_blacs_type2( opal_datatype_t* base_type ) +{ + opal_datatype_t *pdt; + + opal_datatype_create_vector( 7, 1, 2, base_type, &pdt ); + opal_datatype_commit( pdt ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + return pdt; +} + + +opal_datatype_t* test_struct( void ) +{ + const opal_datatype_t* types[] = { &opal_datatype_float4, + NULL, + &opal_datatype_int1 }; + int lengths[] = { 2, 1, 3 }; + OPAL_PTRDIFF_TYPE disp[] = { 0, 16, 26 }; + opal_datatype_t* pdt, *pdt1; + + printf( "test struct\n" ); + opal_datatype_create_contiguous(0, &opal_datatype_null, &pdt1); + opal_datatype_add( pdt1, &opal_datatype_float8, 1, 0, -1 ); + opal_datatype_add( pdt1, &opal_datatype_int1, 1, 8, -1 ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt1 ); + } + + types[1] = pdt1; + + opal_datatype_create_struct( 3, lengths, disp, types, &pdt ); + OBJ_RELEASE( pdt1 ); /*assert( pdt1 == NULL );*/ + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + return pdt; +} + +typedef struct __struct_char_double { + char c; + double d; +} char_double_t; + +opal_datatype_t* test_struct_char_double( void ) +{ + char_double_t data; + int lengths[] = {1, 1}; + OPAL_PTRDIFF_TYPE displ[] = {0, 0}; + opal_datatype_t *pdt; + opal_datatype_t* types[] = { &opal_datatype_int1, &opal_datatype_float8}; + + displ[0] = (char*)&(data.c) - (char*)&(data); + displ[1] = (char*)&(data.d) - (char*)&(data); + + opal_datatype_create_struct( 2, lengths, displ, types, &pdt ); + opal_datatype_commit( pdt ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + return pdt; +} + +typedef struct { + int i1; + int gap; + int i2; +} sdata_intern; + +typedef struct { + int counter; + sdata_intern v[10]; + int last; +} sstrange; + +#define SSTRANGE_CNT 10 +#define USE_RESIZED + +opal_datatype_t* create_strange_dt( void ) +{ + sdata_intern v[2]; + OPAL_PTRDIFF_TYPE displ[3]; + sstrange t[2]; + int pBlock[3] = {1, 10, 1}, dispi[3]; + opal_datatype_t *pdt, *pdt1, *pdt2, *pdtTemp; + + opal_datatype_create_contiguous(0, &opal_datatype_null, &pdt1); + opal_datatype_add( pdt1, &opal_datatype_float8, 1, 0, -1 ); + opal_datatype_add( pdt1, &opal_datatype_int1, 1, 8, -1 ); + +#ifdef USE_RESIZED + /* optional */ + displ[0] = 0; + displ[1] = (char*)&(v[1]) - (char*)&(v[0]); + opal_datatype_resize( pdt1, displ[0], displ[1]); +#endif /* USE_RESIZED */ + + opal_datatype_create_contiguous( SSTRANGE_CNT, pdt1, &pdt ); + + OBJ_RELEASE( pdt1 ); + printf( "\nStrange datatype BEFORE COMMIT\n" ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + + opal_datatype_commit( pdt ); + printf( "\nStrange datatype AFTER COMMIT\n" ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + return pdt; +} + +opal_datatype_t* create_vector_type( const opal_datatype_t* data, int count, int length, int stride ) +{ + opal_datatype_t* vector; + + opal_datatype_create_vector( count, length, stride, data, &vector ); + opal_datatype_commit( vector ); + return vector; +} + + +opal_datatype_t* create_contiguous_type( const opal_datatype_t* type, int length ) +{ + opal_datatype_t* newtype; + + opal_datatype_create_contiguous( length, type, &newtype ); + opal_datatype_commit( newtype ); + + return newtype; +} + + +/*****************************************************************************/ +/* Copied Function to get test to work */ +/*****************************************************************************/ +static int32_t opal_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp, + const opal_datatype_t* oldType, opal_datatype_t** newType ) +{ + opal_datatype_t* pdt; + int i, dLength, endat, disp; + OPAL_PTRDIFF_TYPE extent; + + if( 0 == count ) { + *newType = opal_datatype_create( 0 ); + opal_datatype_add( *newType, &opal_datatype_null, 0, 0, 0); + return OPAL_SUCCESS; + } + + disp = pDisp[0]; + dLength = pBlockLength[0]; + endat = disp + dLength; + opal_datatype_type_extent( oldType, &extent ); + if( 1 >= count ) { + pdt = opal_datatype_create( oldType->desc.used + 2 ); + /* multiply by count to make it zero if count is zero */ + opal_datatype_add( pdt, oldType, count * dLength, disp * extent, extent ); + } else { + pdt = opal_datatype_create( count * (2 + oldType->desc.used) ); + for( i = 1; i < count; i++ ) { + if( endat == pDisp[i] ) { + /* contiguous with the previsious */ + dLength += pBlockLength[i]; + endat += pBlockLength[i]; + } else { + opal_datatype_add( pdt, oldType, dLength, disp * extent, extent ); + disp = pDisp[i]; + dLength = pBlockLength[i]; + endat = disp + pBlockLength[i]; + } + } + opal_datatype_add( pdt, oldType, dLength, disp * extent, extent ); + } + + *newType = pdt; + return OPAL_SUCCESS; +} + +static int32_t opal_datatype_create_hindexed( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, + const opal_datatype_t* oldType, opal_datatype_t** newType ) +{ + opal_datatype_t* pdt; + int i, dLength; + OPAL_PTRDIFF_TYPE extent, disp, endat; + + if( 0 == count ) { + *newType = opal_datatype_create( 0 ); + opal_datatype_add( *newType, &opal_datatype_null, 0, 0, 0); + return OPAL_SUCCESS; + } + + opal_datatype_type_extent( oldType, &extent ); + + pdt = opal_datatype_create( count * (2 + oldType->desc.used) ); + disp = pDisp[0]; + dLength = pBlockLength[0]; + endat = disp + dLength * extent; + if( 1 >= count ) { + pdt = opal_datatype_create( oldType->desc.used + 2 ); + /* multiply by count to make it zero if count is zero */ + opal_datatype_add( pdt, oldType, count * dLength, disp, extent ); + } else { + for( i = 1; i < count; i++ ) { + if( endat == pDisp[i] ) { + /* contiguous with the previsious */ + dLength += pBlockLength[i]; + endat += pBlockLength[i] * extent; + } else { + opal_datatype_add( pdt, oldType, dLength, disp, extent ); + disp = pDisp[i]; + dLength = pBlockLength[i]; + endat = disp + pBlockLength[i] * extent; + } + } + opal_datatype_add( pdt, oldType, dLength, disp, extent ); + } + *newType = pdt; + return OPAL_SUCCESS; +} + + +static int32_t opal_datatype_create_struct( int count, const int* pBlockLength, const OPAL_PTRDIFF_TYPE* pDisp, + opal_datatype_t* const * pTypes, opal_datatype_t** newType ) +{ + int i; + OPAL_PTRDIFF_TYPE disp = 0, endto, lastExtent, lastDisp; + int lastBlock; + opal_datatype_t *pdt, *lastType; + + if( 0 == count ) { + *newType = opal_datatype_create( 0 ); + opal_datatype_add( *newType, &opal_datatype_null, 0, 0, 0); + return OPAL_SUCCESS; + } + + /* if we compute the total number of elements before we can + * avoid increasing the size of the desc array often. + */ + lastType = (opal_datatype_t*)pTypes[0]; + lastBlock = pBlockLength[0]; + lastExtent = lastType->ub - lastType->lb; + lastDisp = pDisp[0]; + endto = pDisp[0] + lastExtent * lastBlock; + + for( i = 1; i < count; i++ ) { + if( (pTypes[i] == lastType) && (pDisp[i] == endto) ) { + lastBlock += pBlockLength[i]; + endto = lastDisp + lastBlock * lastExtent; + } else { + disp += lastType->desc.used; + if( lastBlock > 1 ) disp += 2; + lastType = (opal_datatype_t*)pTypes[i]; + lastExtent = lastType->ub - lastType->lb; + lastBlock = pBlockLength[i]; + lastDisp = pDisp[i]; + endto = lastDisp + lastExtent * lastBlock; + } + } + disp += lastType->desc.used; + if( lastBlock != 1 ) disp += 2; + + lastType = (opal_datatype_t*)pTypes[0]; + lastBlock = pBlockLength[0]; + lastExtent = lastType->ub - lastType->lb; + lastDisp = pDisp[0]; + endto = pDisp[0] + lastExtent * lastBlock; + + pdt = opal_datatype_create( (int32_t)disp ); + + /* Do again the same loop but now add the elements */ + for( i = 1; i < count; i++ ) { + if( (pTypes[i] == lastType) && (pDisp[i] == endto) ) { + lastBlock += pBlockLength[i]; + endto = lastDisp + lastBlock * lastExtent; + } else { + opal_datatype_add( pdt, lastType, lastBlock, lastDisp, lastExtent ); + lastType = (opal_datatype_t*)pTypes[i]; + lastExtent = lastType->ub - lastType->lb; + lastBlock = pBlockLength[i]; + lastDisp = pDisp[i]; + endto = lastDisp + lastExtent * lastBlock; + } + } + opal_datatype_add( pdt, lastType, lastBlock, lastDisp, lastExtent ); + + *newType = pdt; + return OPAL_SUCCESS; +} + + +static int32_t opal_datatype_create_vector( int count, int bLength, int stride, + const opal_datatype_t* oldType, opal_datatype_t** newType ) +{ + opal_datatype_t *pTempData, *pData; + OPAL_PTRDIFF_TYPE extent = oldType->ub - oldType->lb; + + + if( 0 == count ) { + *newType = opal_datatype_create( 0 ); + opal_datatype_add( *newType, &opal_datatype_null, 0, 0, 0); + return OPAL_SUCCESS; + } + + pData = opal_datatype_create( oldType->desc.used + 2 ); + if( (bLength == stride) || (1 >= count) ) { /* the elements are contiguous */ + opal_datatype_add( pData, oldType, count * bLength, 0, extent ); + } else { + if( 1 == bLength ) { + opal_datatype_add( pData, oldType, count, 0, extent * stride ); + } else { + opal_datatype_add( pData, oldType, bLength, 0, extent ); + pTempData = pData; + pData = opal_datatype_create( oldType->desc.used + 2 + 2 ); + opal_datatype_add( pData, pTempData, count, 0, extent * stride ); + OBJ_RELEASE( pTempData ); + } + } + *newType = pData; + return OPAL_SUCCESS; +} + + +static int32_t opal_datatype_create_hvector( int count, int bLength, OPAL_PTRDIFF_TYPE stride, + const opal_datatype_t* oldType, opal_datatype_t** newType ) +{ + opal_datatype_t *pTempData, *pData; + OPAL_PTRDIFF_TYPE extent = oldType->ub - oldType->lb; + + if( 0 == count ) { + *newType = opal_datatype_create( 0 ); + opal_datatype_add( *newType, &opal_datatype_null, 0, 0, 0); + return OPAL_SUCCESS; + } + + pTempData = opal_datatype_create( oldType->desc.used + 2 ); + if( ((extent * bLength) == stride) || (1 >= count) ) { /* contiguous */ + pData = pTempData; + opal_datatype_add( pData, oldType, count * bLength, 0, extent ); + } else { + if( 1 == bLength ) { + pData = pTempData; + opal_datatype_add( pData, oldType, count, 0, stride ); + } else { + opal_datatype_add( pTempData, oldType, bLength, 0, extent ); + pData = opal_datatype_create( oldType->desc.used + 2 + 2 ); + opal_datatype_add( pData, pTempData, count, 0, stride ); + OBJ_RELEASE( pTempData ); + } + } + *newType = pData; + return OPAL_SUCCESS; +} + +/*****************************************************************************/ +int init_random_upper_matrix( unsigned int N, double* mat ) +{ + unsigned int i, j; + + srand( time(NULL) ); + for( i = 0; i < N; i++ ) { + mat += i; + for( j = i; j < N; j++ ) { + *mat = (double)random(); + mat++; + } + } + return OPAL_SUCCESS; +} + +int check_diag_matrix( unsigned int N, double* mat1, double* mat2 ) +{ + unsigned int i, j; + + for( i = 0; i < N; i++ ) { + mat1 += i; + mat2 += i; + for( j = i; j < N; j++ ) { + if( *mat1 != *mat2 ) { + printf( "error in position (%d, %d) expect %f and find %f\n", + i, j, *mat1, *mat2 ); + printf( "hex %lx != %lx\n", *(long*)mat1, *(long*)mat2 ); + return OPAL_ERROR; + } + mat1++; mat2++; + } + } + return OPAL_SUCCESS; +} + + +opal_datatype_t* upper_matrix( unsigned int mat_size ) +{ + int *disp, *blocklen; + unsigned int i; + opal_datatype_t* upper; + + disp = (int*)malloc( sizeof(int) * mat_size ); + blocklen = (int*)malloc( sizeof(int) * mat_size ); + + for( i = 0; i < mat_size; i++ ) { + disp[i] = i * mat_size + i; + blocklen[i] = mat_size - i; + } + +#if SIZEOF_DOUBLE == 4 + opal_datatype_create_indexed( mat_size, blocklen, disp, + &opal_datatype_float4, + &upper ); +#else + opal_datatype_create_indexed( mat_size, blocklen, disp, + &opal_datatype_float8, + &upper ); +#endif + opal_datatype_commit( upper ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( upper ); + } + free( disp ); + free( blocklen ); + return upper; +} + +opal_datatype_t* lower_matrix( unsigned int mat_size ) +{ + int *disp, *blocklen; + unsigned int i; + opal_datatype_t* upper; + + disp = (int*)malloc( sizeof(int) * mat_size ); + blocklen = (int*)malloc( sizeof(int) * mat_size ); + + for( i = 0; i < mat_size; i++ ) { + disp[i] = i * mat_size; + blocklen[i] = i; + } +#if SIZEOF_DOUBLE == 4 + opal_datatype_create_indexed( mat_size, blocklen, disp, &opal_datatype_float4, + &upper ); +#else + opal_datatype_create_indexed( mat_size, blocklen, disp, &opal_datatype_float8, + &upper ); +#endif + free( disp ); + free( blocklen ); + return upper; +} + +opal_datatype_t* test_matrix_borders( unsigned int size, unsigned int width ) +{ + opal_datatype_t *pdt, *pdt_line; + int disp[2]; + int blocklen[2]; + + disp[0] = 0; + blocklen[0] = width; + disp[1] = (size - width) * sizeof(double); + blocklen[1] = width; + + opal_datatype_create_indexed( 2, blocklen, disp, &opal_datatype_float8, + &pdt_line ); + opal_datatype_create_contiguous( size, pdt_line, &pdt ); + OBJ_RELEASE( pdt_line ); /*assert( pdt_line == NULL );*/ + return pdt; +} + + +opal_datatype_t* test_contiguous( void ) +{ + opal_datatype_t *pdt, *pdt1, *pdt2; + + printf( "test contiguous (alignement)\n" ); + opal_datatype_create_contiguous(0, &opal_datatype_null, &pdt1); + opal_datatype_add( pdt1, &opal_datatype_float8, 1, 0, -1 ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt1 ); + } + opal_datatype_add( pdt1, &opal_datatype_int1, 1, 8, -1 ); + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt1 ); + } + opal_datatype_create_contiguous( 4, pdt1, &pdt2 ); + OBJ_RELEASE( pdt1 ); /*assert( pdt1 == NULL );*/ + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt2 ); + } + opal_datatype_create_contiguous( 2, pdt2, &pdt ); + OBJ_RELEASE( pdt2 ); /*assert( pdt2 == NULL );*/ + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + opal_datatype_dump( pdt ); + } + return pdt; +} + + + +int mpich_typeub( void ) +{ + int errs = 0; + OPAL_PTRDIFF_TYPE extent, lb, extent1, extent2, extent3; + OPAL_PTRDIFF_TYPE displ[2]; + int blens[2]; + opal_datatype_t *type1, *type2, *type3, *types[2]; + + opal_datatype_create_vector( 2, 1, 4, &opal_datatype_int4, &type1 ); + opal_datatype_commit( type1 ); + opal_datatype_get_extent( type1, &lb, &extent ); + extent1 = 5 * sizeof(int); + if (extent != extent1) { + printf("EXTENT 1 %ld != %ld\n", (long)extent, (long)extent1); + errs++; + printf("extent(type1)=%ld\n",(long)extent); + } + + blens[0] = 1; + blens[1] = 1; + displ[0] = 0; + displ[1] = sizeof(int)*4; + types[0] = type1; + types[1] = (const opal_datatype_t*)&opal_datatype_ub; + extent2 = displ[1]; + + /* using MPI_UB and Type_struct, monkey with the extent, making it 16 + */ + opal_datatype_create_struct( 2, blens, displ, types, &type2 ); + opal_datatype_commit( type2 ); + opal_datatype_get_extent( type2, &lb, &extent ); + if (extent != extent2) { + printf("EXTENT 2 %ld != %ld\n", (long)extent, (long)extent2); + errs++; + printf("extent(type2)=%ld\n",(long)extent); + } + + /* monkey with the extent again, making it 4 + * ===> MPICH gives 4 + * ===> MPIF gives 16, the old extent + */ + displ[1] = sizeof(int); + types[0] = type2; + types[1] = &opal_datatype_ub; + extent3 = extent2; + + opal_datatype_create_struct( 2, blens, displ, types, &type3 ); + opal_datatype_commit( type3 ); + + opal_datatype_get_extent( type3, &lb, &extent ); + if (extent != extent3) { + printf("EXTENT 3 %ld != %ld\n", (long)extent, (long)extent3); + errs++; + printf("extent(type3)=%ld\n",(long)extent); + } + + OBJ_RELEASE( type1 ); /*assert( type1 == NULL );*/ + OBJ_RELEASE( type2 ); /*assert( type2 == NULL );*/ + OBJ_RELEASE( type3 ); assert( type3 == NULL ); + return errs; +} + +int mpich_typeub2( void ) +{ + int blocklen[3], err = 0; + size_t sz1, sz2, sz3; + OPAL_PTRDIFF_TYPE disp[3], lb, ub, ex1, ex2, ex3; + opal_datatype_t *types[3], *dt1, *dt2, *dt3; + + blocklen[0] = 1; + blocklen[1] = 1; + blocklen[2] = 1; + disp[0] = -3; + disp[1] = 0; + disp[2] = 6; + types[0] = &opal_datatype_lb; + types[1] = &opal_datatype_int4; + types[2] = &opal_datatype_ub; + + opal_datatype_create_struct(3, blocklen, disp, types, &dt1); + opal_datatype_commit( dt1 ); + + opal_datatype_type_lb(dt1, &lb); opal_datatype_type_ub(dt1, &ub); + opal_datatype_type_extent(dt1,&ex1); opal_datatype_type_size(dt1,&sz1); + + /* Values should be lb = -3, ub = 6 extent 9; size depends on implementation */ + if (lb != -3 || ub != 6 || ex1 != 9) { + printf("Example 3.26 type1 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex1, (int)sz1); + err++; + } + else + printf("Example 3.26 type1 correct\n" ); + + opal_datatype_create_contiguous(2, dt1, &dt2); + opal_datatype_type_lb(dt2, &lb); opal_datatype_type_ub(dt2, &ub); + opal_datatype_type_extent(dt2,&ex2); opal_datatype_type_size(dt2,&sz2); + /* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */ + if (lb != -3 || ub != 15 || ex2 != 18) { + printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8); + printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2); + err++; + } + else + printf("Example 3.26 type1 correct\n" ); + OBJ_RELEASE( dt2 ); assert( dt2 == NULL ); + opal_datatype_create_contiguous(2,dt1,&dt2); + opal_datatype_type_lb(dt2, &lb); opal_datatype_type_ub(dt2, &ub); + opal_datatype_type_extent(dt2,&ex2); opal_datatype_type_size(dt2,&sz2); + /* Values should be lb = -3, ub = 15, extent = 18, size depends on implementation */ + if (lb != -3 || ub != 15 || ex2 != 18) { + printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8); + printf("Example 3.26 type2 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex2, (int)sz2); + err++; + } + else + printf( "Example 3.26 type2 correct\n" ); + + types[0]=dt1; types[1]=dt1; + blocklen[0]=1; blocklen[1]=1; + disp[0]=0; disp[1]=ex1; + + opal_datatype_create_struct(2, blocklen, disp, types, &dt3); + opal_datatype_commit( dt3 ); + + opal_datatype_type_lb(dt3, &lb); opal_datatype_type_ub(dt3, &ub); + opal_datatype_type_extent(dt3,&ex3); opal_datatype_type_size(dt3,&sz3); + /* Another way to express type2 */ + if (lb != -3 || ub != 15 || ex3 != 18) { + printf("type3 lb %d ub %d extent %d size %d\n", (int)-3, (int)15, (int)18, 8); + printf("type3 lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex3, (int)sz2); + err++; + } + else + printf( "type3 correct\n" ); + + OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/ + OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/ + OBJ_RELEASE( dt3 ); assert( dt3 == NULL ); + return err; +} + +int mpich_typeub3( void ) +{ + int blocklen[2], err = 0, idisp[3]; + size_t sz; + OPAL_PTRDIFF_TYPE disp[3], lb, ub, ex; + opal_datatype_t *types[3], *dt1, *dt2, *dt3, *dt4, *dt5; + + /* Create a datatype with explicit LB and UB */ + blocklen[0] = 1; + blocklen[1] = 1; + blocklen[2] = 1; + disp[0] = -3; + disp[1] = 0; + disp[2] = 6; + types[0] = &opal_datatype_lb; + types[1] = &opal_datatype_int4; + types[2] = &opal_datatype_ub; + + /* Generate samples for contiguous, hindexed, hvector, indexed, and vector (struct and contiguous tested in typeub2) */ + opal_datatype_create_struct(3, blocklen, disp, types, &dt1); + opal_datatype_commit( dt1 ); + + /* This type is the same as in typeub2, and is tested there */ + types[0]=dt1; types[1]=dt1; + blocklen[0]=1; blocklen[1]=1; + disp[0]=-4; disp[1]=7; + idisp[0]=-4; idisp[1]=7; + + opal_datatype_create_hindexed( 2, blocklen, disp, dt1, &dt2 ); + opal_datatype_commit( dt2 ); + + opal_datatype_type_lb( dt2, &lb ); opal_datatype_type_ub( dt2, &ub ); + opal_datatype_type_extent( dt2, &ex ); opal_datatype_type_size( dt2, &sz ); + + if (lb != -7 || ub != 13 || ex != 20) { + printf("hindexed lb %d ub %d extent %d size %d\n", (int)-7, (int)13, (int)20, (int)sz); + printf("hindexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz); + err++; + } + else + printf( "hindexed ok\n" ); + + opal_datatype_create_indexed( 2, blocklen, idisp, dt1, &dt3 ); + opal_datatype_commit( dt3 ); + + opal_datatype_type_lb( dt3, &lb ); opal_datatype_type_ub( dt3, &ub ); + opal_datatype_type_extent( dt3, &ex ); opal_datatype_type_size( dt3, &sz ); + + if (lb != -39 || ub != 69 || ex != 108) { + printf("indexed lb %d ub %d extent %d size %d\n", (int)-39, (int)69, (int)108, (int)sz); + printf("indexed lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz); + err++; + } + else + printf( "indexed ok\n" ); + + opal_datatype_create_hvector( 2, 1, 14, dt1, &dt4 ); + opal_datatype_commit( dt4 ); + + opal_datatype_type_lb( dt4, &lb ); opal_datatype_type_ub( dt4, &ub ); + opal_datatype_type_extent( dt4, &ex ); opal_datatype_type_size( dt4, &sz ); + + if (lb != -3 || ub != 20 || ex != 23) { + printf("hvector lb %d ub %d extent %d size %d\n", (int)-3, (int)20, (int)23, (int)sz); + printf("hvector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz); + err++; + } + else + printf( "hvector ok\n" ); + + opal_datatype_create_vector( 2, 1, 14, dt1, &dt5 ); + opal_datatype_commit( dt5 ); + + opal_datatype_type_lb( dt5, &lb ); opal_datatype_type_ub( dt5, &ub ); + opal_datatype_type_extent( dt5, &ex ); opal_datatype_type_size( dt5, &sz ); + + if (lb != -3 || ub != 132 || ex != 135) { + printf("vector lb %d ub %d extent %d size %d\n", (int)-3, (int)132, (int)135, (int)sz); + printf("vector lb %d ub %d extent %d size %d\n", (int)lb, (int)ub, (int)ex, (int)sz); + err++; + } + else + printf( "vector ok\n" ); + + OBJ_RELEASE( dt1 ); /*assert( dt1 == NULL );*/ + OBJ_RELEASE( dt2 ); /*assert( dt2 == NULL );*/ + OBJ_RELEASE( dt3 ); /*assert( dt3 == NULL );*/ + OBJ_RELEASE( dt4 ); /*assert( dt4 == NULL );*/ + OBJ_RELEASE( dt5 ); assert( dt5 == NULL ); + return err; +} diff --git a/test/datatype/opal_ddt_lib.h b/test/datatype/opal_ddt_lib.h new file mode 100644 index 0000000000..86b0b62707 --- /dev/null +++ b/test/datatype/opal_ddt_lib.h @@ -0,0 +1,52 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef TEST_OPAL_DDT_LIB_H +#define TEST_OPAL_DDT_LIB_H + +#include "opal_config.h" + +#include "opal/datatype/opal_datatype.h" + + +#define TIMER_DATA_TYPE struct timeval +#define GET_TIME(TV) gettimeofday( &(TV), NULL ) +#define ELAPSED_TIME(TSTART, TEND) (((TEND).tv_sec - (TSTART).tv_sec) * 1000000 + ((TEND).tv_usec - (TSTART).tv_usec)) + +#define DUMP_DATA_AFTER_COMMIT 0x00000001 +#define CHECK_PACK_UNPACK 0x00000002 + +extern uint32_t outputFlags; + +extern void cache_trash( void ); +extern opal_datatype_t* create_contiguous_type( const opal_datatype_t* type, int length ); +extern opal_datatype_t* create_vector_type( const opal_datatype_t* data, int count, int length, int stride ); +extern opal_datatype_t* create_strange_dt( void ); +extern opal_datatype_t* upper_matrix( unsigned int mat_size ); +extern opal_datatype_t* lower_matrix( unsigned int mat_size ); +extern opal_datatype_t* test_matrix_borders( unsigned int size, unsigned int width ); +extern int init_random_upper_matrix( unsigned int N, double* mat ); +extern int check_diag_matrix( unsigned int N, double* mat1, double* mat2 ); +extern opal_datatype_t* test_contiguous( void ); +extern opal_datatype_t* test_struct_char_double( void ); +extern opal_datatype_t* test_create_twice_two_doubles( void ); +extern opal_datatype_t* test_struct( void ); +extern opal_datatype_t* test_create_blacs_type( void ); +extern opal_datatype_t* test_create_blacs_type1( opal_datatype_t* base_type ); +extern opal_datatype_t* test_create_blacs_type2( opal_datatype_t* base_type ); + +extern int mpich_typeub( void ); +extern int mpich_typeub2( void ); +extern int mpich_typeub3( void ); + +#endif /* TEST_OPAL_DDT_LIB_H */ \ No newline at end of file diff --git a/test/datatype/position.c b/test/datatype/position.c index 4e139a34ba..3f821f7089 100644 --- a/test/datatype/position.c +++ b/test/datatype/position.c @@ -13,8 +13,8 @@ #include "ompi_config.h" #include #include -#include "ompi/datatype/convertor.h" -#include "ompi/datatype/datatype.h" +#include "opal/datatype/opal_convertor.h" +#include "ompi/datatype/ompi_datatype.h" #include "opal/util/output.h" /** @@ -39,11 +39,11 @@ create_segments( ompi_datatype_t* datatype, int count, ddt_segment_t** segments, int* seg_count ) { size_t data_size, total_length, position; - ompi_convertor_t* convertor; + opal_convertor_t* convertor; int i; ddt_segment_t* segment; - ompi_ddt_type_size( datatype, &data_size ); + ompi_datatype_type_size( datatype, &data_size ); data_size *= count; *seg_count = data_size / segment_length; if( ((*seg_count) * segment_length) != data_size ) @@ -51,8 +51,8 @@ create_segments( ompi_datatype_t* datatype, int count, allocate_segments: *segments = (ddt_segment_t*)malloc( (*seg_count) * sizeof(ddt_segment_t) ); - convertor = ompi_convertor_create( 0, 0 ); - ompi_convertor_prepare_for_send( convertor, datatype, count, NULL ); + convertor = opal_convertor_create( 0, 0 ); + opal_convertor_prepare_for_send( convertor, &(datatype->super), count, NULL ); position = 0; total_length = 0; @@ -63,7 +63,7 @@ create_segments( ompi_datatype_t* datatype, int count, /* Find the end of the segment */ position += segment_length; - ompi_convertor_set_position( convertor, &position ); + opal_convertor_set_position( convertor, &position ); segment->size = position - segment->position; total_length += segment->size; } @@ -101,20 +101,20 @@ pack_segments( ompi_datatype_t* datatype, int count, void* buffer ) { size_t max_size, position; - ompi_convertor_t* convertor; + opal_convertor_t* convertor; struct iovec iov; int i; uint32_t iov_count; - convertor = ompi_convertor_create( ompi_mpi_local_arch, 0 ); - ompi_convertor_prepare_for_send( convertor, datatype, count, buffer ); + convertor = opal_convertor_create( opal_local_arch, 0 ); + opal_convertor_prepare_for_send( convertor, &(datatype->super), count, buffer ); for( i = 0; i < seg_count; i++ ) { iov.iov_len = segments[i].size; iov.iov_base = segments[i].buffer; max_size = iov.iov_len; position = segments[i].position; - ompi_convertor_set_position( convertor, &position ); + opal_convertor_set_position( convertor, &position ); if( position != segments[i].position ) { opal_output( 0, "Setting position failed (%lu != %lu)\n", (unsigned long)segments[i].position, (unsigned long)position ); @@ -122,7 +122,7 @@ pack_segments( ompi_datatype_t* datatype, int count, } iov_count = 1; - ompi_convertor_pack( convertor, &iov, &iov_count, &max_size ); + opal_convertor_pack( convertor, &iov, &iov_count, &max_size ); if( max_size != segments[i].size ) { opal_output( 0, "Amount of packed data do not match (%lu != %lu)\n", (unsigned long)max_size, (unsigned long)segments[i].size ); @@ -140,14 +140,14 @@ unpack_segments( ompi_datatype_t* datatype, int count, ddt_segment_t* segments, int seg_count, void* buffer ) { - ompi_convertor_t* convertor; + opal_convertor_t* convertor; size_t max_size, position; int i; uint32_t iov_count; struct iovec iov; - convertor = ompi_convertor_create( ompi_mpi_local_arch, 0 ); - ompi_convertor_prepare_for_recv( convertor, datatype, count, buffer ); + convertor = opal_convertor_create( opal_local_arch, 0 ); + opal_convertor_prepare_for_recv( convertor, &(datatype->super), count, buffer ); for( i = 0; i < seg_count; i++ ) { iov.iov_len = segments[i].size; @@ -155,7 +155,7 @@ unpack_segments( ompi_datatype_t* datatype, int count, max_size = iov.iov_len; position = segments[i].position; - ompi_convertor_set_position( convertor, &position ); + opal_convertor_set_position( convertor, &position ); if( position != segments[i].position ) { opal_output( 0, "Setting position failed (%lu != %lu)\n", (unsigned long)segments[i].position, (unsigned long)position ); @@ -163,7 +163,7 @@ unpack_segments( ompi_datatype_t* datatype, int count, } iov_count = 1; - ompi_convertor_unpack( convertor, &iov, &iov_count, &max_size ); + opal_convertor_unpack( convertor, &iov, &iov_count, &max_size ); if( max_size != segments[i].size ) { opal_output( 0, "Amount of unpacked data do not match (%lu != %lu)\n", (unsigned long)max_size, (unsigned long)segments[i].size ); @@ -225,7 +225,7 @@ int main( int argc, char* argv[] ) } memcpy(recv_buffer, send_buffer, sizeof(ddt_ldi_t) * data_count ); - ompi_ddt_init(); + ompi_datatype_init(); #if (OPAL_ENABLE_DEBUG == 1) && (OPAL_C_HAVE_VISIBILITY == 0) ompi_unpack_debug = 0; @@ -270,7 +270,7 @@ int main( int argc, char* argv[] ) } free(segments); - ompi_ddt_finalize(); + ompi_datatype_finalize(); return (0 == errors ? 0 : -1); } diff --git a/test/datatype/to_self.c b/test/datatype/to_self.c index b77da131f1..58b1ee364b 100644 --- a/test/datatype/to_self.c +++ b/test/datatype/to_self.c @@ -17,8 +17,8 @@ #include #if OPEN_MPI && 0 -extern void ompi_ddt_dump( MPI_Datatype ddt ); -#define MPI_DDT_DUMP(ddt) ompi_ddt_dump( (ddt) ) +extern void ompi_datatype_dump( MPI_Datatype ddt ); +#define MPI_DDT_DUMP(ddt) ompi_datatype_dump( (ddt) ) #else #define MPI_DDT_DUMP(ddt) #endif /* OPEN_MPI */ diff --git a/test/predefined/ompi_predefined.c b/test/predefined/ompi_predefined.c index 1124819e67..2d8fedcd27 100644 --- a/test/predefined/ompi_predefined.c +++ b/test/predefined/ompi_predefined.c @@ -13,7 +13,7 @@ #include "ompi/group/group.h" #include "ompi/request/request.h" #include "ompi/op/op.h" -#include "ompi/datatype/datatype.h" +#include "ompi/datatype/ompi_datatype.h" #include "ompi/win/win.h" #include "ompi/info/info.h" #include "ompi/file/file.h"