1
1

MPI-3: add support for large counts using derived datatypes

Add support for MPI_Count type and MPI_COUNT datatype and add the required
MPI-3 functions MPI_Get_elements_x, MPI_Status_set_elements_x,
MPI_Type_get_extent_x, MPI_Type_get_true_extent_x, and MPI_Type_size_x.
This commit adds only the C bindings. Fortran bindins will be added in
another commit. For now the MPI_Count type is define to have the same size
as MPI_Offset. The type is required to be at least as large as MPI_Offset
and MPI_Aint. The type was initially intended to be a ssize_t (if it was
the same size as a long long) but there were issues compiling romio with
that definition (despite the inclusion of stddef.h).

I updated the datatype engine to use size_t instead of uint32_t to support
large datatypes. This will require some review to make sure that 1) the
changes are beneficial, 2) nothing was broken by the change (I doubt
anything was), and 3) there are no performance regressions due to this
change.

Increase the maximum number of predifined datatypes to support MPI_Count

Put common get_elements code to ompi/datatype/ompi_datatype_get_elements.c

Update MPI_Get_count to reflect changes in MPI-3 (return MPI_UNDEFINED when the count is too large for an int)

This commit was SVN r28932.
Этот коммит содержится в:
Nathan Hjelm 2013-07-23 15:35:14 +00:00
родитель c9cc0223a9
Коммит c4c69b4ddf
36 изменённых файлов: 741 добавлений и 112 удалений

Просмотреть файл

@ -798,9 +798,10 @@ AC_CACHE_SAVE
ompi_show_title "System-specific tests"
#
# Test to determine type of MPI_Offset. This is searched in the following order
# int64_t, long long, long, int. If none of these are 8 bytes, then we should
# search for int32_t, long long, long, int.
# Test to determine types of MPI_Offset and MPI_Count. This is searched in the
# following order int64_t, long long, long, int. If none of these are 8 bytes,
# then we should search for int32_t, long long, long, int. MPI_Count needs to
# be at least as large as MPI_Offset and MPI_Aint.
#
MPI_OFFSET_TYPE="not found"
MPI_OFFSET_DATATYPE="not found"
@ -809,30 +810,42 @@ if test $ac_cv_type_long_long = yes -a $ac_cv_sizeof_long_long = 8; then
MPI_OFFSET_TYPE="long long"
MPI_OFFSET_DATATYPE=MPI_LONG_LONG
MPI_OFFSET_SIZE=8
MPI_COUNT_TYPE="long long"
MPI_COUNT_SIZE=8
elif test $ac_cv_type_long = yes -a $ac_cv_sizeof_long = 8; then
MPI_OFFSET_TYPE="long"
MPI_OFFSET_DATATYPE=MPI_LONG
MPI_OFFSET_SIZE=8
MPI_COUNT_TYPE="long"
MPI_COUNT_SIZE=8
elif test $ac_cv_sizeof_int = 8; then
MPI_OFFSET_TYPE="int"
MPI_OFFSET_DATATYPE=MPI_INT
MPI_OFFSET_SIZE=8
MPI_COUNT_TYPE="int"
MPI_COUNT_SIZE=8
elif test $ac_cv_type_long_long = yes -a $ac_cv_sizeof_long_long = 4; then
MPI_OFFSET_TYPE="long long"
MPI_OFFSET_DATATYPE=MPI_LONG_LONG
MPI_OFFSET_SIZE=4
MPI_COUNT_TYPE="long long"
MPI_COUNT_SIZE=4
elif test $ac_cv_type_long = yes -a $ac_cv_sizeof_long = 4; then
MPI_OFFSET_TYPE="long"
MPI_OFFSET_DATATYPE=MPI_LONG
MPI_OFFSET_SIZE=4
MPI_COUNT_TYPE="long"
MPI_COUNT_SIZE=8
elif test $ac_cv_sizeof_int = 4; then
MPI_OFFSET_TYPE="int"
MPI_OFFSET_DATATYPE=MPI_INT
MPI_OFFSET_SIZE=4
MPI_COUNT_TYPE="int"
MPI_COUNT_SIZE=8
fi
AC_MSG_RESULT([$MPI_OFFSET_TYPE])
if test "$MPI_OFFSET_TYPE" = "not found"; then
AC_MSG_WARN([*** Unable to find the right definition for MPI_Offset])
AC_MSG_WARN([*** Unable to find the right definition for MPI_Offset and MPI_Count])
AC_MSG_ERROR([Cannot continue])
fi
AC_MSG_CHECKING([checking for an MPI datatype for MPI_Offset])
@ -847,6 +860,16 @@ AC_DEFINE_UNQUOTED(OMPI_MPI_OFFSET_TYPE, $MPI_OFFSET_TYPE, [Type of MPI_Offset -
AC_DEFINE_UNQUOTED(OMPI_MPI_OFFSET_SIZE, $MPI_OFFSET_SIZE, [Size of the MPI_Offset])
AC_DEFINE_UNQUOTED(OMPI_OFFSET_DATATYPE, $MPI_OFFSET_DATATYPE, [MPI datatype corresponding to MPI_Offset])
if test $MPI_COUNT_SIZE -eq 8 ; then
MPI_COUNT_MAX="0x7fffffffffffffffll"
elif test $MPI_COUNT_SIZE -eq 4 ; then
MPI_COUNT_MAX="0x7fffffffl"
fi
AC_DEFINE_UNQUOTED(OMPI_MPI_COUNT_SIZE, $MPI_COUNT_SIZE, [Size of the MPI_Count datatype])
AC_DEFINE_UNQUOTED(OMPI_MPI_COUNT_TYPE, $MPI_COUNT_TYPE, [Type of the MPI_Count datatype])
AC_DEFINE_UNQUOTED(MPI_COUNT_MAX, $MPI_COUNT_MAX, [Maximum value for an MPI_Count])
#
# Check for MPI_Aint type. Yes, there are platforms where
# sizeof(void*) != sizeof(long) (64 bit Windows, apparently).

Просмотреть файл

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2007 Los Alamos National Security, LLC. All rights
# Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
@ -40,7 +40,8 @@ libdatatype_la_SOURCES = \
ompi_datatype_external32.c \
ompi_datatype_match_size.c \
ompi_datatype_module.c \
ompi_datatype_sndrcv.c
ompi_datatype_sndrcv.c \
ompi_datatype_get_elements.c
libdatatype_la_LIBADD =

Просмотреть файл

@ -59,7 +59,7 @@ BEGIN_C_DECLS
#define OMPI_DATATYPE_FLAG_DATA_FORTRAN 0xC000
#define OMPI_DATATYPE_FLAG_DATA_LANGUAGE 0xC000
#define OMPI_DATATYPE_MAX_PREDEFINED 45
#define OMPI_DATATYPE_MAX_PREDEFINED 47
#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).
@ -272,14 +272,14 @@ ompi_datatype_get_true_extent( const ompi_datatype_t* type, OPAL_PTRDIFF_TYPE* t
return opal_datatype_get_true_extent( &type->super, true_lb, true_extent);
}
static inline int32_t
static inline ssize_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 )
ompi_datatype_set_element_count( const ompi_datatype_t* type, size_t count, size_t* length )
{
return opal_datatype_set_element_count( &type->super, count, length );
}
@ -366,6 +366,16 @@ ompi_datatype_create_from_packed_description( void** packed_buffer,
*/
OMPI_DECLSPEC int32_t ompi_datatype_print_args( const ompi_datatype_t* pData );
/**
* Get the number of basic elements of the datatype in ucount
*
* @returns OMPI_SUCCESS if the count is valid
* @returns OMPI_ERR_VALUE_OUT_OF_BOUNDS if no
*/
OMPI_DECLSPEC int ompi_datatype_get_elements (ompi_datatype_t *datatype, size_t ucount,
size_t *count);
#if OPAL_ENABLE_DEBUG
/*
* Set a breakpoint to this function in your favorite debugger

77
ompi/datatype/ompi_datatype_get_elements.c Обычный файл
Просмотреть файл

@ -0,0 +1,77 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2010 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include <limits.h>
#include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/datatype/ompi_datatype.h"
int ompi_datatype_get_elements (ompi_datatype_t *datatype, size_t ucount, size_t *count)
{
size_t internal_count, size, total;
int rc, i;
*count = 0;
if (OMPI_SUCCESS != (rc = ompi_datatype_type_size (datatype, &size))) {
return OMPI_ERR_BAD_PARAM;
}
if (size == 0) {
/* If the size of the datatype is zero let's return a count of zero */
return OMPI_SUCCESS;
}
internal_count = ucount / size; /* how many full types? */
size = ucount - internal_count * size; /* leftover bytes */
/* if basic type we should return the same result as MPI_Get_count (internal_count) if
there are no leftover bytes */
if (!ompi_datatype_is_predefined(datatype)) {
if (0 != internal_count) {
/* count the basic elements in the datatype */
for (i = 4, total = 0 ; i < OPAL_DATATYPE_MAX_PREDEFINED ; ++i) {
total += datatype->super.btypes[i];
}
internal_count = total * internal_count;
}
if (size > 0) {
/* If there are any leftover bytes, compute the number of predefined
* types in the datatype that can fit in these bytes.
*/
if (-1 == (i = ompi_datatype_get_element_count (datatype, size))) {
return OMPI_ERR_VALUE_OUT_OF_BOUNDS;
}
internal_count += i;
}
} else if (0 != size) {
/* no leftover is supported for predefined types */
return OMPI_ERR_VALUE_OUT_OF_BOUNDS;
}
*count = internal_count;
return OMPI_SUCCESS;
}

Просмотреть файл

@ -89,11 +89,25 @@
#define OMPI_DATATYPE_MPI_LB 0x2C
#define OMPI_DATATYPE_MPI_UB 0x2D
/*
* Datatypes from the MPI 3.0 standard
*/
#define OMPI_DATATYPE_MPI_COUNT 0x2E
/* This should __ALWAYS__ stay last */
#define OMPI_DATATYPE_MPI_UNAVAILABLE 0x2E
#define OMPI_DATATYPE_MPI_UNAVAILABLE 0x2F
#define OMPI_DATATYPE_MPI_MAX_PREDEFINED (OMPI_DATATYPE_MPI_UNAVAILABLE+1)
/*
* Ensure we can support the predefined datatypes.
*/
#if OMPI_DATATYPE_MAX_PREDEFINED < OMPI_DATATYPE_MPI_UNAVAILABLE
#error OMPI_DATATYPE_MAX_PREDEFINED should be updated to the value of OMPI_DATATYPE_MPI_UNAVAILABLE
#endif
/*
* Mapped types. The following types have basic equivalents in OPAL. Instead
* of being redefined as independent types, they will be made synonyms to

Просмотреть файл

@ -274,6 +274,18 @@ ompi_predefined_datatype_t ompi_mpi_c_long_double_complex = OMPI_DATATYPE_INIT_D
ompi_predefined_datatype_t ompi_mpi_c_long_double_complex = OMPI_DATATYPE_INIT_UNAVAILABLE (LONG_DOUBLE_COMPLEX, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_COMPLEX );
#endif /* HAVE_LONG_DOUBLE */
/*
* MPI 3.0 Datatypes
*/
#if OMPI_MPI_COUNT_SIZE == 4
ompi_predefined_datatype_t ompi_mpi_count = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE(INT32_T, COUNT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT);
#elif OMPI_MPI_COUNT_SIZE == 8
ompi_predefined_datatype_t ompi_mpi_count = OMPI_DATATYPE_INIT_PREDEFINED_BASIC_TYPE(INT64_T, COUNT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT);
#else
ompi_predefined_datatype_t ompi_mpi_count = OMPI_DATATYPE_INIT_UNAVAILABLE_BASIC_TYPE(INT64_T, COUNT, OMPI_DATATYPE_FLAG_DATA_C | OMPI_DATATYPE_FLAG_DATA_INT);
#endif
/*
* NOTE: The order of this array *MUST* match what is listed in
* opal_datatype_internal.h and ompi_datatype_internal.h
@ -335,7 +347,11 @@ const ompi_datatype_t* ompi_datatype_basicDatatypes[OMPI_DATATYPE_MPI_MAX_PREDEF
&ompi_mpi_lb.dt, /* 0x2C */
&ompi_mpi_ub.dt, /* 0x2D */
&ompi_mpi_unavailable.dt, /* 0x2E */
/* MPI 3.0 types */
&ompi_mpi_count.dt, /* 0x2E */
&ompi_mpi_unavailable.dt, /* 0x2F */
};
opal_pointer_array_t ompi_datatype_f_to_c_table;
@ -633,6 +649,9 @@ int32_t ompi_datatype_init( void )
MOOG(aint, 66);
MOOG(offset, 67);
/* MPI 3.0 types */
MOOG(count, 68);
/**
* Now make sure all non-contiguous types are marked as such.
*/

Просмотреть файл

@ -237,7 +237,7 @@ typedef struct
int MPI_TAG;
int MPI_ERROR;
int _cancelled;
int _ucount; /* size_t */
size_t _ucount;
} offset;
} ompi_status_public_t;
/* datatype structure */

Просмотреть файл

@ -13,7 +13,7 @@
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2009-2012 Oak Rigde National Laboratory. All rights reserved.
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2012 Los Alamos Nat Security, LLC. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos Nat Security, LLC. All rights reserved.
* Copyright (c) 2011-2013 INRIA. All rights reserved.
* $COPYRIGHT$
*
@ -146,6 +146,12 @@
/* Size of the MPI_Offset corresponding type */
#undef OMPI_MPI_OFFSET_SIZE
/* Type of MPI_Count */
#undef OMPI_MPI_COUNT_TYPE
/* Size of MPI_Count */
#undef OMPI_MPI_COUNT_SIZE
/* type to use for ptrdiff_t, if it does not exist, set to ptrdiff_t if it does exist */
#undef OPAL_PTRDIFF_TYPE
@ -316,6 +322,7 @@ extern "C" {
typedef OPAL_PTRDIFF_TYPE MPI_Aint;
typedef OMPI_MPI_OFFSET_TYPE MPI_Offset;
typedef OMPI_MPI_COUNT_TYPE MPI_Count;
typedef struct ompi_communicator_t *MPI_Comm;
typedef struct ompi_datatype_t *MPI_Datatype;
typedef struct ompi_errhandler_t *MPI_Errhandler;
@ -968,6 +975,7 @@ OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_int64_t;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_uint64_t;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_aint;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_offset;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_count;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_c_bool;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_c_complex;
OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_c_float_complex;
@ -1129,6 +1137,9 @@ OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE;
#define MPI_CXX_DOUBLE_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_dblcplex)
#define MPI_CXX_LONG_DOUBLE_COMPLEX OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_cxx_ldblcplex)
/* New datatypes from the 3.0 standard */
#define MPI_COUNT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_count)
#define MPI_ERRORS_ARE_FATAL OMPI_PREDEFINED_GLOBAL(MPI_Errhandler, ompi_mpi_errors_are_fatal)
#define MPI_ERRORS_RETURN OMPI_PREDEFINED_GLOBAL(MPI_Errhandler, ompi_mpi_errors_return)
@ -1409,6 +1420,7 @@ OMPI_DECLSPEC int MPI_Igatherv(void *sendbuf, int sendcount, MPI_Datatype sendt
OMPI_DECLSPEC int MPI_Get_address(void *location, MPI_Aint *address);
OMPI_DECLSPEC int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count);
OMPI_DECLSPEC int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count);
OMPI_DECLSPEC int MPI_Get_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Count *count);
OMPI_DECLSPEC int MPI_Get(void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, int target_count,
@ -1603,6 +1615,8 @@ OMPI_DECLSPEC int MPI_Status_f2c(MPI_Fint *f_status, MPI_Status *c_status);
OMPI_DECLSPEC int MPI_Status_set_cancelled(MPI_Status *status, int flag);
OMPI_DECLSPEC int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype,
int count);
OMPI_DECLSPEC int MPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype,
MPI_Count count);
OMPI_DECLSPEC int MPI_Testall(int count, MPI_Request array_of_requests[], int *flag,
MPI_Status array_of_statuses[]);
OMPI_DECLSPEC int MPI_Testany(int count, MPI_Request array_of_requests[], int *index,
@ -1671,10 +1685,14 @@ OMPI_DECLSPEC int MPI_Type_get_envelope(MPI_Datatype type, int *num_integers,
int *combiner);
OMPI_DECLSPEC int MPI_Type_get_extent(MPI_Datatype type, MPI_Aint *lb,
MPI_Aint *extent);
OMPI_DECLSPEC int MPI_Type_get_extent_x(MPI_Datatype type, MPI_Count *lb,
MPI_Count *extent);
OMPI_DECLSPEC int MPI_Type_get_name(MPI_Datatype type, char *type_name,
int *resultlen);
OMPI_DECLSPEC int MPI_Type_get_true_extent(MPI_Datatype datatype, MPI_Aint *true_lb,
MPI_Aint *true_extent);
OMPI_DECLSPEC int MPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count *true_lb,
MPI_Count *true_extent);
OMPI_DECLSPEC int MPI_Type_hindexed(int count, int array_of_blocklengths[],
MPI_Aint array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype *newtype)
@ -1692,6 +1710,7 @@ OMPI_DECLSPEC int MPI_Type_set_attr(MPI_Datatype type, int type_keyval,
void *attr_val);
OMPI_DECLSPEC int MPI_Type_set_name(MPI_Datatype type, char *type_name);
OMPI_DECLSPEC int MPI_Type_size(MPI_Datatype type, int *size);
OMPI_DECLSPEC int MPI_Type_size_x(MPI_Datatype type, MPI_Count *size);
OMPI_DECLSPEC int MPI_Type_struct(int count, int array_of_blocklengths[],
MPI_Aint array_of_displacements[],
MPI_Datatype array_of_types[],
@ -2020,6 +2039,8 @@ OMPI_DECLSPEC int PMPI_Get_address(void *location, MPI_Aint *address);
OMPI_DECLSPEC int PMPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count);
OMPI_DECLSPEC int PMPI_Get_elements(MPI_Status *status, MPI_Datatype datatype,
int *count);
OMPI_DECLSPEC int PMPI_Get_elements_x(MPI_Status *status, MPI_Datatype datatype,
MPI_Count *count);
OMPI_DECLSPEC int PMPI_Get(void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, int target_count,
@ -2214,6 +2235,8 @@ OMPI_DECLSPEC int PMPI_Status_f2c(MPI_Fint *f_status, MPI_Status *c_status);
OMPI_DECLSPEC int PMPI_Status_set_cancelled(MPI_Status *status, int flag);
OMPI_DECLSPEC int PMPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype,
int count);
OMPI_DECLSPEC int PMPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype,
MPI_Count count);
OMPI_DECLSPEC int PMPI_Testall(int count, MPI_Request array_of_requests[], int *flag,
MPI_Status array_of_statuses[]);
OMPI_DECLSPEC int PMPI_Testany(int count, MPI_Request array_of_requests[], int *index, int *flag, MPI_Status *status);
@ -2281,10 +2304,14 @@ OMPI_DECLSPEC int PMPI_Type_get_envelope(MPI_Datatype type, int *num_integers,
int *combiner);
OMPI_DECLSPEC int PMPI_Type_get_extent(MPI_Datatype type, MPI_Aint *lb,
MPI_Aint *extent);
OMPI_DECLSPEC int PMPI_Type_get_extent_x(MPI_Datatype type, MPI_Count *lb,
MPI_Count *extent);
OMPI_DECLSPEC int PMPI_Type_get_name(MPI_Datatype type, char *type_name,
int *resultlen);
OMPI_DECLSPEC int PMPI_Type_get_true_extent(MPI_Datatype datatype, MPI_Aint *true_lb,
MPI_Aint *true_extent);
OMPI_DECLSPEC int PMPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count *true_lb,
MPI_Count *true_extent);
OMPI_DECLSPEC int PMPI_Type_hindexed(int count, int array_of_blocklengths[],
MPI_Aint array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype *newtype)
@ -2302,6 +2329,7 @@ OMPI_DECLSPEC int PMPI_Type_set_attr(MPI_Datatype type, int type_keyval,
void *attr_val);
OMPI_DECLSPEC int PMPI_Type_set_name(MPI_Datatype type, char *type_name);
OMPI_DECLSPEC int PMPI_Type_size(MPI_Datatype type, int *size);
OMPI_DECLSPEC int PMPI_Type_size_x(MPI_Datatype type, MPI_Count *size);
OMPI_DECLSPEC int PMPI_Type_struct(int count, int array_of_blocklengths[],
MPI_Aint array_of_displacements[],
MPI_Datatype array_of_types[],

Просмотреть файл

@ -156,6 +156,7 @@ libmpi_c_mpi_la_SOURCES = \
get_address.c \
get_count.c \
get_elements.c \
get_elements_x.c \
get_library_version.c \
get_processor_name.c \
get_version.c \
@ -260,6 +261,7 @@ libmpi_c_mpi_la_SOURCES = \
status_f2c.c \
status_set_cancelled.c \
status_set_elements.c \
status_set_elements_x.c \
testall.c \
testany.c \
test.c \
@ -291,8 +293,10 @@ libmpi_c_mpi_la_SOURCES = \
type_get_contents.c \
type_get_envelope.c \
type_get_extent.c \
type_get_extent_x.c \
type_get_name.c \
type_get_true_extent.c \
type_get_true_extent_x.c \
type_hindexed.c \
type_hvector.c \
type_indexed.c \
@ -301,6 +305,7 @@ libmpi_c_mpi_la_SOURCES = \
type_set_attr.c \
type_set_name.c \
type_size.c \
type_size_x.c \
type_struct.c \
type_ub.c \
type_vector.c \

Просмотреть файл

@ -69,16 +69,9 @@ int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count)
*count = 0;
} else {
internal_count = status->_ucount / size; /* count the number of complete datatypes */
if( (internal_count * size) != status->_ucount ) {
if( (internal_count * size) != status->_ucount ||
internal_count > ((size_t) INT_MAX) ) {
*count = MPI_UNDEFINED;
} else if( internal_count > ((size_t)INT_MAX) ) {
/* We have more elements that we can represent with a
* signed int, and therefore we're outside the
* standard here. I don't see what should we report
* back here to make it useful. So, let's return an
* untouched *count and trigger an MPI_ERR_TRUNCATE.
*/
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TRUNCATE, FUNC_NAME);
} else {
*count = (int)internal_count;
}

Просмотреть файл

@ -9,12 +9,15 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include <limits.h>
@ -36,11 +39,10 @@
static const char FUNC_NAME[] = "MPI_Get_elements";
int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count)
int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count)
{
size_t size, internal_count;
int i;
size_t internal_count;
int ret;
OPAL_CR_NOOP_PROGRESS();
@ -70,51 +72,19 @@ int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count)
OMPI_ERRHANDLER_CHECK(err, MPI_COMM_WORLD, err, FUNC_NAME);
}
*count = 0;
if( ompi_datatype_type_size( datatype, &size ) == MPI_SUCCESS ) {
if( size == 0 ) {
/* If the size of the datatype is zero let's return a count of zero */
return MPI_SUCCESS;
}
internal_count = status->_ucount / size; /* how many full types? */
size = status->_ucount - internal_count * size; /* leftover bytes */
/* if basic type we should return the same result as MPI_Get_count */
if( ompi_datatype_is_predefined(datatype) ) {
if( size != 0 ) { /* no leftover is supported for predefined types */
*count = MPI_UNDEFINED;
}
goto more_than_int_elements;
}
if( internal_count != 0 ) {
size_t total = 0; /* count the basic elements in the datatype */
for( i = 4; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) {
total += datatype->super.btypes[i];
}
internal_count = total * internal_count;
}
if( size > 0 ) {
/* If there are any leftover bytes, compute the number of predefined
* types in the datatype that can fit in these bytes.
ret = ompi_datatype_get_elements (datatype, status->_ucount, &internal_count);
if (OMPI_SUCCESS == ret || OMPI_ERR_VALUE_OUT_OF_BOUNDS == ret) {
if (OMPI_SUCCESS == ret && internal_count <= INT_MAX) {
*count = internal_count;
} else {
/* If we have more elements that we can represent with a signed int then we must
* set count to MPI_UNDEFINED (MPI 3.0).
*/
if( (i = ompi_datatype_get_element_count( datatype, size )) != -1 )
internal_count += i;
else {
*count = MPI_UNDEFINED;
return MPI_SUCCESS;
}
*count = MPI_UNDEFINED;
}
goto more_than_int_elements;
return MPI_SUCCESS;
}
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
more_than_int_elements:
if( internal_count > ((size_t)INT_MAX) ) {
/* We have more elements that we can represent with a signed int, and therefore
* we're outside the standard here. I don't see what should we report back
* here to make it useful. So, let's return an untouched *count and trigger
* an MPI_ERR_TRUNCATE.
*/
return MPI_ERR_TRUNCATE;
}
*count = (int)internal_count;
return MPI_SUCCESS;
}

91
ompi/mpi/c/get_elements_x.c Обычный файл
Просмотреть файл

@ -0,0 +1,91 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2010 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include <limits.h>
#include "ompi/mpi/c/bindings.h"
#include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/datatype/ompi_datatype.h"
#include "ompi/memchecker.h"
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Get_elements_x = PMPI_Get_elements_x
#endif
#if OMPI_PROFILING_DEFINES
#include "ompi/mpi/c/profile/defines.h"
#endif
static const char FUNC_NAME[] = "MPI_Get_elements_x";
int MPI_Get_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Count *count)
{
size_t internal_count;
int ret;
OPAL_CR_NOOP_PROGRESS();
MEMCHECKER(
if (status != MPI_STATUSES_IGNORE) {
/*
* Before checking the complete status, we need to reset the definedness
* of the MPI_ERROR-field (single-completion calls wait/test).
*/
opal_memchecker_base_mem_defined(&status->MPI_ERROR, sizeof(int));
memchecker_status(status);
memchecker_datatype(datatype);
}
);
if (MPI_PARAM_CHECK) {
int err = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == status || MPI_STATUSES_IGNORE == status ||
MPI_STATUS_IGNORE == status || NULL == count) {
err = MPI_ERR_ARG;
} else if (NULL == datatype || MPI_DATATYPE_NULL == datatype) {
err = MPI_ERR_TYPE;
} else {
OMPI_CHECK_DATATYPE_FOR_RECV(err, datatype, 1);
}
OMPI_ERRHANDLER_CHECK(err, MPI_COMM_WORLD, err, FUNC_NAME);
}
ret = ompi_datatype_get_elements (datatype, status->_ucount, &internal_count);
if (OMPI_SUCCESS == ret || OMPI_ERR_VALUE_OUT_OF_BOUNDS == ret) {
if (OMPI_SUCCESS == ret && internal_count <= (size_t) SSIZE_MAX) {
*count = internal_count;
} else {
/* If we have more elements that we can represent with an MPI_Count then we must
* set count to MPI_UNDEFINED (MPI 3.0).
*/
*count = MPI_UNDEFINED;
}
return MPI_SUCCESS;
}
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
}

Просмотреть файл

@ -138,6 +138,7 @@ nodist_libmpi_c_pmpi_la_SOURCES = \
pget_address.c \
pget_count.c \
pget_elements.c \
pget_elements_x.c \
pget_library_version.c \
pget_processor_name.c \
pget_version.c \
@ -242,6 +243,7 @@ nodist_libmpi_c_pmpi_la_SOURCES = \
pstatus_f2c.c \
pstatus_set_cancelled.c \
pstatus_set_elements.c \
pstatus_set_elements_x.c \
ptestall.c \
ptestany.c \
ptest.c \
@ -273,8 +275,10 @@ nodist_libmpi_c_pmpi_la_SOURCES = \
ptype_get_contents.c \
ptype_get_envelope.c \
ptype_get_extent.c \
ptype_get_extent_x.c \
ptype_get_name.c \
ptype_get_true_extent.c \
ptype_get_true_extent_x.c \
ptype_hindexed.c \
ptype_hvector.c \
ptype_indexed.c \
@ -283,6 +287,7 @@ nodist_libmpi_c_pmpi_la_SOURCES = \
ptype_set_attr.c \
ptype_set_name.c \
ptype_size.c \
ptype_size_x.c \
ptype_struct.c \
ptype_ub.c \
ptype_vector.c \

Просмотреть файл

@ -181,6 +181,7 @@
#define MPI_Get_address PMPI_Get_address
#define MPI_Get_count PMPI_Get_count
#define MPI_Get_elements PMPI_Get_elements
#define MPI_Get_elements_x PMPI_Get_elements_x
#define MPI_Get PMPI_Get
#define MPI_Get_library_version PMPI_Get_library_version
#define MPI_Get_processor_name PMPI_Get_processor_name
@ -289,7 +290,8 @@
#define MPI_Status_c2f PMPI_Status_c2f
#define MPI_Status_f2c PMPI_Status_f2c
#define MPI_Status_set_cancelled PMPI_Status_set_cancelled
#define MPI_Status_set_elements PMPI_Status_set_elements
#define MPI_Status_set_elements PMPI_Status_set_elements
#define MPI_Status_set_elements_x PMPI_Status_set_elements_x
#define MPI_Test_cancelled PMPI_Test_cancelled
#define MPI_Test PMPI_Test
#define MPI_Testall PMPI_Testall
@ -321,8 +323,10 @@
#define MPI_Type_get_contents PMPI_Type_get_contents
#define MPI_Type_get_envelope PMPI_Type_get_envelope
#define MPI_Type_get_extent PMPI_Type_get_extent
#define MPI_Type_get_extent_x PMPI_Type_get_extent_x
#define MPI_Type_get_name PMPI_Type_get_name
#define MPI_Type_get_true_extent PMPI_Type_get_true_extent
#define MPI_Type_get_true_extent_x PMPI_Type_get_true_extent_x
#define MPI_Type_hindexed PMPI_Type_hindexed
#define MPI_Type_hvector PMPI_Type_hvector
#define MPI_Type_indexed PMPI_Type_indexed
@ -331,6 +335,7 @@
#define MPI_Type_set_attr PMPI_Type_set_attr
#define MPI_Type_set_name PMPI_Type_set_name
#define MPI_Type_size PMPI_Type_size
#define MPI_Type_size_x PMPI_Type_size_x
#define MPI_Type_struct PMPI_Type_struct
#define MPI_Type_ub PMPI_Type_ub
#define MPI_Type_vector PMPI_Type_vector

Просмотреть файл

@ -10,12 +10,15 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
@ -36,9 +39,7 @@
static const char FUNC_NAME[] = "MPI_Status_set_elements";
int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype,
int count)
int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype, int count)
{
int rc = MPI_SUCCESS;
size_t size;

85
ompi/mpi/c/status_set_elements_x.c Обычный файл
Просмотреть файл

@ -0,0 +1,85 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2010 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "ompi/mpi/c/bindings.h"
#include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/datatype/ompi_datatype.h"
#include "ompi/memchecker.h"
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Status_set_elements_x = PMPI_Status_set_elements_x
#endif
#if OMPI_PROFILING_DEFINES
#include "ompi/mpi/c/profile/defines.h"
#endif
static const char FUNC_NAME[] = "MPI_Status_set_elements_x";
int MPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Count count)
{
int rc = MPI_SUCCESS;
size_t size;
MEMCHECKER(
if(status != MPI_STATUSES_IGNORE) {
/*
* Before checking the complete status, we need to reset the definedness
* of the MPI_ERROR-field (single-completion calls wait/test).
*/
opal_memchecker_base_mem_defined(&status->MPI_ERROR, sizeof(int));
memchecker_status (status);
memchecker_datatype(datatype);
}
);
OPAL_CR_NOOP_PROGRESS();
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == datatype || MPI_DATATYPE_NULL == datatype) {
rc = MPI_ERR_TYPE;
} else if (count < 0) {
rc = MPI_ERR_COUNT;
}
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}
/* ROMIO calls MPI_STATUS_SET_ELEMENTS with IGNORE values, so we
need to allow it. Blah! */
if (MPI_STATUS_IGNORE == status || MPI_STATUSES_IGNORE == status) {
return MPI_SUCCESS;
}
if( ompi_datatype_is_predefined(datatype) ) {
ompi_datatype_type_size( datatype, &size );
status->_ucount = count * size;
} else {
ompi_datatype_set_element_count( datatype, count, &size );
status->_ucount = size;
}
return MPI_SUCCESS;
}

Просмотреть файл

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -35,7 +37,6 @@
static const char FUNC_NAME[] = "MPI_Type_get_extent";
int MPI_Type_get_extent(MPI_Datatype type, MPI_Aint *lb, MPI_Aint *extent)
{
int rc;

67
ompi/mpi/c/type_get_extent_x.c Обычный файл
Просмотреть файл

@ -0,0 +1,67 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "ompi/mpi/c/bindings.h"
#include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/datatype/ompi_datatype.h"
#include "ompi/memchecker.h"
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Type_get_extent_x = PMPI_Type_get_extent_x
#endif
#if OMPI_PROFILING_DEFINES
#include "ompi/mpi/c/profile/defines.h"
#endif
static const char FUNC_NAME[] = "MPI_Type_get_extent_x";
int MPI_Type_get_extent_x(MPI_Datatype type, MPI_Count *lb, MPI_Count *extent)
{
MPI_Aint alb, aextent;
int rc;
MEMCHECKER(
memchecker_datatype(type);
);
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == type || MPI_DATATYPE_NULL == type) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME);
} else if (NULL == lb || NULL == extent) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
}
}
OPAL_CR_ENTER_LIBRARY();
rc = ompi_datatype_get_extent( type, &alb, &aextent );
if (OMPI_SUCCESS == rc) {
*lb = ((size_t) alb > MPI_COUNT_MAX) ? MPI_UNDEFINED : alb;
*extent = ((size_t) aextent > MPI_COUNT_MAX) ? MPI_UNDEFINED : aextent;
}
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME );
}

Просмотреть файл

@ -9,6 +9,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -35,9 +37,8 @@
static const char FUNC_NAME[] = "MPI_Type_get_true_extent";
int MPI_Type_get_true_extent(MPI_Datatype datatype,
MPI_Aint *true_lb,
MPI_Aint *true_lb,
MPI_Aint *true_extent)
{
int rc;

71
ompi/mpi/c/type_get_true_extent_x.c Обычный файл
Просмотреть файл

@ -0,0 +1,71 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "ompi/mpi/c/bindings.h"
#include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/datatype/ompi_datatype.h"
#include "ompi/memchecker.h"
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Type_get_true_extent_x = PMPI_Type_get_true_extent_x
#endif
#if OMPI_PROFILING_DEFINES
#include "ompi/mpi/c/profile/defines.h"
#endif
static const char FUNC_NAME[] = "MPI_Type_get_true_extent_x";
int MPI_Type_get_true_extent_x(MPI_Datatype datatype,
MPI_Count *true_lb,
MPI_Count *true_extent)
{
MPI_Aint atrue_lb, atrue_extent;
int rc;
MEMCHECKER(
memchecker_datatype(datatype);
);
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == datatype || MPI_DATATYPE_NULL == datatype) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE,
FUNC_NAME );
} else if (NULL == true_lb || NULL == true_extent) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
FUNC_NAME );
}
}
OPAL_CR_ENTER_LIBRARY();
rc = ompi_datatype_get_true_extent( datatype, &atrue_lb, &atrue_extent );
if (OMPI_SUCCESS == rc) {
*true_lb = ((size_t) atrue_lb > MPI_COUNT_MAX) ? MPI_UNDEFINED : atrue_lb;
*true_extent = ((size_t) atrue_extent > MPI_COUNT_MAX) ? MPI_UNDEFINED : atrue_extent;
}
OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME );
}

Просмотреть файл

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -10,6 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -36,7 +39,6 @@
static const char FUNC_NAME[] = "MPI_Type_size";
int MPI_Type_size(MPI_Datatype type, int *size)
{
size_t type_size;
@ -57,7 +59,7 @@ int MPI_Type_size(MPI_Datatype type, int *size)
opal_datatype_type_size ( &type->super, &type_size);
*size = type_size;
*size = (type_size > (size_t) INT_MAX) ? MPI_UNDEFINED : (int) type_size;
return MPI_SUCCESS;
}

65
ompi/mpi/c/type_size_x.c Обычный файл
Просмотреть файл

@ -0,0 +1,65 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "ompi/mpi/c/bindings.h"
#include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h"
#include "ompi/errhandler/errhandler.h"
#include "ompi/datatype/ompi_datatype.h"
#include "ompi/memchecker.h"
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Type_size_x = PMPI_Type_size_x
#endif
#if OMPI_PROFILING_DEFINES
#include "ompi/mpi/c/profile/defines.h"
#endif
static const char FUNC_NAME[] = "MPI_Type_size_x";
int MPI_Type_size_x(MPI_Datatype type, MPI_Count *size)
{
size_t type_size;
MEMCHECKER(
memchecker_datatype(type);
);
OPAL_CR_NOOP_PROGRESS();
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == type || MPI_DATATYPE_NULL == type) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TYPE, FUNC_NAME);
} else if (NULL == size) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
}
}
opal_datatype_type_size ( &type->super, &type_size);
*size = (type_size > (size_t) MPI_COUNT_MAX) ? MPI_UNDEFINED : (MPI_Count) type_size;
return MPI_SUCCESS;
}

Просмотреть файл

@ -1,9 +1,10 @@
.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved.
.\" Copyright 2010 Cisco Systems, Inc. All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.TH MPI_Get_elements 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Get_elements \fP \- Returns the number of basic elements in a data type.
\fBMPI_Get_elements, MPI_Get_elements_x\fP \- Returns the number of basic elements in a data type.
.SH SYNTAX
.ft R
@ -12,6 +13,8 @@
#include <mpi.h>
int MPI_Get_elements(MPI_Status *\fIstatus\fP, MPI_Datatype\fI datatype\fP,
int\fI *count\fP)
int MPI_Get_elements_x(MPI_Status *\fIstatus\fP, MPI_Datatype\fI datatype\fP,
MPI_Count\fI *count\fP)
.fi
.SH Fortran Syntax
@ -19,6 +22,10 @@ int MPI_Get_elements(MPI_Status *\fIstatus\fP, MPI_Datatype\fI datatype\fP,
INCLUDE 'mpif.h'
MPI_GET_ELEMENTS(\fISTATUS, DATATYPE, COUNT, IERROR\fP)
INTEGER \fISTATUS(MPI_STATUS_SIZE), DATATYPE, COUNT, IERROR\fP
MPI_GET_ELEMENTS_X(\fISTATUS, DATATYPE, COUNT, IERROR\fP)
INTEGER \fISTATUS(MPI_STATUS_SIZE), DATATYPE\fP
INTEGER(KIND=MPI_COUNT_KIND) \fICOUNT\fP
INTEGER \fIIERROR\fP
.fi
.SH C++ Syntax
@ -46,7 +53,7 @@ Fortran only: Error status (integer).
.SH DESCRIPTION
.ft R
MPI_Get_elements behaves different from MPI_Get_count, which returns the number of "top-level entries" received, i.e., the number of "copies" of type datatype. MPI_Get_count may return any integer value k, where 0 =< k =< count. If MPI_Get_count returns k, then the number of basic elements received (and the value returned by MPI_Get_elements) is n * k, where n is the number of basic elements in the type map of datatype. If the number of basic elements received is not a multiple of n, that is, if the receive operation has not received an integral number of datatype "copies," then MPI_Get_count returns the value MPI_UNDEFINED.
MPI_Get_elements and MPI_Get_elements_x behave different from MPI_Get_count, which returns the number of "top-level entries" received, i.e., the number of "copies" of type datatype. MPI_Get_count may return any integer value k, where 0 =< k =< count. If MPI_Get_count returns k, then the number of basic elements received (and the value returned by MPI_Get_elements and MPI_Get_elements_x) is n * k, where n is the number of basic elements in the type map of datatype. If the number of basic elements received is not a multiple of n, that is, if the receive operation has not received an integral number of datatype "copies," then MPI_Get_count returns the value MPI_UNDEFINED. For both functions, if the \fIcount\fP parameter cannot express the value to be returned (e.g., if the parameter is too small to hold the output value), it is set to MPI_UNDEFINED.
.sp
\fBExample:\fP Usage of MPI_Get_count and MPI_Get_element:
.sp
@ -77,6 +84,19 @@ Almost all MPI routines return an error value; C routines as the value of the fu
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.
.SH FORTRAN 77 NOTES
.ft R
The MPI standard prescribes portable Fortran syntax for
the \fICOUNT\fP argument of MPI_Get_elements_x only for
Fortran 90. FORTRAN 77 users may use the non-portable syntax
.sp
.nf
INTEGER*MPI_COUNT_KIND \fICOUNT\fP
.fi
.sp
where MPI_COUNT_KIND is a constant defined in mpif.h
and gives the length of the declared integer in bytes.
.SH SEE ALSO
.ft R
.sp

1
ompi/mpi/man/man3/MPI_Get_elements_x.3in Обычный файл
Просмотреть файл

@ -0,0 +1 @@
.so man3/MPI_Get_elements.3

Просмотреть файл

@ -1,9 +1,10 @@
.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved.
.\" Copyright 2010 Cisco Systems, Inc. All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines
.TH MPI_Status_set_elements 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Status_set_elements\fP \- Modifies opaque part of \fIstatus\fP to allow MPI_Get_elements to return \fIcount\fP.
\fBMPI_Status_set_elements\fP, \fBMPI_Status_set_elements_x\fP \- Modifies opaque part of \fIstatus\fP to allow MPI_Get_elements to return \fIcount\fP.
.SH SYNTAX
.ft R
@ -11,6 +12,7 @@
.nf
#include <mpi.h>
int MPI_Status_set_elements(MPI_Status *\fIstatus\fP, MPI_Datatype \fIdatatype\fP, int \fIcount\fP)
int MPI_Status_set_elements_x(MPI_Status *\fIstatus\fP, MPI_Datatype \fIdatatype\fP, MPI_Count \fIcount\fP)
.fi
.SH Fortran Syntax
@ -18,6 +20,10 @@ int MPI_Status_set_elements(MPI_Status *\fIstatus\fP, MPI_Datatype \fIdatatype\f
INCLUDE 'mpif.h'
MPI_STATUS_SET_ELEMENTS(\fISTATUS, DATATYPE, COUNT, IERROR\fP)
INTEGER \fISTATUS\fP(MPI_STATUS_SIZE), DATATYPE, COUNT, IERROR\fP
MPI_STATUS_SET_ELEMENTS_X(\fISTATUS, DATATYPE, COUNT, IERROR\fP)
INTEGER \fISTATUS\fP(MPI_STATUS_SIZE), DATATYPE\fP
INTEGER(KIND=MPI_COUNT_KIND) \fICOUNT\fP
INTEGER \fIIERROR\fP
.fi
.SH C++ Syntax
@ -49,9 +55,9 @@ Fortran only: Error status (integer).
.SH DESCRIPTION
.ft R
MPI_Status_set_elements modifies the opaque part of \fIstatus\fP so that a call to MPI_Get_elements will return \fIcount\fP. MPI_Get_count will return a compatible value.
MPI_Status_set_elements modifies the opaque part of \fIstatus\fP so that a call to MPI_Get_elements or MPI_Get_elements_x will return \fIcount\fP. MPI_Get_count will return a compatible value.
.sp
A subsequent call to MPI_Get_count(\fIstatus, datatype, count\fP) or to MPI_Get_elements(\fIstatus, datatype, count\fP) must use a data-type argument that has the same type signature as the data-type argument that was used in the call to MPI_Status_set_elements.
A subsequent call to MPI_Get_count(\fIstatus, datatype, count\fP), to MPI_Get_elements(\fIstatus, datatype, count\fP), or to MPI_Get_elements_x(\fIstatus, datatype, count\fP) must use a data-type argument that has the same type signature as the data-type argument that was used in the call to MPI_Status_set_elements.
.SH NOTES
.ft R
@ -63,3 +69,11 @@ Almost all MPI routines return an error value; C routines as the value of the fu
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.
.SH FORTRAN 77 NOTES
.ft R
The MPI standard prescribes portable Fortran syntax for the \fICOUNT\fP argument of MPI_Status_set_elements_x only for Fortran 90. FORTRAN 77 users may use the non-portable syntax
.sp
.nf
INTEGER*MPI_COUNT_KIND \fICOUNT\fP
.sp
where MPI_COUNT_KIND is a constant defined in mpif.h and gives the length of the declared integer in bytes.

Просмотреть файл

@ -0,0 +1 @@
.so man3/MPI_Status_set_elements.3

Просмотреть файл

@ -1,9 +1,10 @@
.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved.
.\" Copyright 2010 Cisco Systems, Inc. All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.TH MPI_Type_get_extent 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Type_get_extent\fP \- Returns the lower bound and extent of a data type.
\fBMPI_Type_get_extent\fP, \fBMPI_Type_get_extent_x\fP \- Returns the lower bound and extent of a data type.
.SH SYNTAX
.ft R
@ -12,6 +13,8 @@
#include <mpi.h>
int MPI_Type_get_extent(MPI_Datatype \fIdatatype\fP, MPI_Aint\fI *lb\fP,
MPI_Aint *\fIextent\fP)
int MPI_Type_get_extent_x(MPI_Datatype \fIdatatype\fP, MPI_Count\fI *lb\fP,
MPI_Count *\fIextent\fP)
.fi
.SH Fortran Syntax (see FORTRAN 77 NOTES)
@ -20,6 +23,9 @@ INCLUDE 'mpif.h'
MPI_TYPE_GET_EXTENT(\fIDATATYPE, LB, EXTENT, IERROR\fP)
INTEGER \fIDATATYPE, IERROR\fP
INTEGER(KIND=MPI_ADDRESS_KIND) \fILB, EXTENT\fP
MPI_TYPE_GET_EXTENT_X(\fIDATATYPE, LB, EXTENT, IERROR\fP)
INTEGER \fIDATATYPE, IERROR\fP
INTEGER(KIND=MPI_COUNT_KIND) \fILB, EXTENT\fP
.fi
.SH C++ Syntax
@ -50,7 +56,7 @@ Fortran only: Error status (integer).
.SH DESCRIPTION
.ft R
MPI_Type_get_extent returns the lower bound and the extent of \fIdatatype\fP.
MPI_Type_get_extent returns the lower bound and the extent of \fIdatatype\fP. For either function, if either the \fIlb\fP or \fIextent\fP parameter cannot express the value to be returned (e.g., if the parameter is too small to hold the output value), it is set to MPI_UNDEFINED.
.SH NOTE
.ft R
@ -62,19 +68,27 @@ The MPI standard prescribes portable Fortran syntax for
the \fILB\fP and \fIEXTENT\fP arguments only for Fortran 90. FORTRAN 77
users may use the non-portable syntax
.sp
MPI_Type_get_extent:
.sp
.nf
INTEGER*MPI_ADDRESS_KIND \fILB\fP
or
INTEGER*MPI_ADDRESS_KIND \fIEXTENT\fP
.fi
.sp
where MPI_ADDRESS_KIND is a constant defined in mpif.h
and gives the length of the declared integer in bytes.
MPI_Type_get_extent_x:
.sp
.nf
INTEGER*MPI_COUNT_KIND \fILB\fP
or
INTEGER*MPI_COUNT_KIND \fIEXTENT\fP
.fi
.sp
where MPI_ADDRESS_KIND and MPI_COUNT_KIND are constants defined in mpif.h
and give the length of the declared integer in bytes.
.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI::Exception object.
.sp
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.

Просмотреть файл

@ -0,0 +1 @@
.so man3/MPI_Type_get_extent.3

Просмотреть файл

@ -1,9 +1,10 @@
.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved.
.\" Copyright 2010 Cisco Systems, Inc. All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.TH MPI_Type_get_true_extent 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Type_get_true_extent\fP \- Returns the true lower bound and extent of a data type's corresponding typemap, ignoring MPI_UB and MPI_LB markers.
\fBMPI_Type_get_true_extent\fP, \fBMPI_Type_get_true_extent_x\fP \- Returns the true lower bound and extent of a data type's corresponding typemap, ignoring MPI_UB and MPI_LB markers.
.SH SYNTAX
.ft R
@ -12,6 +13,8 @@
#include <mpi.h>
int MPI_Type_get_true_extent(MPI_Datatype \fIdatatype\fP,
MPI_Aint *\fItrue_lb\fP, MPI_Aint *\fItrue_extent\fP)
int MPI_Type_get_true_extent_x(MPI_Datatype \fIdatatype\fP,
MPI_Count *\fItrue_lb\fP, MPI_Count *\fItrue_extent\fP)
.fi
.SH Fortran Syntax (see FORTRAN 77 NOTES)
@ -20,6 +23,9 @@ INCLUDE 'mpif.h'
MPI_TYPE_GET_TRUE_EXTENT(\fIDATATYPE, TRUE_LB, TRUE_EXTENT, IERROR\fP)
INTEGER \fIDATATYPE, IERROR\fP
INTEGER(KIND=MPI_ADDRESS_KIND) \fITRUE_LB, TRUE_EXTENT\fP
MPI_TYPE_GET_TRUE_EXTENT_X(\fIDATATYPE, TRUE_LB, TRUE_EXTENT, IERROR\fP)
INTEGER \fIDATATYPE, IERROR\fP
INTEGER(KIND=MPI_COUNT_KIND) \fITRUE_LB, TRUE_EXTENT\fP
.fi
.SH C++ Syntax
@ -50,17 +56,18 @@ Fortran only: Error status (integer).
.SH DESCRIPTION
.ft R
The \fItrue_lb\fP parameter returns the offset of the lowest unit of store that is addressed by the data type, that is, the lower bound of the corresponding typemap, ignoring MPI_LB markers. The \fItrue_extent\fP parameter returns the true size of the data type, that is, the extent of the corresponding typemap, ignoring MPI_LB and MPI_UB markers, and performing no rounding for alignment.
The \fItrue_lb\fP parameter returns the offset of the lowest unit of store that is addressed by the data type, that is, the lower bound of the corresponding typemap, ignoring MPI_LB markers. The \fItrue_extent\fP parameter returns the true size of the data type, that is, the extent of the corresponding typemap, ignoring MPI_LB and MPI_UB markers, and performing no rounding for alignment. For both functions, if either the \fItrue_lb\fP or \fItrue_extent\fP parameter cannot express the value to be returned (e.g., if the parameter is too small to hold the output value), it is set to MPI_UNDEFINED.
.sp
The \fItrue_extent\fP is the minimum number of bytes of memory necessary to hold a data type, uncompressed.
.sp
See Section 4.14.3 of the MPI-2 standard for more detailed definitions of these parameters in relation to the typemap.
See § 4.1.8 of the MPI-3 standard for more detailed definitions of these parameters in relation to the typemap.
.SH FORTRAN 77 NOTES
.ft R
The MPI standard prescribes portable Fortran syntax for
the \fITRUE_LB\fP and \fITRUE_EXTENT\fP arguments only for Fortran 90. FORTRAN 77
users may use the non-portable syntax
the \fITRUE_LB\fP and \fITRUE_EXTENT\fP arguments only for Fortran 90. FORTRAN 77 users may use the non-portable syntax
.sp
MPI_Type_get_true_extent:
.sp
.nf
INTEGER*MPI_ADDRESS_KIND \fITRUE_LB\fP
@ -68,8 +75,15 @@ or
INTEGER*MPI_ADDRESS_KIND \fITRUE_EXTENT\fP
.fi
.sp
where MPI_ADDRESS_KIND is a constant defined in mpif.h
and gives the length of the declared integer in bytes.
MPI_Type_get_true_extent_x:
.sp
.nf
INTEGER*MPI_COUNT_KIND \fITRUE_LB\fP
or
INTEGER*MPI_COUNT_KIND \fITRUE_EXTENT\fP
.fi
.sp
where MPI_ADDRESS_KIND and MPI_COUNT_KIND are constants defined in mpif.h and give the length of the declared integer in bytes.
.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI::Exception object.
@ -77,4 +91,3 @@ Almost all MPI routines return an error value; C routines as the value of the fu
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.

Просмотреть файл

@ -0,0 +1 @@
.so man3/MPI_Type_get_true_extent.3

Просмотреть файл

@ -1,9 +1,10 @@
.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved.
.\" Copyright 2010 Cisco Systems, Inc. All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.TH MPI_Type_size 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Type_size\fP \- Returns the number of bytes occupied by entries in a data type.
\fBMPI_Type_size\fP, \fBMPI_Type_size_x\fP \- Returns the number of bytes occupied by entries in a data type.
.SH SYNTAX
.ft R
@ -11,13 +12,18 @@
.nf
#include <mpi.h>
int MPI_Type_size(MPI_Datatype \fIdatatype\fP, int\fI *size\fP)
int MPI_Type_size_x(MPI_Datatype \fIdatatype\fP, MPI_Count\fI *size\fP)
.fi
.SH Fortran Syntax
.nf
INCLUDE 'mpif.h'
MPI_TYPE_SIZE(\fIDATATYPE, SIZE, IERROR\fP)
INTEGER \fIDATATYPE, SIZE, IERROR\fP
INTEGER \fIDATATYPE, SIZE, IERROR\fP
MPI_TYPE_SIZE_X(\fIDATATYPE, SIZE, IERROR\fP)
INTEGER \fIDATATYPE\fP
INTEGER(KIND=MPI_COUNT_KIND) \fISIZE\fP
INTEGER \fIIERROR\fP
.fi
.SH C++ Syntax
@ -46,7 +52,7 @@ Fortran only: Error status (integer).
.SH DESCRIPTION
.ft R
MPI_Type_size returns the total size, in bytes, of the entries in the type signature associated with datatype; i.e., the total size of the data in a message that would be created with this datatype. Entries that occur multiple times in the datatype are counted with their multiplicity.
MPI_Type_size returns the total size, in bytes, of the entries in the type signature associated with datatype; i.e., the total size of the data in a message that would be created with this datatype. Entries that occur multiple times in the datatype are counted with their multiplicity. For either function, if the \fIsize\fP parameter cannot express the value to be returned (e.g., if the parameter is too small to hold the output value), it is set to MPI_UNDEFINED.
.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI::Exception object.
@ -54,4 +60,13 @@ Almost all MPI routines return an error value; C routines as the value of the fu
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.
.SH FORTRAN 77 NOTES
.ft R
The MPI standard prescribes portable Fortran syntax for the \fISIZE\fP argument of MPI_Type_size_x only for Fortran 90. FORTRAN 77 users may use the non-portable syntax
.sp
.nf
INTEGER*MPI_COUNT_KIND \fISIZE\fP
.fi
.sp
where MPI_COUNT_KIND is a constant defined in mpif.h and gives the length of the declared integer in bytes.

1
ompi/mpi/man/man3/MPI_Type_size_x.3in Обычный файл
Просмотреть файл

@ -0,0 +1 @@
.so man3/MPI_Type_size.3

Просмотреть файл

@ -150,6 +150,7 @@ mpi_api_man_pages = \
mpi/man/man3/MPI_Get_address.3 \
mpi/man/man3/MPI_Get_count.3 \
mpi/man/man3/MPI_Get_elements.3 \
mpi/man/man3/MPI_Get_elements_x.3 \
mpi/man/man3/MPI_Get_library_version.3 \
mpi/man/man3/MPI_Get_processor_name.3 \
mpi/man/man3/MPI_Get_version.3 \
@ -248,6 +249,7 @@ mpi_api_man_pages = \
mpi/man/man3/MPI_Status_f2c.3 \
mpi/man/man3/MPI_Status_set_cancelled.3 \
mpi/man/man3/MPI_Status_set_elements.3 \
mpi/man/man3/MPI_Status_set_elements_x.3 \
mpi/man/man3/MPI_Test.3 \
mpi/man/man3/MPI_Testall.3 \
mpi/man/man3/MPI_Testany.3 \
@ -278,8 +280,10 @@ mpi_api_man_pages = \
mpi/man/man3/MPI_Type_get_contents.3 \
mpi/man/man3/MPI_Type_get_envelope.3 \
mpi/man/man3/MPI_Type_get_extent.3 \
mpi/man/man3/MPI_Type_get_extent_x.3 \
mpi/man/man3/MPI_Type_get_name.3 \
mpi/man/man3/MPI_Type_get_true_extent.3 \
mpi/man/man3/MPI_Type_get_true_extent_x.3 \
mpi/man/man3/MPI_Type_hindexed.3 \
mpi/man/man3/MPI_Type_hvector.3 \
mpi/man/man3/MPI_Type_indexed.3 \
@ -288,6 +292,7 @@ mpi_api_man_pages = \
mpi/man/man3/MPI_Type_set_attr.3 \
mpi/man/man3/MPI_Type_set_name.3 \
mpi/man/man3/MPI_Type_size.3 \
mpi/man/man3/MPI_Type_size_x.3 \
mpi/man/man3/MPI_Type_struct.3 \
mpi/man/man3/MPI_Type_ub.3 \
mpi/man/man3/MPI_Type_vector.3 \

Просмотреть файл

@ -185,6 +185,15 @@ int ompi_op_init(void)
ompi_op_ddt_map[OMPI_DATATYPE_MPI_C_DOUBLE_COMPLEX] = OMPI_OP_BASE_TYPE_COMPLEX16;
ompi_op_ddt_map[OMPI_DATATYPE_MPI_C_LONG_DOUBLE_COMPLEX] = OMPI_OP_BASE_TYPE_COMPLEX32;
/* MPI 3.0 datatypes */
#if OMPI_MPI_COUNT_SIZE == 4
ompi_op_ddt_map[OMPI_DATATYPE_MPI_COUNT] = OMPI_OP_BASE_TYPE_INT32_T;
#elif OMPI_MPI_COUNT_SIZE == 8
ompi_op_ddt_map[OMPI_DATATYPE_MPI_COUNT] = OMPI_OP_BASE_TYPE_INT64_T;
#else
#warning Unsupported definition for MPI_COUNT
#endif
/* Create the intrinsic ops */
if (OMPI_SUCCESS !=

Просмотреть файл

@ -56,7 +56,7 @@ BEGIN_C_DECLS
*
* XXX TODO Adapt to whatever the OMPI-layer needs
*/
#define OPAL_DATATYPE_MAX_SUPPORTED 46
#define OPAL_DATATYPE_MAX_SUPPORTED 47
/* flags for the datatypes. */
@ -113,11 +113,11 @@ struct opal_datatype_t {
OPAL_PTRDIFF_TYPE ub; /**< upper bound in memory */
/* --- cacheline 1 boundary (64 bytes) --- */
uint32_t align; /**< data should be aligned to */
uint32_t nbElems; /**< total number of elements inside the datatype */
size_t nbElems; /**< total number of elements inside the datatype */
/* Attribute fields */
char name[OPAL_MAX_OBJECT_NAME]; /**< name of the datatype */
/* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
/* --- cacheline 2 boundary (128 bytes) was 8-12 bytes ago --- */
dt_type_desc_t desc; /**< the data description */
dt_type_desc_t opt_desc; /**< short description of the data used when conversion is useless
or in the send case (without conversion) */
@ -127,10 +127,10 @@ struct opal_datatype_t {
datatype for remote nodes. The length of the array is dependent on
the maximum number of datatypes of all top layers.
Reason being is that Fortran is not at the OPAL layer. */
/* --- cacheline 5 boundary (320 bytes) was 32 bytes ago --- */
/* --- cacheline 5 boundary (320 bytes) was 32-36 bytes ago --- */
/* size: 352, cachelines: 6, members: 15 */
/* last cacheline: 32 bytes */
/* last cacheline: 28-32 bytes */
};
typedef struct opal_datatype_t opal_datatype_t;
@ -272,10 +272,10 @@ opal_datatype_get_true_extent( const opal_datatype_t* pData, OPAL_PTRDIFF_TYPE*
return 0;
}
OPAL_DECLSPEC int32_t
OPAL_DECLSPEC ssize_t
opal_datatype_get_element_count( const opal_datatype_t* pData, size_t iSize );
OPAL_DECLSPEC int32_t
opal_datatype_set_element_count( const opal_datatype_t* pData, uint32_t count, size_t* length );
opal_datatype_set_element_count( const opal_datatype_t* pData, size_t count, size_t* length );
OPAL_DECLSPEC int32_t
opal_datatype_copy_content_same_ddt( const opal_datatype_t* pData, int32_t count,
char* pDestBuf, char* pSrcBuf );

Просмотреть файл

@ -28,11 +28,11 @@
* positive = number of basic elements inside
* negative = some error occurs
*/
int32_t opal_datatype_get_element_count( const opal_datatype_t* datatype, size_t iSize )
ssize_t opal_datatype_get_element_count( const opal_datatype_t* datatype, size_t iSize )
{
dt_stack_t* pStack; /* pointer to the position on the stack */
uint32_t pos_desc; /* actual position in the description of the derived datatype */
int32_t nbElems = 0, stack_pos = 0;
ssize_t nbElems = 0, stack_pos = 0;
size_t local_size;
dt_elem_desc_t* pElems;
@ -82,12 +82,12 @@ int32_t opal_datatype_get_element_count( const opal_datatype_t* datatype, size_t
}
}
int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, uint32_t count, size_t* length )
int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, size_t count, size_t* length )
{
dt_stack_t* pStack; /* pointer to the position on the stack */
uint32_t pos_desc; /* actual position in the description of the derived datatype */
size_t pos_desc; /* actual position in the description of the derived datatype */
int32_t stack_pos = 0;
uint32_t local_length = 0;
size_t local_length = 0;
dt_elem_desc_t* pElems;
/**