- Split the datatype engine into two parts: an MPI specific part in
OMPI and a language agnostic part in OPAL. The convertor is completely moved into OPAL. This offers several benefits as described in RFC http://www.open-mpi.org/community/lists/devel/2009/07/6387.php namely: - Fewer basic types (int* and float* types, boolean and wchar - Fixing naming scheme to ompi-nomenclature. - Usability outside of the ompi-layer. - Due to the fixed nature of simple opal types, their information is completely known at compile time and therefore constified - With fewer datatypes (22), the actual sizes of bit-field types may be reduced from 64 to 32 bits, allowing reorganizing the opal_datatype structure, eliminating holes and keeping data required in convertor (upon send/recv) in one cacheline... This has implications to the convertor-datastructure and other parts of the code. - Several performance tests have been run, the netpipe latency does not change with this patch on Linux/x86-64 on the smoky cluster. - Extensive tests have been done to verify correctness (no new regressions) using: 1. mpi_test_suite on linux/x86-64 using clean ompi-trunk and ompi-ddt: a. running both trunk and ompi-ddt resulted in no differences (except for MPI_SHORT_INT and MPI_TYPE_MIX_LB_UB do now run correctly). b. with --enable-memchecker and running under valgrind (one buglet when run with static found in test-suite, commited) 2. ibm testsuite on linux/x86-64 using clean ompi-trunk and ompi-ddt: all passed (except for the dynamic/ tests failed!! as trunk/MTT) 3. compilation and usage of HDF5 tests on Jaguar using PGI and PathScale compilers. 4. compilation and usage on Scicortex. - Please note, that for the heterogeneous case, (-m32 compiled binaries/ompi), neither ompi-trunk, nor ompi-ddt branch would successfully launch. This commit was SVN r21641.
Этот коммит содержится в:
родитель
b97f885c00
Коммит
6c5532072a
2
AUTHORS
2
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
67
configure.ac
67
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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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 <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#ifdef HAVE_NET_UIO_H
|
||||
#include <net/uio.h>
|
||||
#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 */
|
@ -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 */
|
||||
};
|
@ -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 */
|
||||
};
|
@ -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 */
|
@ -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 <string.h>
|
||||
#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 */
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -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 );
|
||||
}
|
||||
|
89
ompi/datatype/ompi_convertor.h
Обычный файл
89
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 <stddef.h>
|
||||
|
||||
#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 */
|
354
ompi/datatype/ompi_datatype.h
Обычный файл
354
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 <stddef.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#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 */
|
@ -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 <stddef.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
78
ompi/datatype/ompi_datatype_create.c
Обычный файл
78
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 <stddef.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#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;
|
||||
}
|
42
ompi/datatype/ompi_datatype_create_contiguous.c
Обычный файл
42
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;
|
||||
}
|
158
ompi/datatype/ompi_datatype_create_indexed.c
Обычный файл
158
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 <stddef.h>
|
||||
|
||||
#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;
|
||||
}
|
@ -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 <stddef.h>
|
||||
|
||||
#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;
|
||||
}
|
101
ompi/datatype/ompi_datatype_create_vector.c
Обычный файл
101
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 <stddef.h>
|
||||
|
||||
#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;
|
||||
}
|
@ -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 );
|
497
ompi/datatype/ompi_datatype_internal.h
Обычный файл
497
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 */
|
@ -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;
|
||||
}
|
||||
}
|
754
ompi/datatype/ompi_datatype_module.c
Обычный файл
754
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 <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#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 <OMPI_DATATYPE_MPI_MAX_PREDEFINED datatypes to
|
||||
the synonym types */
|
||||
|
||||
/* C++ complex types */
|
||||
DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_cxx_cplex.dt, "MPI_CXX_COMPLEX", &ompi_mpi_cplex.dt );
|
||||
ompi_mpi_cxx_cplex.dt.super.flags |= OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX;
|
||||
DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_cxx_dblcplex.dt, "MPI_CXX_DOUBLE_COMPLEX", &ompi_mpi_dblcplex.dt );
|
||||
ompi_mpi_cxx_dblcplex.dt.super.flags |= OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX;
|
||||
#if HAVE_LONG_DOUBLE
|
||||
DECLARE_MPI_SYNONYM_DDT( &ompi_mpi_cxx_ldblcplex.dt, "MPI_CXX_LONG_DOUBLE_COMPLEX", &ompi_mpi_ldblcplex.dt );
|
||||
ompi_mpi_cxx_ldblcplex.dt.super.flags |= OMPI_DATATYPE_FLAG_DATA_CPP | OMPI_DATATYPE_FLAG_DATA_COMPLEX;
|
||||
#endif /* HAVE_LONG_DOUBLE */
|
||||
|
||||
|
||||
/* Start to populate the f2c index translation table */
|
||||
|
||||
/* The order of the data registration should be the same as the
|
||||
* one in the mpif.h file. Any modification here should be
|
||||
* reflected there !!! Do the Fortran types first so that mpif.h
|
||||
* can have consecutive, dense numbers. */
|
||||
|
||||
/* This macro makes everything significantly easier to read below.
|
||||
All hail the moog! :-) */
|
||||
|
||||
#define MOOG(name) \
|
||||
{ \
|
||||
ompi_mpi_##name.dt.d_f_to_c_index = \
|
||||
opal_pointer_array_add(&ompi_datatype_f_to_c_table, &ompi_mpi_##name); \
|
||||
if( ompi_datatype_number_of_predefined_data < (ompi_mpi_##name).dt.d_f_to_c_index ) \
|
||||
ompi_datatype_number_of_predefined_data = (ompi_mpi_##name).dt.d_f_to_c_index; \
|
||||
}
|
||||
|
||||
/*
|
||||
* This MUST match the order of ompi/include/mpif-common.h
|
||||
* Any change will break binary compatibility of Fortran programs.
|
||||
*/
|
||||
MOOG(datatype_null);
|
||||
MOOG(byte);
|
||||
MOOG(packed);
|
||||
MOOG(ub);
|
||||
MOOG(lb);
|
||||
MOOG(character);
|
||||
MOOG(logical);
|
||||
MOOG(integer);
|
||||
MOOG(integer1);
|
||||
MOOG(integer2);
|
||||
MOOG(integer4);
|
||||
MOOG(integer8);
|
||||
MOOG(integer16);
|
||||
MOOG(real);
|
||||
MOOG(real4);
|
||||
MOOG(real8);
|
||||
MOOG(real16);
|
||||
MOOG(dblprec);
|
||||
MOOG(cplex);
|
||||
MOOG(complex8);
|
||||
MOOG(complex16);
|
||||
MOOG(complex32);
|
||||
MOOG(dblcplex);
|
||||
MOOG(2real);
|
||||
MOOG(2dblprec);
|
||||
MOOG(2integer);
|
||||
MOOG(2cplex);
|
||||
MOOG(2dblcplex);
|
||||
MOOG(real2);
|
||||
MOOG(logical1);
|
||||
MOOG(logical2);
|
||||
MOOG(logical4);
|
||||
MOOG(logical8);
|
||||
|
||||
/* Now the C types */
|
||||
|
||||
MOOG(wchar);
|
||||
MOOG(char);
|
||||
MOOG(unsigned_char);
|
||||
MOOG(signed_char);
|
||||
MOOG(short);
|
||||
MOOG(unsigned_short);
|
||||
MOOG(int);
|
||||
MOOG(unsigned);
|
||||
MOOG(long);
|
||||
MOOG(unsigned_long);
|
||||
MOOG(long_long_int);
|
||||
MOOG(unsigned_long_long);
|
||||
|
||||
MOOG(float);
|
||||
MOOG(double);
|
||||
MOOG(long_double);
|
||||
|
||||
MOOG(float_int);
|
||||
MOOG(double_int);
|
||||
MOOG(longdbl_int);
|
||||
MOOG(long_int);
|
||||
MOOG(2int);
|
||||
MOOG(short_int);
|
||||
|
||||
/* C++ types */
|
||||
|
||||
MOOG(cxx_bool);
|
||||
MOOG(cxx_cplex);
|
||||
MOOG(cxx_dblcplex);
|
||||
MOOG(cxx_ldblcplex);
|
||||
|
||||
for( i = 0; i < ompi_mpi_cxx_ldblcplex.dt.d_f_to_c_index; i++ ) {
|
||||
opal_datatype_t* datatype = (opal_datatype_t*)opal_pointer_array_get_item(&ompi_datatype_f_to_c_table, i );
|
||||
|
||||
if( (datatype->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);
|
||||
}
|
125
ompi/datatype/ompi_datatype_sndrcv.c
Обычный файл
125
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 );
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 <stdio.h>
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#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;
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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)) {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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]);
|
||||
|
@ -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"
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче
Block a user