Look like a big commit but in fact it address only one issue. The way we're working with
size and diplacement of data-type. After this patch all data can contain size_t bytes and the displacements are defined as ptrdiff_t. All of the files I was able to compile have been modified to match this requirement. This commit was SVN r12146.
Этот коммит содержится в:
родитель
0c0fe022ff
Коммит
8852c00c36
@ -31,7 +31,7 @@
|
|||||||
#include "ompi/datatype/convertor_internal.h"
|
#include "ompi/datatype/convertor_internal.h"
|
||||||
#include "ompi/datatype/dt_arch.h"
|
#include "ompi/datatype/dt_arch.h"
|
||||||
|
|
||||||
extern int ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
|
extern size_t ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
|
||||||
extern int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* convertor,
|
extern int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* convertor,
|
||||||
int starting_point, const int* sizes );
|
int starting_point, const int* sizes );
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ ompi_convertor_find_or_create_master( uint32_t remote_arch )
|
|||||||
{
|
{
|
||||||
ompi_convertor_master_t* master = ompi_convertor_master_list;
|
ompi_convertor_master_t* master = ompi_convertor_master_list;
|
||||||
int i;
|
int i;
|
||||||
int32_t* remote_sizes;
|
size_t* remote_sizes;
|
||||||
|
|
||||||
while( NULL != master ) {
|
while( NULL != master ) {
|
||||||
if( master->remote_arch == remote_arch )
|
if( master->remote_arch == remote_arch )
|
||||||
@ -102,7 +102,7 @@ ompi_convertor_find_or_create_master( uint32_t remote_arch )
|
|||||||
* the local ones. As master->remote_sizes is defined as being an array of
|
* the local ones. As master->remote_sizes is defined as being an array of
|
||||||
* consts we have to manually cast it before using it for writing purposes.
|
* consts we have to manually cast it before using it for writing purposes.
|
||||||
*/
|
*/
|
||||||
remote_sizes = (int32_t*)master->remote_sizes;
|
remote_sizes = (size_t*)master->remote_sizes;
|
||||||
for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) {
|
for( i = DT_CHAR; i < DT_MAX_PREDEFINED; i++ ) {
|
||||||
remote_sizes[i] = ompi_ddt_local_sizes[i];
|
remote_sizes[i] = ompi_ddt_local_sizes[i];
|
||||||
}
|
}
|
||||||
@ -284,10 +284,6 @@ int32_t ompi_convertor_unpack( ompi_convertor_t* pConv,
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
char* base_pointer;
|
char* base_pointer;
|
||||||
|
|
||||||
/*opal_output( 0, "ompi_convertor_unpack at %p max_data %ld bConverted %ld size %ld count %d\n",
|
|
||||||
pConv->pBaseBuf, (long)*max_data, (long)pConv->bConverted,
|
|
||||||
(long)pConv->local_size, pConv->count );
|
|
||||||
ompi_ddt_dump( pConv->pDesc );*/
|
|
||||||
*max_data = pConv->bConverted;
|
*max_data = pConv->bConverted;
|
||||||
base_pointer = pConv->pBaseBuf + pConv->bConverted +
|
base_pointer = pConv->pBaseBuf + pConv->bConverted +
|
||||||
pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp;
|
pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp;
|
||||||
@ -314,23 +310,19 @@ int32_t ompi_convertor_unpack( ompi_convertor_t* pConv,
|
|||||||
pConv->flags |= CONVERTOR_COMPLETED;
|
pConv->flags |= CONVERTOR_COMPLETED;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*opal_output( 0, "ompi_convertor_unpack generic at %p max_data %ld bConverted %ld size %ld count %d\n",
|
|
||||||
pConv->pBaseBuf, (long)*max_data, (long)pConv->bConverted,
|
|
||||||
(long)pConv->local_size, pConv->count );
|
|
||||||
ompi_ddt_dump( pConv->pDesc );*/
|
|
||||||
|
|
||||||
return pConv->fAdvance( pConv, iov, out_size, max_data, freeAfter );
|
return pConv->fAdvance( pConv, iov, out_size, max_data, freeAfter );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor,
|
int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor,
|
||||||
int starting_point, const int* sizes )
|
size_t starting_point, const size_t* sizes )
|
||||||
{
|
{
|
||||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||||
const ompi_datatype_t* pData = pConvertor->pDesc;
|
const ompi_datatype_t* pData = pConvertor->pDesc;
|
||||||
dt_elem_desc_t* pElems;
|
dt_elem_desc_t* pElems;
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
long extent;
|
ptrdiff_t extent;
|
||||||
|
|
||||||
pStack = pConvertor->pStack;
|
pStack = pConvertor->pStack;
|
||||||
/* The prepare function already make the selection on which data representation
|
/* The prepare function already make the selection on which data representation
|
||||||
@ -338,17 +330,16 @@ int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor,
|
|||||||
*/
|
*/
|
||||||
pElems = pConvertor->use_desc->desc;
|
pElems = pConvertor->use_desc->desc;
|
||||||
|
|
||||||
count = starting_point / pData->size;
|
count = (uint32_t)(starting_point / pData->size);
|
||||||
extent = pData->ub - pData->lb;
|
extent = pData->ub - pData->lb;
|
||||||
|
|
||||||
pStack[0].type = DT_LOOP; /* the first one is always the loop */
|
pStack[0].type = DT_LOOP; /* the first one is always the loop */
|
||||||
pStack[0].count = pConvertor->count - count;
|
pStack[0].count = pConvertor->count - count;
|
||||||
pStack[0].index = -1;
|
pStack[0].index = -1;
|
||||||
pStack[0].end_loop = pConvertor->use_desc->used;
|
|
||||||
pStack[0].disp = count * extent;
|
pStack[0].disp = count * extent;
|
||||||
|
|
||||||
/* now compute the number of pending bytes */
|
/* now compute the number of pending bytes */
|
||||||
count = starting_point - count * pData->size;
|
count = (uint32_t)(starting_point - count * pData->size);
|
||||||
/* we save the current displacement starting from the begining
|
/* we save the current displacement starting from the begining
|
||||||
* of this data.
|
* of this data.
|
||||||
*/
|
*/
|
||||||
@ -362,7 +353,6 @@ int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor,
|
|||||||
pStack[1].disp = pData->true_lb + count;
|
pStack[1].disp = pData->true_lb + count;
|
||||||
}
|
}
|
||||||
pStack[1].index = 0; /* useless */
|
pStack[1].index = 0; /* useless */
|
||||||
pStack[1].end_loop = 0; /* useless */
|
|
||||||
|
|
||||||
pConvertor->bConverted = starting_point;
|
pConvertor->bConverted = starting_point;
|
||||||
pConvertor->stack_pos = 1;
|
pConvertor->stack_pos = 1;
|
||||||
@ -372,7 +362,7 @@ int ompi_convertor_create_stack_with_pos_contig( ompi_convertor_t* pConvertor,
|
|||||||
|
|
||||||
static inline
|
static inline
|
||||||
int ompi_convertor_create_stack_at_begining( ompi_convertor_t* convertor,
|
int ompi_convertor_create_stack_at_begining( ompi_convertor_t* convertor,
|
||||||
const int* sizes )
|
const size_t* sizes )
|
||||||
{
|
{
|
||||||
dt_stack_t* pStack = convertor->pStack;
|
dt_stack_t* pStack = convertor->pStack;
|
||||||
dt_elem_desc_t* pElems;
|
dt_elem_desc_t* pElems;
|
||||||
@ -387,7 +377,6 @@ int ompi_convertor_create_stack_at_begining( ompi_convertor_t* convertor,
|
|||||||
pStack[0].index = -1;
|
pStack[0].index = -1;
|
||||||
pStack[0].count = convertor->count;
|
pStack[0].count = convertor->count;
|
||||||
pStack[0].disp = 0;
|
pStack[0].disp = 0;
|
||||||
pStack[0].end_loop = convertor->use_desc->used;
|
|
||||||
/* The prepare function already make the selection on which data representation
|
/* The prepare function already make the selection on which data representation
|
||||||
* we have to use: normal one or the optimized version ?
|
* we have to use: normal one or the optimized version ?
|
||||||
*/
|
*/
|
||||||
@ -395,7 +384,6 @@ int ompi_convertor_create_stack_at_begining( ompi_convertor_t* convertor,
|
|||||||
|
|
||||||
pStack[1].index = 0;
|
pStack[1].index = 0;
|
||||||
pStack[1].disp = 0;
|
pStack[1].disp = 0;
|
||||||
pStack[1].end_loop = 0;
|
|
||||||
if( pElems[0].elem.common.type == DT_LOOP ) {
|
if( pElems[0].elem.common.type == DT_LOOP ) {
|
||||||
pStack[1].count = pElems[0].loop.loops;
|
pStack[1].count = pElems[0].loop.loops;
|
||||||
} else {
|
} else {
|
||||||
@ -555,7 +543,7 @@ ompi_convertor_prepare_for_send( ompi_convertor_t* convertor,
|
|||||||
|
|
||||||
if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) {
|
if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) {
|
||||||
if( datatype->flags & DT_FLAG_CONTIGUOUS ) {
|
if( datatype->flags & DT_FLAG_CONTIGUOUS ) {
|
||||||
if( ((datatype->ub - datatype->lb) == (long)datatype->size)
|
if( ((datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size)
|
||||||
|| (1 >= convertor->count) )
|
|| (1 >= convertor->count) )
|
||||||
convertor->fAdvance = ompi_pack_homogeneous_contig_checksum;
|
convertor->fAdvance = ompi_pack_homogeneous_contig_checksum;
|
||||||
else
|
else
|
||||||
@ -565,7 +553,7 @@ ompi_convertor_prepare_for_send( ompi_convertor_t* convertor,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( datatype->flags & DT_FLAG_CONTIGUOUS ) {
|
if( datatype->flags & DT_FLAG_CONTIGUOUS ) {
|
||||||
if( ((datatype->ub - datatype->lb) == (long)datatype->size)
|
if( ((datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size)
|
||||||
|| (1 >= convertor->count) )
|
|| (1 >= convertor->count) )
|
||||||
convertor->fAdvance = ompi_pack_homogeneous_contig;
|
convertor->fAdvance = ompi_pack_homogeneous_contig;
|
||||||
else
|
else
|
||||||
@ -641,8 +629,8 @@ void ompi_ddt_dump_stack( const dt_stack_t* pStack, int stack_pos,
|
|||||||
{
|
{
|
||||||
opal_output( 0, "\nStack %p stack_pos %d name %s\n", (void*)pStack, stack_pos, name );
|
opal_output( 0, "\nStack %p stack_pos %d name %s\n", (void*)pStack, stack_pos, name );
|
||||||
for( ; stack_pos >= 0; stack_pos-- ) {
|
for( ; stack_pos >= 0; stack_pos-- ) {
|
||||||
opal_output( 0, "%d: pos %d count %d disp %ld end_loop %d ", stack_pos, pStack[stack_pos].index,
|
opal_output( 0, "%d: pos %d count %d disp %ld ", stack_pos, pStack[stack_pos].index,
|
||||||
pStack[stack_pos].count, pStack[stack_pos].disp, pStack[stack_pos].end_loop );
|
pStack[stack_pos].count, pStack[stack_pos].disp );
|
||||||
if( pStack->index != -1 )
|
if( pStack->index != -1 )
|
||||||
opal_output( 0, "\t[desc count %d disp %ld extent %d]\n",
|
opal_output( 0, "\t[desc count %d disp %ld extent %d]\n",
|
||||||
pDesc[pStack[stack_pos].index].elem.count,
|
pDesc[pStack[stack_pos].index].elem.count,
|
||||||
|
@ -64,11 +64,10 @@ typedef void*(*memalloc_fct_t)( size_t* pLength, void* userdata );
|
|||||||
struct ompi_convertor_master_t;
|
struct ompi_convertor_master_t;
|
||||||
|
|
||||||
typedef struct dt_stack {
|
typedef struct dt_stack {
|
||||||
int16_t index; /**< index in the element description */
|
int16_t index; /**< index in the element description */
|
||||||
int16_t type; /**< the type used for the last pack/unpack (original or DT_BYTE) */
|
int16_t type; /**< the type used for the last pack/unpack (original or DT_BYTE) */
|
||||||
int32_t count; /**< number of times we still have to do it */
|
size_t count; /**< number of times we still have to do it */
|
||||||
int32_t end_loop; /**< for loops the end of the loop, otherwise useless */
|
ptrdiff_t disp; /**< actual displacement depending on the count field */
|
||||||
long disp; /**< actual displacement depending on the count field */
|
|
||||||
} dt_stack_t;
|
} dt_stack_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,7 +98,7 @@ struct ompi_convertor_t {
|
|||||||
uint32_t partial_length; /**< amount of data left over from the last unpack */
|
uint32_t partial_length; /**< amount of data left over from the last unpack */
|
||||||
uint32_t checksum; /**< checksum computed by pack/unpack operation */
|
uint32_t checksum; /**< checksum computed by pack/unpack operation */
|
||||||
uint32_t csum_ui1; /**< partial checksum computed by pack/unpack operation */
|
uint32_t csum_ui1; /**< partial checksum computed by pack/unpack operation */
|
||||||
uint32_t csum_ui2; /**< 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 */
|
dt_stack_t static_stack[DT_STATIC_STACK_SIZE]; /**< local stack for small datatypes */
|
||||||
};
|
};
|
||||||
OMPI_DECLSPEC OBJ_CLASS_DECLARATION( ompi_convertor_t );
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION( ompi_convertor_t );
|
||||||
|
@ -18,16 +18,16 @@
|
|||||||
#include "ompi/datatype/convertor.h"
|
#include "ompi/datatype/convertor.h"
|
||||||
|
|
||||||
typedef int32_t (*conversion_fct_t)( ompi_convertor_t* pConvertor, uint32_t count,
|
typedef int32_t (*conversion_fct_t)( ompi_convertor_t* pConvertor, uint32_t count,
|
||||||
const void* from, uint32_t from_len, long from_extent,
|
const void* from, size_t from_len, ptrdiff_t from_extent,
|
||||||
void* to, uint32_t to_length, long to_extent,
|
void* to, size_t to_length, ptrdiff_t to_extent,
|
||||||
uint32_t *advance );
|
ptrdiff_t *advance );
|
||||||
|
|
||||||
typedef struct ompi_convertor_master_t {
|
typedef struct ompi_convertor_master_t {
|
||||||
struct ompi_convertor_master_t* next;
|
struct ompi_convertor_master_t* next;
|
||||||
uint32_t remote_arch;
|
uint32_t remote_arch;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint64_t hetero_mask;
|
uint64_t hetero_mask;
|
||||||
const int32_t remote_sizes[DT_MAX_PREDEFINED];
|
const size_t remote_sizes[DT_MAX_PREDEFINED];
|
||||||
conversion_fct_t* pFunctions; /**< the convertor functions pointer */
|
conversion_fct_t* pFunctions; /**< the convertor functions pointer */
|
||||||
} ompi_convertor_master_t;
|
} ompi_convertor_master_t;
|
||||||
|
|
||||||
|
@ -31,19 +31,19 @@
|
|||||||
*
|
*
|
||||||
* Return value: Number of elements of type TYPE copied
|
* Return value: Number of elements of type TYPE copied
|
||||||
*/
|
*/
|
||||||
#define COPY_TYPE( TYPENAME, TYPE, COUNT ) \
|
#define COPY_TYPE( TYPENAME, TYPE, COUNT ) \
|
||||||
static int copy_##TYPENAME( ompi_convertor_t *pConvertor, uint32_t count, \
|
static int copy_##TYPENAME( ompi_convertor_t *pConvertor, uint32_t count, \
|
||||||
char* from, uint32_t from_len, long from_extent, \
|
char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||||
char* to, uint32_t to_len, long to_extent, \
|
char* to, size_t to_len, ptrdiff_t to_extent, \
|
||||||
uint32_t *advance) \
|
ptrdiff_t *advance) \
|
||||||
{ \
|
{ \
|
||||||
uint32_t i; \
|
uint32_t i; \
|
||||||
uint32_t remote_TYPE_size = sizeof(TYPE) * (COUNT); /* TODO */ \
|
size_t remote_TYPE_size = sizeof(TYPE) * (COUNT); /* TODO */ \
|
||||||
uint32_t local_TYPE_size = (COUNT) * sizeof(TYPE); \
|
size_t local_TYPE_size = (COUNT) * sizeof(TYPE); \
|
||||||
\
|
\
|
||||||
/* make sure the remote buffer is large enough to hold the data */ \
|
/* make sure the remote buffer is large enough to hold the data */ \
|
||||||
if( (remote_TYPE_size * count) > from_len ) { \
|
if( (remote_TYPE_size * count) > from_len ) { \
|
||||||
count = from_len / remote_TYPE_size; \
|
count = (uint32_t)(from_len / remote_TYPE_size); \
|
||||||
if( (count * remote_TYPE_size) != from_len ) { \
|
if( (count * remote_TYPE_size) != from_len ) { \
|
||||||
DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \
|
DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \
|
||||||
from_len - (count * remote_TYPE_size) ); \
|
from_len - (count * remote_TYPE_size) ); \
|
||||||
@ -54,8 +54,8 @@ static int copy_##TYPENAME( ompi_convertor_t *pConvertor, uint32_t count, \
|
|||||||
DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \
|
DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \
|
||||||
#TYPE, count, from, from_len, to, to_len ); \
|
#TYPE, count, from, from_len, to, to_len ); \
|
||||||
\
|
\
|
||||||
if( (from_extent == (long)local_TYPE_size) && \
|
if( (from_extent == (ptrdiff_t)local_TYPE_size) && \
|
||||||
(to_extent == (long)remote_TYPE_size) ) { \
|
(to_extent == (ptrdiff_t)remote_TYPE_size) ) { \
|
||||||
/* copy of contigous data at both source and destination */ \
|
/* copy of contigous data at both source and destination */ \
|
||||||
MEMCPY( to, from, count * local_TYPE_size ); \
|
MEMCPY( to, from, count * local_TYPE_size ); \
|
||||||
} else { \
|
} else { \
|
||||||
@ -84,18 +84,18 @@ static int copy_##TYPENAME( ompi_convertor_t *pConvertor, uint32_t count, \
|
|||||||
*
|
*
|
||||||
* Return value: Number of elements of type TYPE copied
|
* Return value: Number of elements of type TYPE copied
|
||||||
*/
|
*/
|
||||||
#define COPY_CONTIGUOUS_BYTES( TYPENAME, COUNT ) \
|
#define COPY_CONTIGUOUS_BYTES( TYPENAME, COUNT ) \
|
||||||
static int copy_##TYPENAME##_##COUNT( ompi_convertor_t *pConvertor, uint32_t count, \
|
static int copy_##TYPENAME##_##COUNT( ompi_convertor_t *pConvertor, uint32_t count, \
|
||||||
char* from, uint32_t from_len, long from_extent, \
|
char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||||
char* to, uint32_t to_len, long to_extent, \
|
char* to, size_t to_len, ptrdiff_t to_extent, \
|
||||||
uint32_t *advance) \
|
ptrdiff_t *advance ) \
|
||||||
{ \
|
{ \
|
||||||
uint32_t i; \
|
uint32_t i; \
|
||||||
uint32_t remote_TYPE_size = (COUNT); /* TODO */ \
|
size_t remote_TYPE_size = (size_t)(COUNT); /* TODO */ \
|
||||||
uint32_t local_TYPE_size = (COUNT); \
|
size_t local_TYPE_size = (size_t)(COUNT); \
|
||||||
\
|
\
|
||||||
if( (remote_TYPE_size * count) > from_len ) { \
|
if( (remote_TYPE_size * count) > from_len ) { \
|
||||||
count = from_len / remote_TYPE_size; \
|
count = (uint32_t)(from_len / remote_TYPE_size); \
|
||||||
if( (count * remote_TYPE_size) != from_len ) { \
|
if( (count * remote_TYPE_size) != from_len ) { \
|
||||||
DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \
|
DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \
|
||||||
from_len - (count * remote_TYPE_size) ); \
|
from_len - (count * remote_TYPE_size) ); \
|
||||||
@ -106,8 +106,8 @@ static int copy_##TYPENAME##_##COUNT( ompi_convertor_t *pConvertor, uint32_t cou
|
|||||||
DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \
|
DUMP( " copy %s count %d from buffer %p with length %d to %p space %d\n", \
|
||||||
#TYPENAME, count, from, from_len, to, to_len ); \
|
#TYPENAME, count, from, from_len, to, to_len ); \
|
||||||
\
|
\
|
||||||
if( (from_extent == (long)local_TYPE_size) && \
|
if( (from_extent == (ptrdiff_t)local_TYPE_size) && \
|
||||||
(to_extent == (long)remote_TYPE_size) ) { \
|
(to_extent == (ptrdiff_t)remote_TYPE_size) ) { \
|
||||||
MEMCPY( to, from, count * local_TYPE_size ); \
|
MEMCPY( to, from, count * local_TYPE_size ); \
|
||||||
} else { \
|
} else { \
|
||||||
for( i = 0; i < count; i++ ) { \
|
for( i = 0; i < count; i++ ) { \
|
||||||
|
@ -23,22 +23,23 @@
|
|||||||
#include "ompi/datatype/convertor_internal.h"
|
#include "ompi/datatype/convertor_internal.h"
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
ompi_dt_swap_bytes(void *to_p, const void *from_p, const long size)
|
ompi_dt_swap_bytes(void *to_p, const void *from_p, const size_t size)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i, back_i;
|
||||||
uint8_t *to = (uint8_t*) to_p, *from = (uint8_t*) from_p;
|
uint8_t *to = (uint8_t*) to_p, *from = (uint8_t*) from_p;
|
||||||
for (i = 0 ; i < size ; i++) {
|
back_i = size - 1;
|
||||||
to[size - 1 - i] = from[i];
|
for (i = 0 ; i < size ; i++, back_i--) {
|
||||||
|
to[back_i] = from[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define COPY_TYPE_HETEROGENEOUS( TYPENAME, TYPE ) \
|
#define COPY_TYPE_HETEROGENEOUS( TYPENAME, TYPE ) \
|
||||||
static int32_t \
|
static int32_t \
|
||||||
copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
||||||
const char* from, uint32_t from_len, long from_extent, \
|
const char* from, size_t from_len, ptrdiff_t from_extent, \
|
||||||
char* to, uint32_t to_length, long to_extent, \
|
char* to, size_t to_length, ptrdiff_t to_extent, \
|
||||||
uint32_t *advance) \
|
ptrdiff_t *advance) \
|
||||||
{ \
|
{ \
|
||||||
uint32_t i; \
|
uint32_t i; \
|
||||||
\
|
\
|
||||||
@ -53,8 +54,8 @@ copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
|||||||
to += to_extent; \
|
to += to_extent; \
|
||||||
from += from_extent; \
|
from += from_extent; \
|
||||||
} \
|
} \
|
||||||
} else if (sizeof(TYPE) == to_extent && \
|
} else if ((ptrdiff_t)sizeof(TYPE) == to_extent && \
|
||||||
sizeof(TYPE) == from_extent) { \
|
(ptrdiff_t)sizeof(TYPE) == from_extent) { \
|
||||||
MEMCPY( to, from, count * sizeof(TYPE) ); \
|
MEMCPY( to, from, count * sizeof(TYPE) ); \
|
||||||
} else { \
|
} else { \
|
||||||
/* source or destination are non-contigous */ \
|
/* source or destination are non-contigous */ \
|
||||||
@ -72,8 +73,8 @@ copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
|||||||
#define COPY_2TYPE_HETEROGENEOUS( TYPENAME, TYPE1, TYPE2 ) \
|
#define COPY_2TYPE_HETEROGENEOUS( TYPENAME, TYPE1, TYPE2 ) \
|
||||||
static int32_t \
|
static int32_t \
|
||||||
copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
||||||
const char* from, uint32_t from_len, long from_extent, \
|
const char* from, uint32_t from_len, ptrdiff_t from_extent, \
|
||||||
char* to, uint32_t to_length, long to_extent, \
|
char* to, uint32_t to_length, ptrdiff_t to_extent, \
|
||||||
uint32_t *advance) \
|
uint32_t *advance) \
|
||||||
{ \
|
{ \
|
||||||
uint32_t i; \
|
uint32_t i; \
|
||||||
@ -96,8 +97,8 @@ copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
|||||||
to += to_extent; \
|
to += to_extent; \
|
||||||
from += from_extent; \
|
from += from_extent; \
|
||||||
} \
|
} \
|
||||||
} else if (sizeof(TYPE1) + sizeof(TYPE2) == to_extent && \
|
} else if ((ptrdiff_t)(sizeof(TYPE1) + sizeof(TYPE2)) == to_extent && \
|
||||||
sizeof(TYPE1) + sizeof(TYPE2) == from_extent) { \
|
(ptrdiff_t)(sizeof(TYPE1) + sizeof(TYPE2)) == from_extent) { \
|
||||||
/* source and destination are contigous */ \
|
/* source and destination are contigous */ \
|
||||||
MEMCPY( to, from, count * (sizeof(TYPE1) + sizeof(TYPE2)) ); \
|
MEMCPY( to, from, count * (sizeof(TYPE1) + sizeof(TYPE2)) ); \
|
||||||
} else { \
|
} else { \
|
||||||
@ -120,8 +121,8 @@ copy_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
|||||||
#define COPY_2COMPLEX_HETEROGENEOUS( TYPENAME, TYPE ) \
|
#define COPY_2COMPLEX_HETEROGENEOUS( TYPENAME, TYPE ) \
|
||||||
static int32_t \
|
static int32_t \
|
||||||
copy_2complex_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
copy_2complex_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count, \
|
||||||
const char* from, uint32_t from_len, long from_extent, \
|
const char* from, uint32_t from_len, ptrdiff_t from_extent, \
|
||||||
char* to, uint32_t to_length, long to_extent, \
|
char* to, uint32_t to_length, ptrdiff_t to_extent, \
|
||||||
uint32_t *advance) \
|
uint32_t *advance) \
|
||||||
{ \
|
{ \
|
||||||
uint32_t i; \
|
uint32_t i; \
|
||||||
@ -161,13 +162,13 @@ copy_2complex_##TYPENAME##_heterogeneous(ompi_convertor_t *pConvertor, uint32_t
|
|||||||
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
datatype_check(char *type, uint32_t local_size, uint32_t remote_size, uint32_t *count,
|
datatype_check(char *type, size_t local_size, size_t remote_size, uint32_t *count,
|
||||||
const char* from, uint32_t from_len, long from_extent,
|
const char* from, size_t from_len, ptrdiff_t from_extent,
|
||||||
char* to, uint32_t to_len, long to_extent)
|
char* to, size_t to_len, ptrdiff_t to_extent)
|
||||||
{
|
{
|
||||||
/* make sure the remote buffer is large enough to hold the data */
|
/* make sure the remote buffer is large enough to hold the data */
|
||||||
if( (remote_size * *count) > from_len ) {
|
if( (remote_size * *count) > from_len ) {
|
||||||
*count = from_len / remote_size;
|
*count = (uint32_t)(from_len / remote_size);
|
||||||
if( (*count * remote_size) != from_len ) {
|
if( (*count * remote_size) != from_len ) {
|
||||||
DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n",
|
DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n",
|
||||||
from_len - (*count * remote_size) );
|
from_len - (*count * remote_size) );
|
||||||
@ -184,8 +185,8 @@ datatype_check(char *type, uint32_t local_size, uint32_t remote_size, uint32_t *
|
|||||||
/* char has no endian issues, so don't really worry about it */
|
/* char has no endian issues, so don't really worry about it */
|
||||||
static int32_t
|
static int32_t
|
||||||
copy_char_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,
|
copy_char_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,
|
||||||
const char* from, uint32_t from_len, long from_extent,
|
const char* from, uint32_t from_len, ptrdiff_t from_extent,
|
||||||
char* to, uint32_t to_length, long to_extent,
|
char* to, uint32_t to_length, ptrdiff_t to_extent,
|
||||||
uint32_t *advance)
|
uint32_t *advance)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -220,8 +221,8 @@ copy_char_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,
|
|||||||
}
|
}
|
||||||
static int32_t
|
static int32_t
|
||||||
copy_cxx_bool_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,
|
copy_cxx_bool_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,
|
||||||
const char* from, uint32_t from_len, long from_extent,
|
const char* from, uint32_t from_len, ptrdiff_t from_extent,
|
||||||
char* to, uint32_t to_length, long to_extent,
|
char* to, uint32_t to_length, ptrdiff_t to_extent,
|
||||||
uint32_t *advance)
|
uint32_t *advance)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -277,8 +278,8 @@ copy_cxx_bool_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,
|
|||||||
}
|
}
|
||||||
static int32_t
|
static int32_t
|
||||||
copy_fortran_logical_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,
|
copy_fortran_logical_heterogeneous(ompi_convertor_t *pConvertor, uint32_t count,
|
||||||
const char* from, uint32_t from_len, long from_extent,
|
const char* from, uint32_t from_len, ptrdiff_t from_extent,
|
||||||
char* to, uint32_t to_length, long to_extent,
|
char* to, uint32_t to_length, ptrdiff_t to_extent,
|
||||||
uint32_t *advance)
|
uint32_t *advance)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ompi/constants.h"
|
#include "ompi/constants.h"
|
||||||
#include "opal/class/opal_object.h"
|
#include "opal/class/opal_object.h"
|
||||||
@ -96,13 +97,13 @@ typedef struct dt_type_desc {
|
|||||||
*/
|
*/
|
||||||
typedef struct ompi_datatype_t {
|
typedef struct ompi_datatype_t {
|
||||||
opal_object_t super; /**< basic superclass */
|
opal_object_t super; /**< basic superclass */
|
||||||
unsigned long size; /**< total size in bytes of the memory used by the data if
|
size_t size; /**< total size in bytes of the memory used by the data if
|
||||||
* the data is put on a contiguous buffer */
|
* the data is put on a contiguous buffer */
|
||||||
uint32_t align; /**< data should be aligned to */
|
uint32_t align; /**< data should be aligned to */
|
||||||
long true_lb;
|
ptrdiff_t true_lb;
|
||||||
long true_ub; /**< the true ub of the data without user defined lb and ub */
|
ptrdiff_t true_ub; /**< the true ub of the data without user defined lb and ub */
|
||||||
long lb; /**< lower bound in memory */
|
ptrdiff_t lb; /**< lower bound in memory */
|
||||||
long ub; /**< upper bound in memory */
|
ptrdiff_t ub; /**< upper bound in memory */
|
||||||
uint16_t flags; /**< the flags */
|
uint16_t flags; /**< the flags */
|
||||||
uint16_t id; /**< data id, normally the index in the data array. */
|
uint16_t id; /**< data id, normally the index in the data array. */
|
||||||
uint32_t nbElems; /**< total number of elements inside the datatype */
|
uint32_t nbElems; /**< total number of elements inside the datatype */
|
||||||
@ -146,19 +147,19 @@ void ompi_ddt_dump( const ompi_datatype_t* pData );
|
|||||||
/* data creation functions */
|
/* 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_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_contiguous( int count, const ompi_datatype_t* oldType, ompi_datatype_t** newType );
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_create_vector( int count, int bLength, long stride,
|
OMPI_DECLSPEC int32_t ompi_ddt_create_vector( int count, int bLength, int stride,
|
||||||
const ompi_datatype_t* oldType, ompi_datatype_t** newType );
|
const ompi_datatype_t* oldType, ompi_datatype_t** newType );
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_create_hvector( int count, int bLength, long stride,
|
OMPI_DECLSPEC int32_t ompi_ddt_create_hvector( int count, int bLength, MPI_Aint stride,
|
||||||
const ompi_datatype_t* oldType, ompi_datatype_t** newType );
|
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,
|
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 );
|
const ompi_datatype_t* oldType, ompi_datatype_t** newType );
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_create_hindexed( int count, const int* pBlockLength, const long* pDisp,
|
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 );
|
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,
|
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 );
|
const ompi_datatype_t* oldType, ompi_datatype_t** newType );
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_create_struct( int count, const int* pBlockLength, const long* pDisp,
|
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_datatype_t* const* pTypes, ompi_datatype_t** newType );
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_create_resized( const ompi_datatype_t* oldType, long lb, long extent, 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_create_subarray( int ndims, const int* pSizes,
|
OMPI_DECLSPEC int32_t ompi_ddt_create_subarray( int ndims, const int* pSizes,
|
||||||
const int* pSubSizes, const int* pStarts,
|
const int* pSubSizes, const int* pStarts,
|
||||||
int order, const ompi_datatype_t* oldType, ompi_datatype_t** newType );
|
int order, const ompi_datatype_t* oldType, ompi_datatype_t** newType );
|
||||||
@ -169,22 +170,22 @@ OMPI_DECLSPEC int32_t ompi_ddt_create_darray( int size, int rank, int ndims,
|
|||||||
ompi_datatype_t** newType );
|
ompi_datatype_t** newType );
|
||||||
|
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, uint32_t count,
|
OMPI_DECLSPEC int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd, uint32_t count,
|
||||||
long disp, long extent );
|
ptrdiff_t disp, ptrdiff_t extent );
|
||||||
|
|
||||||
static inline int32_t ompi_ddt_type_lb( const ompi_datatype_t* pData, long* disp )
|
static inline int32_t ompi_ddt_type_lb( const ompi_datatype_t* pData, ptrdiff_t* disp )
|
||||||
{ *disp = pData->lb; return 0; }
|
{ *disp = pData->lb; return 0; }
|
||||||
static inline int32_t ompi_ddt_type_ub( const ompi_datatype_t* pData, long* disp )
|
static inline int32_t ompi_ddt_type_ub( const ompi_datatype_t* pData, ptrdiff_t* disp )
|
||||||
{ *disp = pData->ub; return 0; }
|
{ *disp = pData->ub; return 0; }
|
||||||
static inline int32_t ompi_ddt_type_size ( const ompi_datatype_t* pData, int32_t *size )
|
static inline int32_t ompi_ddt_type_size ( const ompi_datatype_t* pData, size_t *size )
|
||||||
{ *size = pData->size; return 0; }
|
{ *size = pData->size; return 0; }
|
||||||
static inline int32_t ompi_ddt_type_extent( const ompi_datatype_t* pData, long* extent )
|
static inline int32_t ompi_ddt_type_extent( const ompi_datatype_t* pData, ptrdiff_t* extent )
|
||||||
{ *extent = pData->ub - pData->lb; return 0; }
|
{ *extent = pData->ub - pData->lb; return 0; }
|
||||||
|
|
||||||
static inline int32_t ompi_ddt_get_extent( const ompi_datatype_t* pData, long* lb, long* extent)
|
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; }
|
{ *lb = pData->lb; *extent = pData->ub - pData->lb; return 0; }
|
||||||
static inline int32_t ompi_ddt_get_true_extent( const ompi_datatype_t* pData, long* true_lb, long* true_extent)
|
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; }
|
{ *true_lb = pData->true_lb; *true_extent = (pData->true_ub - pData->true_lb); return 0; }
|
||||||
static inline int32_t ompi_ddt_get_size( const ompi_datatype_t* pData, unsigned long* size )
|
static inline int32_t ompi_ddt_get_size( const ompi_datatype_t* pData, size_t* size )
|
||||||
{ *size = pData->size; return 0; }
|
{ *size = pData->size; return 0; }
|
||||||
/*
|
/*
|
||||||
* This function return true (1) if the datatype representation depending on the count
|
* This function return true (1) if the datatype representation depending on the count
|
||||||
@ -194,11 +195,11 @@ static inline int32_t ompi_ddt_is_contiguous_memory_layout( const ompi_datatype_
|
|||||||
{
|
{
|
||||||
if( !(datatype->flags & DT_FLAG_CONTIGUOUS) ) return 0;
|
if( !(datatype->flags & DT_FLAG_CONTIGUOUS) ) return 0;
|
||||||
if( (count == 1) || (datatype->flags & DT_FLAG_NO_GAPS) ) return 1;
|
if( (count == 1) || (datatype->flags & DT_FLAG_NO_GAPS) ) return 1;
|
||||||
assert( (long)datatype->size != (datatype->ub - datatype->lb) );
|
assert( (ptrdiff_t)datatype->size != (datatype->ub - datatype->lb) );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_get_element_count( const ompi_datatype_t* pData, int32_t iSize );
|
OMPI_DECLSPEC int32_t ompi_ddt_get_element_count( const ompi_datatype_t* pData, size_t iSize );
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* pData, int32_t count,
|
OMPI_DECLSPEC int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* pData, int32_t count,
|
||||||
char* pDestBuf, char* pSrcBuf );
|
char* pDestBuf, char* pSrcBuf );
|
||||||
|
|
||||||
@ -215,11 +216,11 @@ OMPI_DECLSPEC int32_t ompi_ddt_sndrcv( void *sbuf, int32_t scount, const ompi_da
|
|||||||
*/
|
*/
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_get_args( const ompi_datatype_t* pData, int32_t which,
|
OMPI_DECLSPEC int32_t ompi_ddt_get_args( const ompi_datatype_t* pData, int32_t which,
|
||||||
int32_t * ci, int32_t * i,
|
int32_t * ci, int32_t * i,
|
||||||
int32_t * ca, long* a,
|
int32_t * ca, MPI_Aint* a,
|
||||||
int32_t * cd, ompi_datatype_t** d, int32_t * type);
|
int32_t * cd, ompi_datatype_t** d, int32_t * type);
|
||||||
OMPI_DECLSPEC int32_t ompi_ddt_set_args( ompi_datatype_t* pData,
|
OMPI_DECLSPEC int32_t ompi_ddt_set_args( ompi_datatype_t* pData,
|
||||||
int32_t ci, int32_t ** i,
|
int32_t ci, int32_t ** i,
|
||||||
int32_t ca, long* a,
|
int32_t ca, MPI_Aint* a,
|
||||||
int32_t cd, ompi_datatype_t** d,int32_t type);
|
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_DECLSPEC int32_t ompi_ddt_copy_args( const ompi_datatype_t* source_data,
|
||||||
ompi_datatype_t* dest_data );
|
ompi_datatype_t* dest_data );
|
||||||
|
@ -153,17 +153,17 @@ struct ddt_elem_desc {
|
|||||||
ddt_elem_id_description common; /**< basic data description and flags */
|
ddt_elem_id_description common; /**< basic data description and flags */
|
||||||
uint32_t count; /**< number of blocks */
|
uint32_t count; /**< number of blocks */
|
||||||
uint32_t blocklen; /**< number of elements on each block */
|
uint32_t blocklen; /**< number of elements on each block */
|
||||||
int32_t extent; /**< extent of each block (in bytes) */
|
ptrdiff_t extent; /**< extent of each block (in bytes) */
|
||||||
long disp; /**< displacement of the first block */
|
ptrdiff_t disp; /**< displacement of the first block */
|
||||||
};
|
};
|
||||||
typedef struct ddt_elem_desc ddt_elem_desc_t;
|
typedef struct ddt_elem_desc ddt_elem_desc_t;
|
||||||
|
|
||||||
struct ddt_loop_desc {
|
struct ddt_loop_desc {
|
||||||
ddt_elem_id_description common; /**< basic data description and flags */
|
ddt_elem_id_description common; /**< basic data description and flags */
|
||||||
uint32_t loops; /**< number of elements */
|
uint32_t loops; /**< number of elements */
|
||||||
uint32_t unused; /**< not used right now */
|
|
||||||
uint32_t items; /**< number of items in the loop */
|
uint32_t items; /**< number of items in the loop */
|
||||||
long extent; /**< extent of the whole 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;
|
typedef struct ddt_loop_desc ddt_loop_desc_t;
|
||||||
|
|
||||||
@ -171,8 +171,8 @@ struct ddt_endloop_desc {
|
|||||||
ddt_elem_id_description common; /**< basic data description and flags */
|
ddt_elem_id_description common; /**< basic data description and flags */
|
||||||
uint32_t items; /**< number of elements */
|
uint32_t items; /**< number of elements */
|
||||||
uint32_t unused; /**< not used right now */
|
uint32_t unused; /**< not used right now */
|
||||||
uint32_t size; /**< real size of the data in the loop */
|
size_t size; /**< real size of the data in the loop */
|
||||||
long first_elem_disp; /**< the displacement of the first block 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;
|
typedef struct ddt_endloop_desc ddt_endloop_desc_t;
|
||||||
|
|
||||||
@ -234,19 +234,18 @@ extern const ompi_datatype_t* ompi_ddt_basicDatatypes[DT_MAX_PREDEFINED];
|
|||||||
int32_t ompi_ddt_default_convertors_init( void );
|
int32_t ompi_ddt_default_convertors_init( void );
|
||||||
int32_t ompi_ddt_default_convertors_fini( void );
|
int32_t ompi_ddt_default_convertors_fini( void );
|
||||||
|
|
||||||
#define SAVE_STACK( PSTACK, INDEX, TYPE, COUNT, DISP, END_LOOP) \
|
#define SAVE_STACK( PSTACK, INDEX, TYPE, COUNT, DISP) \
|
||||||
do { \
|
do { \
|
||||||
(PSTACK)->index = (INDEX); \
|
(PSTACK)->index = (INDEX); \
|
||||||
(PSTACK)->type = (TYPE); \
|
(PSTACK)->type = (TYPE); \
|
||||||
(PSTACK)->count = (COUNT); \
|
(PSTACK)->count = (COUNT); \
|
||||||
(PSTACK)->disp = (DISP); \
|
(PSTACK)->disp = (DISP); \
|
||||||
(PSTACK)->end_loop = (END_LOOP); \
|
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define PUSH_STACK( PSTACK, STACK_POS, INDEX, TYPE, COUNT, DISP, END_LOOP) \
|
#define PUSH_STACK( PSTACK, STACK_POS, INDEX, TYPE, COUNT, DISP) \
|
||||||
do { \
|
do { \
|
||||||
dt_stack_t* pTempStack = (PSTACK) + 1; \
|
dt_stack_t* pTempStack = (PSTACK) + 1; \
|
||||||
SAVE_STACK( pTempStack, (INDEX), (TYPE), (COUNT), (DISP), (END_LOOP) ); \
|
SAVE_STACK( pTempStack, (INDEX), (TYPE), (COUNT), (DISP) ); \
|
||||||
(STACK_POS)++; \
|
(STACK_POS)++; \
|
||||||
(PSTACK) = pTempStack; \
|
(PSTACK) = pTempStack; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
@ -58,9 +58,9 @@ ompi_pack_homogeneous_contig_function( ompi_convertor_t* pConv,
|
|||||||
{
|
{
|
||||||
dt_stack_t* pStack = pConv->pStack;
|
dt_stack_t* pStack = pConv->pStack;
|
||||||
char *source_base = NULL;
|
char *source_base = NULL;
|
||||||
size_t length = pConv->local_size - pConv->bConverted;
|
uint32_t iov_count;
|
||||||
uint32_t iov_count, initial_amount = pConv->bConverted;
|
size_t length = pConv->local_size - pConv->bConverted, initial_amount = pConv->bConverted;
|
||||||
long initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp;
|
ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp;
|
||||||
|
|
||||||
*freeAfter = 0;
|
*freeAfter = 0;
|
||||||
source_base = (pConv->pBaseBuf + initial_displ + pStack[0].disp + pStack[1].disp);
|
source_base = (pConv->pBaseBuf + initial_displ + pStack[0].disp + pStack[1].disp);
|
||||||
@ -107,20 +107,20 @@ ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv,
|
|||||||
const ompi_datatype_t* pData = pConv->pDesc;
|
const ompi_datatype_t* pData = pConv->pDesc;
|
||||||
dt_stack_t* pStack = pConv->pStack;
|
dt_stack_t* pStack = pConv->pStack;
|
||||||
char *user_memory, *packed_buffer;
|
char *user_memory, *packed_buffer;
|
||||||
long extent;
|
uint32_t i, index, iov_count;
|
||||||
uint32_t max_allowed, i, index;
|
size_t max_allowed, total_bytes_converted = 0;
|
||||||
uint32_t iov_count, total_bytes_converted = 0;
|
ptrdiff_t extent;
|
||||||
long initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp;
|
ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp;
|
||||||
|
|
||||||
extent = pData->ub - pData->lb;
|
extent = pData->ub - pData->lb;
|
||||||
assert( (pData->flags & DT_FLAG_CONTIGUOUS) && ((long)pData->size != extent) );
|
assert( (pData->flags & DT_FLAG_CONTIGUOUS) && ((ptrdiff_t)pData->size != extent) );
|
||||||
|
|
||||||
/* Limit the amount of packed data to the data left over on this convertor */
|
/* Limit the amount of packed data to the data left over on this convertor */
|
||||||
max_allowed = pConv->local_size - pConv->bConverted;
|
max_allowed = pConv->local_size - pConv->bConverted;
|
||||||
if( max_allowed > (*max_data) )
|
if( max_allowed > (*max_data) )
|
||||||
max_allowed = (*max_data);
|
max_allowed = (*max_data);
|
||||||
|
|
||||||
i = pConv->bConverted / pData->size; /* how many we already pack */
|
i = (uint32_t)(pConv->bConverted / pData->size); /* how many we already pack */
|
||||||
|
|
||||||
*freeAfter = 0;
|
*freeAfter = 0;
|
||||||
/* There are some optimizations that can be done if the upper level
|
/* There are some optimizations that can be done if the upper level
|
||||||
@ -169,7 +169,7 @@ ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv,
|
|||||||
iov[index].iov_base = user_memory;
|
iov[index].iov_base = user_memory;
|
||||||
iov[index].iov_len = pData->size;
|
iov[index].iov_len = pData->size;
|
||||||
user_memory += extent;
|
user_memory += extent;
|
||||||
COMPUTE_CSUM( iov[index].iov_base, iov[index].iov_len, pConv );
|
COMPUTE_CSUM( iov[index].iov_base, (size_t)iov[index].iov_len, pConv );
|
||||||
}
|
}
|
||||||
max_allowed -= iov[index].iov_len;
|
max_allowed -= iov[index].iov_len;
|
||||||
total_bytes_converted += iov[index].iov_len;
|
total_bytes_converted += iov[index].iov_len;
|
||||||
@ -186,7 +186,8 @@ ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
uint32_t done, counter;
|
uint32_t counter;
|
||||||
|
size_t done;
|
||||||
|
|
||||||
if( iov[iov_count].iov_base == NULL ) {
|
if( iov[iov_count].iov_base == NULL ) {
|
||||||
size_t length = iov[iov_count].iov_len;
|
size_t length = iov[iov_count].iov_len;
|
||||||
@ -212,7 +213,7 @@ ompi_pack_homogeneous_contig_with_gaps_function( ompi_convertor_t* pConv,
|
|||||||
total_bytes_converted += done;
|
total_bytes_converted += done;
|
||||||
}
|
}
|
||||||
user_memory = pConv->pBaseBuf + initial_displ + i * extent;
|
user_memory = pConv->pBaseBuf + initial_displ + i * extent;
|
||||||
counter = max_allowed / pData->size;
|
counter = (uint32_t)(max_allowed / pData->size);
|
||||||
if( counter > pConv->count ) counter = pConv->count;
|
if( counter > pConv->count ) counter = pConv->count;
|
||||||
for( i = 0; i < counter; i++ ) {
|
for( i = 0; i < counter; i++ ) {
|
||||||
OMPI_DDT_SAFEGUARD_POINTER( user_memory, pData->size, pConv->pBaseBuf, pData, pConv->count );
|
OMPI_DDT_SAFEGUARD_POINTER( user_memory, pData->size, pConv->pBaseBuf, pData, pConv->count );
|
||||||
@ -265,7 +266,8 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor,
|
|||||||
dt_elem_desc_t* pElem;
|
dt_elem_desc_t* pElem;
|
||||||
const ompi_datatype_t *pData = pConvertor->pDesc;
|
const ompi_datatype_t *pData = pConvertor->pDesc;
|
||||||
char *source_base, *destination;
|
char *source_base, *destination;
|
||||||
uint32_t iov_len_local, iov_count;
|
size_t iov_len_local;
|
||||||
|
uint32_t iov_count;
|
||||||
|
|
||||||
DO_DEBUG( opal_output( 0, "ompi_convertor_generic_simple_pack( %p, {%p, %d}, %d )\n", (void*)pConvertor,
|
DO_DEBUG( opal_output( 0, "ompi_convertor_generic_simple_pack( %p, {%p, %d}, %d )\n", (void*)pConvertor,
|
||||||
iov[0].iov_base, iov[0].iov_len, *out_size ); );
|
iov[0].iov_base, iov[0].iov_len, *out_size ); );
|
||||||
@ -279,7 +281,7 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor,
|
|||||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||||
pos_desc = pStack->index;
|
pos_desc = pStack->index;
|
||||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||||
count_desc = pStack->count;
|
count_desc = (uint32_t)pStack->count;
|
||||||
pStack--;
|
pStack--;
|
||||||
pConvertor->stack_pos--;
|
pConvertor->stack_pos--;
|
||||||
pElem = &(description[pos_desc]);
|
pElem = &(description[pos_desc]);
|
||||||
@ -350,7 +352,7 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor,
|
|||||||
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
||||||
}
|
}
|
||||||
if( DT_LOOP == pElem->elem.common.type ) {
|
if( DT_LOOP == pElem->elem.common.type ) {
|
||||||
long local_disp = (long)source_base;
|
ptrdiff_t local_disp = (ptrdiff_t)source_base;
|
||||||
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
||||||
PACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc,
|
PACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc,
|
||||||
source_base, destination, iov_len_local );
|
source_base, destination, iov_len_local );
|
||||||
@ -360,9 +362,9 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor,
|
|||||||
}
|
}
|
||||||
/* Save the stack with the correct last_count value. */
|
/* Save the stack with the correct last_count value. */
|
||||||
}
|
}
|
||||||
local_disp = (long)source_base - local_disp;
|
local_disp = (ptrdiff_t)source_base - local_disp;
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
||||||
pStack->disp + local_disp, pos_desc + pElem->elem.disp + 1);
|
pStack->disp + local_disp);
|
||||||
pos_desc++;
|
pos_desc++;
|
||||||
update_loop_description: /* update the current state */
|
update_loop_description: /* update the current state */
|
||||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||||
@ -402,7 +404,7 @@ ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor,
|
|||||||
}
|
}
|
||||||
/* I complete an element, next step I should go to the next one */
|
/* I complete an element, next step I should go to the next one */
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc,
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc,
|
||||||
source_base - pStack->disp - pConvertor->pBaseBuf, pos_desc );
|
source_base - pStack->disp - pConvertor->pBaseBuf );
|
||||||
DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||||
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -18,19 +18,20 @@ static inline void pack_predefined_data( ompi_convertor_t* CONVERTOR,
|
|||||||
uint32_t* COUNT,
|
uint32_t* COUNT,
|
||||||
char** SOURCE,
|
char** SOURCE,
|
||||||
char** DESTINATION,
|
char** DESTINATION,
|
||||||
uint32_t* SPACE )
|
size_t* SPACE )
|
||||||
{
|
{
|
||||||
uint32_t _copy_count = *(COUNT), _copy_blength;
|
uint32_t _copy_count = *(COUNT);
|
||||||
|
size_t _copy_blength;
|
||||||
ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
||||||
char* _source = (*SOURCE) + _elem->disp;
|
char* _source = (*SOURCE) + _elem->disp;
|
||||||
|
|
||||||
_copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size;
|
_copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size;
|
||||||
if( (_copy_count * _copy_blength) > *(SPACE) ) {
|
if( (_copy_count * _copy_blength) > *(SPACE) ) {
|
||||||
_copy_count = *(SPACE) / _copy_blength;
|
_copy_count = (uint32_t)(*(SPACE) / _copy_blength);
|
||||||
if( 0 == _copy_count ) return; /* nothing to do */
|
if( 0 == _copy_count ) return; /* nothing to do */
|
||||||
}
|
}
|
||||||
|
|
||||||
if( _copy_blength == (uint32_t)_elem->extent ) {
|
if( (ptrdiff_t)_copy_blength == _elem->extent ) {
|
||||||
_copy_blength *= _copy_count;
|
_copy_blength *= _copy_count;
|
||||||
/* the extent and the size of the basic datatype are equals */
|
/* the extent and the size of the basic datatype are equals */
|
||||||
OMPI_DDT_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf,
|
OMPI_DDT_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf,
|
||||||
@ -63,16 +64,16 @@ static inline void pack_contiguous_loop( ompi_convertor_t* CONVERTOR,
|
|||||||
uint32_t* COUNT,
|
uint32_t* COUNT,
|
||||||
char** SOURCE,
|
char** SOURCE,
|
||||||
char** DESTINATION,
|
char** DESTINATION,
|
||||||
uint32_t* SPACE )
|
size_t* SPACE )
|
||||||
{
|
{
|
||||||
ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
||||||
ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items);
|
ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items);
|
||||||
char* _source = (*SOURCE) + _end_loop->first_elem_disp;
|
char* _source = (*SOURCE) + _end_loop->first_elem_disp;
|
||||||
size_t _copy_loops = *(COUNT);
|
uint32_t _copy_loops = *(COUNT);
|
||||||
uint32_t _i;
|
uint32_t _i;
|
||||||
|
|
||||||
if( (_copy_loops * _end_loop->size) > *(SPACE) )
|
if( (_copy_loops * _end_loop->size) > *(SPACE) )
|
||||||
_copy_loops = *(SPACE) / _end_loop->size;
|
_copy_loops = (uint32_t)(*(SPACE) / _end_loop->size);
|
||||||
for( _i = 0; _i < _copy_loops; _i++ ) {
|
for( _i = 0; _i < _copy_loops; _i++ ) {
|
||||||
OMPI_DDT_SAFEGUARD_POINTER( _source, _end_loop->size, (CONVERTOR)->pBaseBuf,
|
OMPI_DDT_SAFEGUARD_POINTER( _source, _end_loop->size, (CONVERTOR)->pBaseBuf,
|
||||||
(CONVERTOR)->pDesc, (CONVERTOR)->count );
|
(CONVERTOR)->pDesc, (CONVERTOR)->count );
|
||||||
|
@ -61,27 +61,28 @@ ompi_unpack_general_function( ompi_convertor_t* pConvertor,
|
|||||||
size_t* max_data,
|
size_t* max_data,
|
||||||
int32_t* freeAfter )
|
int32_t* freeAfter )
|
||||||
{
|
{
|
||||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||||
int count_desc; /* the number of items already done in the actual pos_desc */
|
int32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||||
int type = DT_CHAR; /* type at current position */
|
int type = DT_CHAR; /* type at current position */
|
||||||
uint32_t advance; /* number of bytes that we should advance the buffer */
|
ptrdiff_t advance; /* number of bytes that we should advance the buffer */
|
||||||
long disp_desc = 0; /* compute displacement for truncated data */
|
ptrdiff_t disp_desc = 0; /* compute displacement for truncated data */
|
||||||
int bConverted = 0; /* number of bytes converted this time */
|
size_t bConverted = 0; /* number of bytes converted this time */
|
||||||
const ompi_convertor_master_t* master = pConvertor->master;
|
const ompi_convertor_master_t* master = pConvertor->master;
|
||||||
dt_elem_desc_t* description;
|
dt_elem_desc_t* description;
|
||||||
long extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb;
|
ptrdiff_t extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb;
|
||||||
int oCount = extent * pConvertor->count;
|
size_t oCount = extent * pConvertor->count;
|
||||||
|
size_t iCount, total_bytes_converted = 0;
|
||||||
char* pInput;
|
char* pInput;
|
||||||
int iCount, rc;
|
int32_t rc;
|
||||||
uint32_t iov_count, total_bytes_converted = 0;
|
uint32_t iov_count;
|
||||||
|
|
||||||
/* For the general case always use the user data description */
|
/* For the general case always use the user data description */
|
||||||
description = pConvertor->use_desc->desc;
|
description = pConvertor->use_desc->desc;
|
||||||
|
|
||||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||||
pos_desc = pStack->index;
|
pos_desc = pStack->index;
|
||||||
count_desc = pStack->count;
|
count_desc = (int32_t)pStack->count;
|
||||||
disp_desc = pStack->disp;
|
disp_desc = pStack->disp;
|
||||||
pStack--;
|
pStack--;
|
||||||
pConvertor->stack_pos--;
|
pConvertor->stack_pos--;
|
||||||
@ -116,8 +117,7 @@ ompi_unpack_general_function( ompi_convertor_t* pConvertor,
|
|||||||
if( DT_LOOP == description[pos_desc].elem.common.type ) {
|
if( DT_LOOP == description[pos_desc].elem.common.type ) {
|
||||||
do {
|
do {
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos,
|
PUSH_STACK( pStack, pConvertor->stack_pos,
|
||||||
pos_desc, DT_LOOP, description[pos_desc].loop.loops,
|
pos_desc, DT_LOOP, description[pos_desc].loop.loops, pStack->disp );
|
||||||
pStack->disp, pos_desc + description[pos_desc].loop.items + 1 );
|
|
||||||
pos_desc++;
|
pos_desc++;
|
||||||
} while( DT_LOOP == description[pos_desc].loop.common.type ); /* let's start another loop */
|
} while( DT_LOOP == description[pos_desc].loop.common.type ); /* let's start another loop */
|
||||||
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, description, "advance loops" );
|
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, description, "advance loops" );
|
||||||
@ -140,7 +140,7 @@ ompi_unpack_general_function( ompi_convertor_t* pConvertor,
|
|||||||
count_desc -= rc;
|
count_desc -= rc;
|
||||||
disp_desc += rc * description[pos_desc].elem.extent;
|
disp_desc += rc * description[pos_desc].elem.extent;
|
||||||
if( iCount != 0 )
|
if( iCount != 0 )
|
||||||
printf( "unpack there is still room in the input buffer %d bytes\n", iCount );
|
printf( "unpack there is still room in the input buffer %ld bytes\n", (long)iCount );
|
||||||
goto save_and_return;
|
goto save_and_return;
|
||||||
}
|
}
|
||||||
pos_desc++; /* advance to the next data */
|
pos_desc++; /* advance to the next data */
|
||||||
@ -166,7 +166,7 @@ ompi_unpack_general_function( ompi_convertor_t* pConvertor,
|
|||||||
|
|
||||||
/* I complete an element, next step I should go to the next one */
|
/* I complete an element, next step I should go to the next one */
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, type,
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, type,
|
||||||
count_desc, disp_desc, pos_desc );
|
count_desc, disp_desc );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -189,11 +189,11 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv,
|
|||||||
{
|
{
|
||||||
const ompi_datatype_t *pData = pConv->pDesc;
|
const ompi_datatype_t *pData = pConv->pDesc;
|
||||||
char *user_memory, *packed_buffer;
|
char *user_memory, *packed_buffer;
|
||||||
uint32_t iov_count, initial_bytes_converted = pConv->bConverted;
|
uint32_t iov_count, i;
|
||||||
long extent = pData->ub - pData->lb;
|
size_t bConverted, remaining, length, initial_bytes_converted = pConv->bConverted;
|
||||||
uint32_t bConverted, length, remaining, i;
|
|
||||||
dt_stack_t* stack = &(pConv->pStack[1]);
|
dt_stack_t* stack = &(pConv->pStack[1]);
|
||||||
long initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp;
|
ptrdiff_t extent = pData->ub - pData->lb;
|
||||||
|
ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp;
|
||||||
|
|
||||||
DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( pBaseBuf %p, iov_count %d )\n",
|
DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( pBaseBuf %p, iov_count %d )\n",
|
||||||
pConv->pBaseBuf, *out_size ); );
|
pConv->pBaseBuf, *out_size ); );
|
||||||
@ -208,7 +208,7 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv,
|
|||||||
DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( user_memory %p, packed_buffer %p length %d\n",
|
DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( user_memory %p, packed_buffer %p length %d\n",
|
||||||
user_memory, packed_buffer, remaining ); );
|
user_memory, packed_buffer, remaining ); );
|
||||||
|
|
||||||
if( (long)pData->size == extent ) {
|
if( (ptrdiff_t)pData->size == extent ) {
|
||||||
user_memory += pConv->bConverted;
|
user_memory += pConv->bConverted;
|
||||||
|
|
||||||
/* contiguous data or basic datatype with count */
|
/* contiguous data or basic datatype with count */
|
||||||
@ -284,14 +284,14 @@ ompi_unpack_homogeneous_contig_function( ompi_convertor_t* pConv,
|
|||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
ompi_unpack_partial_datatype( ompi_convertor_t* pConvertor, dt_elem_desc_t* pElem,
|
ompi_unpack_partial_datatype( ompi_convertor_t* pConvertor, dt_elem_desc_t* pElem,
|
||||||
char* partial_data,
|
char* partial_data,
|
||||||
uint32_t start_position, uint32_t end_position,
|
ptrdiff_t start_position, ptrdiff_t end_position,
|
||||||
char** user_buffer )
|
char** user_buffer )
|
||||||
{
|
{
|
||||||
char unused_byte = 0x7F, saved_data[16];
|
char unused_byte = 0x7F, saved_data[16];
|
||||||
char temporary[16], *temporary_buffer = temporary;
|
char temporary[16], *temporary_buffer = temporary;
|
||||||
char* real_data = *user_buffer + pElem->elem.disp;
|
char* real_data = *user_buffer + pElem->elem.disp;
|
||||||
uint32_t i, count_desc = 1;
|
uint32_t i, length, count_desc = 1;
|
||||||
uint32_t data_length = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size;
|
size_t data_length = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size;
|
||||||
|
|
||||||
DO_DEBUG( opal_output( 0, "unpack partial data start %d end %d data_length %d user %p\n"
|
DO_DEBUG( opal_output( 0, "unpack partial data start %d end %d data_length %d user %p\n"
|
||||||
"\tbConverted %d total_length %d count %d\n",
|
"\tbConverted %d total_length %d count %d\n",
|
||||||
@ -300,7 +300,8 @@ ompi_unpack_partial_datatype( ompi_convertor_t* pConvertor, dt_elem_desc_t* pEle
|
|||||||
|
|
||||||
/* Find a byte that is not used in the partial buffer */
|
/* Find a byte that is not used in the partial buffer */
|
||||||
find_unused_byte:
|
find_unused_byte:
|
||||||
for( i = 0; i < (end_position - start_position); i++ ) {
|
length = (uint32_t)(end_position - start_position);
|
||||||
|
for( i = 0; i < length; i++ ) {
|
||||||
if( unused_byte == partial_data[i] ) {
|
if( unused_byte == partial_data[i] ) {
|
||||||
unused_byte--;
|
unused_byte--;
|
||||||
goto find_unused_byte;
|
goto find_unused_byte;
|
||||||
@ -356,7 +357,8 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor,
|
|||||||
dt_elem_desc_t* pElem;
|
dt_elem_desc_t* pElem;
|
||||||
const ompi_datatype_t *pData = pConvertor->pDesc;
|
const ompi_datatype_t *pData = pConvertor->pDesc;
|
||||||
char *user_memory_base, *packed_buffer;
|
char *user_memory_base, *packed_buffer;
|
||||||
uint32_t iov_len_local, iov_count;
|
size_t iov_len_local;
|
||||||
|
uint32_t iov_count;
|
||||||
|
|
||||||
DO_DEBUG( opal_output( 0, "ompi_convertor_generic_simple_unpack( %p, {%p, %lu}, %u )\n",
|
DO_DEBUG( opal_output( 0, "ompi_convertor_generic_simple_unpack( %p, {%p, %lu}, %u )\n",
|
||||||
(void*)pConvertor, iov[0].iov_base, (size_t)iov[0].iov_len, *out_size ); );
|
(void*)pConvertor, iov[0].iov_base, (size_t)iov[0].iov_len, *out_size ); );
|
||||||
@ -370,7 +372,7 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor,
|
|||||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||||
pos_desc = pStack->index;
|
pos_desc = pStack->index;
|
||||||
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
|
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
|
||||||
count_desc = pStack->count;
|
count_desc = (uint32_t)pStack->count;
|
||||||
pStack--;
|
pStack--;
|
||||||
pConvertor->stack_pos--;
|
pConvertor->stack_pos--;
|
||||||
pElem = &(description[pos_desc]);
|
pElem = &(description[pos_desc]);
|
||||||
@ -386,8 +388,8 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor,
|
|||||||
packed_buffer = iov[iov_count].iov_base;
|
packed_buffer = iov[iov_count].iov_base;
|
||||||
iov_len_local = iov[iov_count].iov_len;
|
iov_len_local = iov[iov_count].iov_len;
|
||||||
if( 0 != pConvertor->partial_length ) {
|
if( 0 != pConvertor->partial_length ) {
|
||||||
uint32_t element_length = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size;
|
size_t element_length = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size;
|
||||||
uint32_t missing_length = element_length - pConvertor->partial_length;
|
size_t missing_length = element_length - pConvertor->partial_length;
|
||||||
|
|
||||||
assert( pElem->elem.common.flags & DT_FLAG_DATA );
|
assert( pElem->elem.common.flags & DT_FLAG_DATA );
|
||||||
COMPUTE_CSUM( packed_buffer, missing_length, pConvertor );
|
COMPUTE_CSUM( packed_buffer, missing_length, pConvertor );
|
||||||
@ -430,7 +432,7 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor,
|
|||||||
packed_buffer, 0, iov_len_local,
|
packed_buffer, 0, iov_len_local,
|
||||||
&temp );
|
&temp );
|
||||||
|
|
||||||
pConvertor->partial_length = iov_len_local;
|
pConvertor->partial_length = (uint32_t)iov_len_local;
|
||||||
iov_len_local = 0;
|
iov_len_local = 0;
|
||||||
}
|
}
|
||||||
goto complete_loop;
|
goto complete_loop;
|
||||||
@ -462,7 +464,7 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor,
|
|||||||
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
||||||
}
|
}
|
||||||
if( DT_LOOP == pElem->elem.common.type ) {
|
if( DT_LOOP == pElem->elem.common.type ) {
|
||||||
long local_disp = (long)user_memory_base;
|
ptrdiff_t local_disp = (ptrdiff_t)user_memory_base;
|
||||||
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
||||||
UNPACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc,
|
UNPACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc,
|
||||||
packed_buffer, user_memory_base, iov_len_local );
|
packed_buffer, user_memory_base, iov_len_local );
|
||||||
@ -472,9 +474,9 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor,
|
|||||||
}
|
}
|
||||||
/* Save the stack with the correct last_count value. */
|
/* Save the stack with the correct last_count value. */
|
||||||
}
|
}
|
||||||
local_disp = (long)user_memory_base - local_disp;
|
local_disp = (ptrdiff_t)user_memory_base - local_disp;
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
||||||
pStack->disp + local_disp, pos_desc + pElem->elem.disp + 1);
|
pStack->disp + local_disp);
|
||||||
pos_desc++;
|
pos_desc++;
|
||||||
update_loop_description: /* update the current state */
|
update_loop_description: /* update the current state */
|
||||||
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
|
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
|
||||||
@ -496,7 +498,7 @@ ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor,
|
|||||||
}
|
}
|
||||||
/* I complete an element, next step I should go to the next one */
|
/* I complete an element, next step I should go to the next one */
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc,
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc,
|
||||||
user_memory_base - pStack->disp - pConvertor->pBaseBuf, pos_desc );
|
user_memory_base - pStack->disp - pConvertor->pBaseBuf );
|
||||||
DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||||
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -18,15 +18,16 @@ static inline void unpack_predefined_data( ompi_convertor_t* CONVERTOR, /* the c
|
|||||||
uint32_t* COUNT, /* the number of elements */
|
uint32_t* COUNT, /* the number of elements */
|
||||||
char** SOURCE, /* the source pointer */
|
char** SOURCE, /* the source pointer */
|
||||||
char** DESTINATION, /* the destination pointer */
|
char** DESTINATION, /* the destination pointer */
|
||||||
uint32_t* SPACE ) /* the space in the destination buffer */
|
size_t* SPACE ) /* the space in the destination buffer */
|
||||||
{
|
{
|
||||||
uint32_t _copy_count = *(COUNT), _copy_blength;
|
uint32_t _copy_count = *(COUNT);
|
||||||
|
size_t _copy_blength;
|
||||||
ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
||||||
char* _destination = (*DESTINATION) + _elem->disp;
|
char* _destination = (*DESTINATION) + _elem->disp;
|
||||||
|
|
||||||
_copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size;
|
_copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size;
|
||||||
if( (_copy_count * _copy_blength) > *(SPACE) ) {
|
if( (_copy_count * _copy_blength) > *(SPACE) ) {
|
||||||
_copy_count = *(SPACE) / _copy_blength;
|
_copy_count = (uint32_t)(*(SPACE) / _copy_blength);
|
||||||
if( 0 == _copy_count ) return; /* nothing to do */
|
if( 0 == _copy_count ) return; /* nothing to do */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,16 +64,16 @@ static inline void unpack_contiguous_loop( ompi_convertor_t* CONVERTOR,
|
|||||||
uint32_t* COUNT,
|
uint32_t* COUNT,
|
||||||
char** SOURCE,
|
char** SOURCE,
|
||||||
char** DESTINATION,
|
char** DESTINATION,
|
||||||
uint32_t* SPACE )
|
size_t* SPACE )
|
||||||
{
|
{
|
||||||
ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
||||||
ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items);
|
ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items);
|
||||||
char* _destination = (*DESTINATION) + _end_loop->first_elem_disp;
|
char* _destination = (*DESTINATION) + _end_loop->first_elem_disp;
|
||||||
size_t _copy_loops = *(COUNT);
|
uint32_t _copy_loops = *(COUNT);
|
||||||
uint32_t _i;
|
uint32_t _i;
|
||||||
|
|
||||||
if( (_copy_loops * _end_loop->size) > *(SPACE) )
|
if( (_copy_loops * _end_loop->size) > *(SPACE) )
|
||||||
_copy_loops = *(SPACE) / _end_loop->size;
|
_copy_loops = (uint32_t)(*(SPACE) / _end_loop->size);
|
||||||
for( _i = 0; _i < _copy_loops; _i++ ) {
|
for( _i = 0; _i < _copy_loops; _i++ ) {
|
||||||
OMPI_DDT_SAFEGUARD_POINTER( _destination, _end_loop->size, (CONVERTOR)->pBaseBuf,
|
OMPI_DDT_SAFEGUARD_POINTER( _destination, _end_loop->size, (CONVERTOR)->pBaseBuf,
|
||||||
(CONVERTOR)->pDesc, (CONVERTOR)->count );
|
(CONVERTOR)->pDesc, (CONVERTOR)->count );
|
||||||
|
@ -27,13 +27,13 @@
|
|||||||
#define UNSET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) & (~(DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS))
|
#define UNSET_CONTIGUOUS_FLAG( INT_VALUE ) (INT_VALUE) = (INT_VALUE) & (~(DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS))
|
||||||
|
|
||||||
#if defined(__GNUC__) && !defined(__STDC__)
|
#if defined(__GNUC__) && !defined(__STDC__)
|
||||||
#define LMAX(A,B) ({ long _a = (A), _b = (B); (_a < _b ? _b : _a) })
|
#define LMAX(A,B) ({ ptrdiff_t _a = (A), _b = (B); (_a < _b ? _b : _a) })
|
||||||
#define LMIN(A,B) ({ long _a = (A), _b = (B); (_a < _b ? _a : _b); })
|
#define LMIN(A,B) ({ ptrdiff_t _a = (A), _b = (B); (_a < _b ? _a : _b); })
|
||||||
#define IMAX(A,B) ({ int _a = (A), _b = (B); (_a < _b ? _b : _a); })
|
#define IMAX(A,B) ({ int _a = (A), _b = (B); (_a < _b ? _b : _a); })
|
||||||
#define IMIN(A,B) ({ int _a = (A), _b = (B); (_a < _b ? _a : _b); })
|
#define IMIN(A,B) ({ int _a = (A), _b = (B); (_a < _b ? _a : _b); })
|
||||||
#else
|
#else
|
||||||
static inline long LMAX( long a, long b ) { return ( a < b ? b : a ); }
|
static inline ptrdiff_t LMAX( ptrdiff_t a, ptrdiff_t b ) { return ( a < b ? b : a ); }
|
||||||
static inline long LMIN( long a, long b ) { return ( a < b ? a : b ); }
|
static inline ptrdiff_t LMIN( ptrdiff_t a, ptrdiff_t b ) { return ( a < b ? a : b ); }
|
||||||
static inline int IMAX( int a, int b ) { return ( a < b ? b : a ); }
|
static inline int IMAX( int a, int b ) { return ( a < b ? b : a ); }
|
||||||
static inline int IMIN( int a, int b ) { return ( a < b ? a : b ); }
|
static inline int IMIN( int a, int b ) { return ( a < b ? a : b ); }
|
||||||
#endif /* __GNU__ */
|
#endif /* __GNU__ */
|
||||||
@ -44,7 +44,7 @@ static inline int IMIN( int a, int b ) { return ( a < b ? a : b ); }
|
|||||||
_new_lb = (_old_lb) + (_disp); \
|
_new_lb = (_old_lb) + (_disp); \
|
||||||
_new_ub = (_old_ub) + (_disp); \
|
_new_ub = (_old_ub) + (_disp); \
|
||||||
} else { \
|
} else { \
|
||||||
long lower, upper; \
|
ptrdiff_t lower, upper; \
|
||||||
upper = (_disp) + (_old_extent) * ((_count) - 1); \
|
upper = (_disp) + (_old_extent) * ((_count) - 1); \
|
||||||
lower = (_disp); \
|
lower = (_disp); \
|
||||||
if( lower < upper ) { \
|
if( lower < upper ) { \
|
||||||
@ -74,12 +74,12 @@ static inline int IMIN( int a, int b ) { return ( a < b ? a : b ); }
|
|||||||
* set to ZERO if it's a empty datatype.
|
* set to ZERO if it's a empty datatype.
|
||||||
*/
|
*/
|
||||||
int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
||||||
uint32_t count, long disp, long extent )
|
uint32_t count, ptrdiff_t disp, ptrdiff_t extent )
|
||||||
{
|
{
|
||||||
uint32_t newLength, place_needed = 0, i;
|
uint32_t newLength, place_needed = 0, i;
|
||||||
short localFlags = 0; /* no specific options yet */
|
short localFlags = 0; /* no specific options yet */
|
||||||
dt_elem_desc_t *pLast, *pLoop = NULL;
|
dt_elem_desc_t *pLast, *pLoop = NULL;
|
||||||
long lb, ub, true_lb, true_ub, epsilon, old_true_ub;
|
ptrdiff_t lb, ub, true_lb, true_ub, epsilon, old_true_ub;
|
||||||
|
|
||||||
/* the extent should always be positive. So a negative
|
/* the extent should always be positive. So a negative
|
||||||
* value here have a special meaning ie. default extent as
|
* value here have a special meaning ie. default extent as
|
||||||
@ -97,7 +97,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
|||||||
pdtBase->lb = disp;
|
pdtBase->lb = disp;
|
||||||
pdtBase->flags |= DT_FLAG_USER_LB;
|
pdtBase->flags |= DT_FLAG_USER_LB;
|
||||||
}
|
}
|
||||||
if( (pdtBase->ub - pdtBase->lb) != (long)pdtBase->size ) {
|
if( (pdtBase->ub - pdtBase->lb) != (ptrdiff_t)pdtBase->size ) {
|
||||||
pdtBase->flags &= ~DT_FLAG_NO_GAPS;
|
pdtBase->flags &= ~DT_FLAG_NO_GAPS;
|
||||||
}
|
}
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
@ -109,12 +109,12 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
|||||||
pdtBase->ub = disp;
|
pdtBase->ub = disp;
|
||||||
pdtBase->flags |= DT_FLAG_USER_UB;
|
pdtBase->flags |= DT_FLAG_USER_UB;
|
||||||
}
|
}
|
||||||
if( (pdtBase->ub - pdtBase->lb) != (long)pdtBase->size ) {
|
if( (pdtBase->ub - pdtBase->lb) != (ptrdiff_t)pdtBase->size ) {
|
||||||
pdtBase->flags &= ~DT_FLAG_NO_GAPS;
|
pdtBase->flags &= ~DT_FLAG_NO_GAPS;
|
||||||
}
|
}
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
place_needed = (extent == (long)pdtAdd->size ? 1 : 3);
|
place_needed = (extent == (ptrdiff_t)pdtAdd->size ? 1 : 3);
|
||||||
} else {
|
} else {
|
||||||
place_needed = pdtAdd->desc.used;
|
place_needed = pdtAdd->desc.used;
|
||||||
if( count != 1 ) place_needed += 2; /* for the loop markers */
|
if( count != 1 ) place_needed += 2; /* for the loop markers */
|
||||||
@ -222,7 +222,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
|||||||
*/
|
*/
|
||||||
if( (pdtAdd->flags & (DT_FLAG_PREDEFINED | DT_FLAG_DATA)) == (DT_FLAG_PREDEFINED | DT_FLAG_DATA) ) {
|
if( (pdtAdd->flags & (DT_FLAG_PREDEFINED | DT_FLAG_DATA)) == (DT_FLAG_PREDEFINED | DT_FLAG_DATA) ) {
|
||||||
pdtBase->btypes[pdtAdd->id] += count;
|
pdtBase->btypes[pdtAdd->id] += count;
|
||||||
if( (extent != (long)pdtAdd->size) && (count > 1) ) { /* gaps around the datatype */
|
if( (extent != (ptrdiff_t)pdtAdd->size) && (count > 1) ) { /* gaps around the datatype */
|
||||||
localFlags = pdtAdd->flags & ~(DT_FLAG_COMMITED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS);
|
localFlags = pdtAdd->flags & ~(DT_FLAG_COMMITED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS);
|
||||||
CREATE_LOOP_START( pLast, count, 2, extent, localFlags );
|
CREATE_LOOP_START( pLast, count, 2, extent, localFlags );
|
||||||
pLast++;
|
pLast++;
|
||||||
@ -265,7 +265,7 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
|||||||
*/
|
*/
|
||||||
if( count != 1 ) {
|
if( count != 1 ) {
|
||||||
pLoop = pLast;
|
pLoop = pLast;
|
||||||
CREATE_LOOP_START( pLast, count, (long)pdtAdd->desc.used + 1, extent,
|
CREATE_LOOP_START( pLast, count, pdtAdd->desc.used + 1, extent,
|
||||||
(pdtAdd->flags & ~(DT_FLAG_COMMITED)) );
|
(pdtAdd->flags & ~(DT_FLAG_COMMITED)) );
|
||||||
pdtBase->btypes[DT_LOOP] += 2;
|
pdtBase->btypes[DT_LOOP] += 2;
|
||||||
pdtBase->desc.used += 2;
|
pdtBase->desc.used += 2;
|
||||||
@ -302,12 +302,12 @@ int32_t ompi_ddt_add( ompi_datatype_t* pdtBase, const ompi_datatype_t* pdtAdd,
|
|||||||
if( disp != old_true_ub ) { /* is there a gap between the 2 datatypes ? */
|
if( disp != old_true_ub ) { /* is there a gap between the 2 datatypes ? */
|
||||||
if( disp < old_true_ub ) pdtBase->flags |= DT_FLAG_OVERLAP;
|
if( disp < old_true_ub ) pdtBase->flags |= DT_FLAG_OVERLAP;
|
||||||
} else {
|
} else {
|
||||||
if( (localFlags & DT_FLAG_CONTIGUOUS) /* both have to be contiguous */
|
if( (localFlags & DT_FLAG_CONTIGUOUS) /* both have to be contiguous */
|
||||||
&& ( (((long)pdtAdd->size) == extent) /* the size and the extent of the added
|
&& ( ((ptrdiff_t)pdtAdd->size == extent) /* the size and the extent of the
|
||||||
* type have to match */
|
* added type have to match */
|
||||||
|| (count < 2)) ) { /* - if the count is bigger than 2 */
|
|| (count < 2)) ) { /* if the count is bigger than 2 */
|
||||||
SET_CONTIGUOUS_FLAG(pdtBase->flags);
|
SET_CONTIGUOUS_FLAG(pdtBase->flags);
|
||||||
if( ((long)pdtBase->size) == (pdtBase->ub - pdtBase->lb) )
|
if( (ptrdiff_t)pdtBase->size == (pdtBase->ub - pdtBase->lb) )
|
||||||
SET_NO_GAP_FLAG(pdtBase->flags);
|
SET_NO_GAP_FLAG(pdtBase->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,10 @@ static inline void copy_predefined_data( const dt_elem_desc_t* ELEM,
|
|||||||
uint32_t COUNT,
|
uint32_t COUNT,
|
||||||
char* SOURCE,
|
char* SOURCE,
|
||||||
char* DESTINATION,
|
char* DESTINATION,
|
||||||
uint32_t* SPACE )
|
size_t* SPACE )
|
||||||
{
|
{
|
||||||
uint32_t _copy_count = (COUNT), _copy_blength;
|
uint32_t _copy_count = (COUNT);
|
||||||
|
size_t _copy_blength;
|
||||||
const ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
const ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
||||||
char* _source = (SOURCE) + _elem->disp;
|
char* _source = (SOURCE) + _elem->disp;
|
||||||
char* _destination = (DESTINATION) + _elem->disp;
|
char* _destination = (DESTINATION) + _elem->disp;
|
||||||
@ -87,7 +88,7 @@ static inline void copy_contiguous_loop( const dt_elem_desc_t* ELEM,
|
|||||||
uint32_t COUNT,
|
uint32_t COUNT,
|
||||||
char* SOURCE,
|
char* SOURCE,
|
||||||
char* DESTINATION,
|
char* DESTINATION,
|
||||||
uint32_t* SPACE )
|
size_t* SPACE )
|
||||||
{
|
{
|
||||||
ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
||||||
ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items);
|
ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items);
|
||||||
@ -96,7 +97,7 @@ static inline void copy_contiguous_loop( const dt_elem_desc_t* ELEM,
|
|||||||
size_t _copy_loops = (COUNT);
|
size_t _copy_loops = (COUNT);
|
||||||
uint32_t _i;
|
uint32_t _i;
|
||||||
|
|
||||||
if( _loop->extent == (long)_end_loop->size ) { /* the loop is contiguous */
|
if( _loop->extent == (ptrdiff_t)_end_loop->size ) { /* the loop is contiguous */
|
||||||
_copy_loops *= _end_loop->size;
|
_copy_loops *= _end_loop->size;
|
||||||
OMPI_DDT_SAFEGUARD_POINTER( _source, _copy_loops, (SOURCE_BASE),
|
OMPI_DDT_SAFEGUARD_POINTER( _source, _copy_loops, (SOURCE_BASE),
|
||||||
(DATATYPE), (TOTAL_COUNT) );
|
(DATATYPE), (TOTAL_COUNT) );
|
||||||
@ -133,7 +134,7 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t
|
|||||||
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||||
dt_elem_desc_t* description;
|
dt_elem_desc_t* description;
|
||||||
dt_elem_desc_t* pElem;
|
dt_elem_desc_t* pElem;
|
||||||
uint32_t iov_len_local;
|
size_t iov_len_local;
|
||||||
char *source = source_base, *destination = destination_base;
|
char *source = source_base, *destination = destination_base;
|
||||||
|
|
||||||
DO_DEBUG( opal_output( 0, "ompi_ddt_copy_content_same_ddt( %p, %d, dst %p, src %p )\n",
|
DO_DEBUG( opal_output( 0, "ompi_ddt_copy_content_same_ddt( %p, %d, dst %p, src %p )\n",
|
||||||
@ -149,13 +150,13 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t
|
|||||||
* do a memcpy.
|
* do a memcpy.
|
||||||
*/
|
*/
|
||||||
if( (datatype->flags & DT_FLAG_CONTIGUOUS) == DT_FLAG_CONTIGUOUS ) {
|
if( (datatype->flags & DT_FLAG_CONTIGUOUS) == DT_FLAG_CONTIGUOUS ) {
|
||||||
long extent = (datatype->ub - datatype->lb);
|
ptrdiff_t extent = (datatype->ub - datatype->lb);
|
||||||
/* Now that we know the datatype is contiguous, we should move the 2 pointers
|
/* Now that we know the datatype is contiguous, we should move the 2 pointers
|
||||||
* source and destination to the correct displacement.
|
* source and destination to the correct displacement.
|
||||||
*/
|
*/
|
||||||
destination += datatype->lb;
|
destination += datatype->lb;
|
||||||
source += datatype->lb;
|
source += datatype->lb;
|
||||||
if( (long)datatype->size == extent ) { /* all contiguous == no gaps around */
|
if( (ptrdiff_t)datatype->size == extent ) { /* all contiguous == no gaps around */
|
||||||
size_t total_length = datatype->size * count;
|
size_t total_length = datatype->size * count;
|
||||||
size_t memcpy_chunk = ompi_datatype_memcpy_block_size;
|
size_t memcpy_chunk = ompi_datatype_memcpy_block_size;
|
||||||
while( total_length > 0 ) {
|
while( total_length > 0 ) {
|
||||||
@ -194,10 +195,8 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t
|
|||||||
|
|
||||||
if( datatype->opt_desc.desc != NULL ) {
|
if( datatype->opt_desc.desc != NULL ) {
|
||||||
description = datatype->opt_desc.desc;
|
description = datatype->opt_desc.desc;
|
||||||
pStack->end_loop = datatype->opt_desc.used;
|
|
||||||
} else {
|
} else {
|
||||||
description = datatype->desc.desc;
|
description = datatype->desc.desc;
|
||||||
pStack->end_loop = datatype->desc.used;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( description[0].elem.common.type == DT_LOOP )
|
if( description[0].elem.common.type == DT_LOOP )
|
||||||
@ -241,16 +240,16 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t
|
|||||||
pStack->count, stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
pStack->count, stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
||||||
}
|
}
|
||||||
if( DT_LOOP == pElem->elem.common.type ) {
|
if( DT_LOOP == pElem->elem.common.type ) {
|
||||||
long local_disp = (long)source;
|
ptrdiff_t local_disp = (ptrdiff_t)source;
|
||||||
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
||||||
COPY_CONTIGUOUS_LOOP( pElem, datatype, source_base, count, count_desc,
|
COPY_CONTIGUOUS_LOOP( pElem, datatype, source_base, count, count_desc,
|
||||||
source, destination, iov_len_local );
|
source, destination, iov_len_local );
|
||||||
pos_desc += pElem->loop.items + 1;
|
pos_desc += pElem->loop.items + 1;
|
||||||
goto update_loop_description;
|
goto update_loop_description;
|
||||||
}
|
}
|
||||||
local_disp = (long)source - local_disp;
|
local_disp = (ptrdiff_t)source - local_disp;
|
||||||
PUSH_STACK( pStack, stack_pos, pos_desc, DT_LOOP, count_desc,
|
PUSH_STACK( pStack, stack_pos, pos_desc, DT_LOOP, count_desc,
|
||||||
pStack->disp + local_disp, pos_desc + pElem->elem.disp + 1);
|
pStack->disp + local_disp);
|
||||||
pos_desc++;
|
pos_desc++;
|
||||||
update_loop_description: /* update the current state */
|
update_loop_description: /* update the current state */
|
||||||
source = source_base + pStack->disp;
|
source = source_base + pStack->disp;
|
||||||
|
@ -106,14 +106,14 @@ ompi_datatype_t* ompi_ddt_create( int32_t expectedSize )
|
|||||||
return datatype;
|
return datatype;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ompi_ddt_create_resized( const ompi_datatype_t* oldType, long lb, long extent, ompi_datatype_t** newType )
|
int32_t ompi_ddt_create_resized( const ompi_datatype_t* oldType, MPI_Aint lb, MPI_Aint extent, ompi_datatype_t** newType )
|
||||||
{
|
{
|
||||||
ompi_ddt_duplicate( oldType, newType );
|
ompi_ddt_duplicate( oldType, newType );
|
||||||
(*newType)->lb = lb;
|
(*newType)->lb = lb;
|
||||||
(*newType)->ub = lb + extent;
|
(*newType)->ub = lb + extent;
|
||||||
|
|
||||||
(*newType)->flags &= ~DT_FLAG_NO_GAPS;
|
(*newType)->flags &= ~DT_FLAG_NO_GAPS;
|
||||||
if( (extent == (long)oldType->size) && (oldType->flags & DT_FLAG_CONTIGUOUS) ) {
|
if( (extent == (ptrdiff_t)oldType->size) && (oldType->flags & DT_FLAG_CONTIGUOUS) ) {
|
||||||
(*newType)->flags |= DT_FLAG_NO_GAPS;
|
(*newType)->flags |= DT_FLAG_NO_GAPS;
|
||||||
}
|
}
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
|
@ -26,7 +26,7 @@ int32_t ompi_ddt_create_indexed( int count, const int* pBlockLength, const int*
|
|||||||
{
|
{
|
||||||
ompi_datatype_t* pdt;
|
ompi_datatype_t* pdt;
|
||||||
int i, dLength, endat, disp;
|
int i, dLength, endat, disp;
|
||||||
long extent = oldType->ub - oldType->lb;
|
ptrdiff_t extent = oldType->ub - oldType->lb;
|
||||||
|
|
||||||
if( 0 == count ) {
|
if( 0 == count ) {
|
||||||
*newType = ompi_ddt_create( 0 );
|
*newType = ompi_ddt_create( 0 );
|
||||||
@ -62,13 +62,13 @@ int32_t ompi_ddt_create_indexed( int count, const int* pBlockLength, const int*
|
|||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ompi_ddt_create_hindexed( int count, const int* pBlockLength, const long* pDisp,
|
int32_t ompi_ddt_create_hindexed( int count, const int* pBlockLength, const MPI_Aint* pDisp,
|
||||||
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
|
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
|
||||||
{
|
{
|
||||||
ompi_datatype_t* pdt;
|
ompi_datatype_t* pdt;
|
||||||
int i, dLength;
|
int i, dLength;
|
||||||
long extent = oldType->ub - oldType->lb;
|
ptrdiff_t extent = oldType->ub - oldType->lb;
|
||||||
long disp, endat;
|
ptrdiff_t disp, endat;
|
||||||
|
|
||||||
if( 0 == count ) {
|
if( 0 == count ) {
|
||||||
*newType = ompi_ddt_create( 0 );
|
*newType = ompi_ddt_create( 0 );
|
||||||
@ -108,7 +108,7 @@ int32_t ompi_ddt_create_indexed_block( int count, int bLength, const int* pDisp,
|
|||||||
{
|
{
|
||||||
ompi_datatype_t* pdt;
|
ompi_datatype_t* pdt;
|
||||||
int i, dLength, endat, disp;
|
int i, dLength, endat, disp;
|
||||||
long extent = oldType->ub - oldType->lb;
|
ptrdiff_t extent = oldType->ub - oldType->lb;
|
||||||
|
|
||||||
if( (count == 0) || (bLength == 0) ) {
|
if( (count == 0) || (bLength == 0) ) {
|
||||||
*newType = ompi_ddt_create(1);
|
*newType = ompi_ddt_create(1);
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
#include "ompi/datatype/datatype.h"
|
#include "ompi/datatype/datatype.h"
|
||||||
|
|
||||||
int32_t ompi_ddt_create_struct( int count, const int* pBlockLength, const long* pDisp,
|
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_datatype_t* const * pTypes, ompi_datatype_t** newType )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
long disp = 0, endto, lastExtent, lastDisp;
|
ptrdiff_t disp = 0, endto, lastExtent, lastDisp;
|
||||||
int lastBlock;
|
int lastBlock;
|
||||||
ompi_datatype_t *pdt, *lastType;
|
ompi_datatype_t *pdt, *lastType;
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ int32_t ompi_ddt_create_struct( int count, const int* pBlockLength, const long*
|
|||||||
lastDisp = pDisp[0];
|
lastDisp = pDisp[0];
|
||||||
endto = pDisp[0] + lastExtent * lastBlock;
|
endto = pDisp[0] + lastExtent * lastBlock;
|
||||||
|
|
||||||
pdt = ompi_ddt_create( disp );
|
pdt = ompi_ddt_create( (int32_t)disp );
|
||||||
|
|
||||||
/* Do again the same loop but now add the elements */
|
/* Do again the same loop but now add the elements */
|
||||||
for( i = 1; i < count; i++ ) {
|
for( i = 1; i < count; i++ ) {
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int32_t ompi_ddt_create_vector( int count, int bLength, long stride,
|
int32_t ompi_ddt_create_vector( int count, int bLength, int stride,
|
||||||
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
|
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
|
||||||
{
|
{
|
||||||
long extent = oldType->ub - oldType->lb;
|
ptrdiff_t extent = oldType->ub - oldType->lb;
|
||||||
ompi_datatype_t *pTempData, *pData;
|
ompi_datatype_t *pTempData, *pData;
|
||||||
|
|
||||||
if( 0 == count ) {
|
if( 0 == count ) {
|
||||||
@ -56,10 +56,10 @@ int32_t ompi_ddt_create_vector( int count, int bLength, long stride,
|
|||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ompi_ddt_create_hvector( int count, int bLength, long stride,
|
int32_t ompi_ddt_create_hvector( int count, int bLength, MPI_Aint stride,
|
||||||
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
|
const ompi_datatype_t* oldType, ompi_datatype_t** newType )
|
||||||
{
|
{
|
||||||
long extent = oldType->ub - oldType->lb;
|
ptrdiff_t extent = oldType->ub - oldType->lb;
|
||||||
ompi_datatype_t *pTempData, *pData;
|
ompi_datatype_t *pTempData, *pData;
|
||||||
|
|
||||||
if( 0 == count ) {
|
if( 0 == count ) {
|
||||||
|
@ -27,12 +27,12 @@
|
|||||||
* positive = number of basic elements inside
|
* positive = number of basic elements inside
|
||||||
* negative = some error occurs
|
* negative = some error occurs
|
||||||
*/
|
*/
|
||||||
int32_t ompi_ddt_get_element_count( const ompi_datatype_t* datatype, int32_t iSize )
|
int32_t ompi_ddt_get_element_count( const ompi_datatype_t* datatype, size_t iSize )
|
||||||
{
|
{
|
||||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||||
int rc, nbElems = 0;
|
int32_t nbElems = 0, stack_pos = 0;
|
||||||
int stack_pos = 0;
|
size_t local_size;
|
||||||
dt_elem_desc_t* pElems;
|
dt_elem_desc_t* pElems;
|
||||||
|
|
||||||
/* Normally the size should be less or equal to the size of the datatype.
|
/* Normally the size should be less or equal to the size of the datatype.
|
||||||
@ -45,7 +45,6 @@ int32_t ompi_ddt_get_element_count( const ompi_datatype_t* datatype, int32_t iSi
|
|||||||
pStack->index = -1;
|
pStack->index = -1;
|
||||||
pStack->disp = 0;
|
pStack->disp = 0;
|
||||||
pElems = datatype->desc.desc;
|
pElems = datatype->desc.desc;
|
||||||
pStack->end_loop = datatype->desc.used;
|
|
||||||
pos_desc = 0;
|
pos_desc = 0;
|
||||||
|
|
||||||
while( 1 ) { /* loop forever the exit condition is on the last DT_END_LOOP */
|
while( 1 ) { /* loop forever the exit condition is on the last DT_END_LOOP */
|
||||||
@ -68,8 +67,7 @@ int32_t ompi_ddt_get_element_count( const ompi_datatype_t* datatype, int32_t iSi
|
|||||||
if( DT_LOOP == pElems[pos_desc].elem.common.type ) {
|
if( DT_LOOP == pElems[pos_desc].elem.common.type ) {
|
||||||
ddt_loop_desc_t* loop = &(pElems[pos_desc].loop);
|
ddt_loop_desc_t* loop = &(pElems[pos_desc].loop);
|
||||||
do {
|
do {
|
||||||
PUSH_STACK( pStack, stack_pos, pos_desc, DT_LOOP, loop->loops,
|
PUSH_STACK( pStack, stack_pos, pos_desc, DT_LOOP, loop->loops, 0 );
|
||||||
0, pos_desc + loop->items );
|
|
||||||
pos_desc++;
|
pos_desc++;
|
||||||
} while( DT_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */
|
} while( DT_LOOP == pElems[pos_desc].elem.common.type ); /* let's start another loop */
|
||||||
DDT_DUMP_STACK( pStack, stack_pos, pElems, "advance loops" );
|
DDT_DUMP_STACK( pStack, stack_pos, pElems, "advance loops" );
|
||||||
@ -78,15 +76,15 @@ int32_t ompi_ddt_get_element_count( const ompi_datatype_t* datatype, int32_t iSi
|
|||||||
while( pElems[pos_desc].elem.common.flags & DT_FLAG_DATA ) {
|
while( pElems[pos_desc].elem.common.flags & DT_FLAG_DATA ) {
|
||||||
/* now here we have a basic datatype */
|
/* now here we have a basic datatype */
|
||||||
const ompi_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]);
|
const ompi_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]);
|
||||||
rc = pElems[pos_desc].elem.count * basic_type->size;
|
local_size = pElems[pos_desc].elem.count * basic_type->size;
|
||||||
if( rc >= iSize ) {
|
if( local_size >= iSize ) {
|
||||||
rc = iSize / basic_type->size;
|
local_size = iSize / basic_type->size;
|
||||||
nbElems += rc;
|
nbElems += (int32_t)local_size;
|
||||||
iSize -= rc * basic_type->size;
|
iSize -= local_size * basic_type->size;
|
||||||
return (iSize == 0 ? nbElems : -1);
|
return (iSize == 0 ? nbElems : -1);
|
||||||
}
|
}
|
||||||
nbElems += pElems[pos_desc].elem.count;
|
nbElems += pElems[pos_desc].elem.count;
|
||||||
iSize -= rc;
|
iSize -= local_size;
|
||||||
pos_desc++; /* advance to the next data */
|
pos_desc++; /* advance to the next data */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ ompi_ddt_match_size( int size, uint16_t datakind, uint16_t datalang )
|
|||||||
continue;
|
continue;
|
||||||
if( (datatype->flags & DT_FLAG_DATA_TYPE) != datakind )
|
if( (datatype->flags & DT_FLAG_DATA_TYPE) != datakind )
|
||||||
continue;
|
continue;
|
||||||
if( (unsigned long)size == datatype->size ) {
|
if( (size_t)size == datatype->size ) {
|
||||||
return datatype;
|
return datatype;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ const ompi_datatype_t* ompi_ddt_basicDatatypes[DT_MAX_PREDEFINED] = {
|
|||||||
|
|
||||||
ompi_pointer_array_t *ompi_datatype_f_to_c_table = NULL;
|
ompi_pointer_array_t *ompi_datatype_f_to_c_table = NULL;
|
||||||
|
|
||||||
int ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
|
size_t ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
|
||||||
|
|
||||||
#define COPY_DATA_DESC( PDST, PSRC ) \
|
#define COPY_DATA_DESC( PDST, PSRC ) \
|
||||||
do { \
|
do { \
|
||||||
@ -316,20 +316,20 @@ int ompi_ddt_local_sizes[DT_MAX_PREDEFINED];
|
|||||||
ompi_datatype_t* types[2]; \
|
ompi_datatype_t* types[2]; \
|
||||||
ompi_datatype_t* ptype; \
|
ompi_datatype_t* ptype; \
|
||||||
int bLength[2] = {1, 1}; \
|
int bLength[2] = {1, 1}; \
|
||||||
long base, displ[2]; \
|
MPI_Aint base, displ[2]; \
|
||||||
\
|
\
|
||||||
types[0] = (ompi_datatype_t*)ompi_ddt_basicDatatypes[MPIType1]; \
|
types[0] = (ompi_datatype_t*)ompi_ddt_basicDatatypes[MPIType1]; \
|
||||||
types[1] = (ompi_datatype_t*)ompi_ddt_basicDatatypes[MPIType2]; \
|
types[1] = (ompi_datatype_t*)ompi_ddt_basicDatatypes[MPIType2]; \
|
||||||
base = (long)(&(s[0])); \
|
base = (ptrdiff_t)(&(s[0])); \
|
||||||
displ[0] = (long)(&(s[0].v1)); \
|
displ[0] = (ptrdiff_t)(&(s[0].v1)); \
|
||||||
displ[0] -= base; \
|
displ[0] -= base; \
|
||||||
displ[1] = (long)(&(s[0].v2)); \
|
displ[1] = (ptrdiff_t)(&(s[0].v2)); \
|
||||||
displ[1] -= base; \
|
displ[1] -= base; \
|
||||||
\
|
\
|
||||||
ompi_ddt_create_struct( 2, bLength, displ, types, &ptype ); \
|
ompi_ddt_create_struct( 2, bLength, displ, types, &ptype ); \
|
||||||
displ[0] = (long)(&(s[1])); \
|
displ[0] = (ptrdiff_t)(&(s[1])); \
|
||||||
displ[0] -= base; \
|
displ[0] -= base; \
|
||||||
if( displ[0] != (displ[1] + (long)sizeof(type2)) ) \
|
if( displ[0] != (displ[1] + (ptrdiff_t)sizeof(type2)) ) \
|
||||||
ptype->ub = displ[0]; /* force a new extent for the datatype */ \
|
ptype->ub = displ[0]; /* force a new extent for the datatype */ \
|
||||||
ptype->flags |= (FLAGS); \
|
ptype->flags |= (FLAGS); \
|
||||||
ptype->id = MPIDDT; \
|
ptype->id = MPIDDT; \
|
||||||
@ -418,7 +418,7 @@ int32_t ompi_ddt_init( void )
|
|||||||
|
|
||||||
datatype->btypes[i] = 1;
|
datatype->btypes[i] = 1;
|
||||||
/* Check if the data contain gaps */
|
/* Check if the data contain gaps */
|
||||||
if( (datatype->ub - datatype->lb) == (long)datatype->size ) {
|
if( (datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size ) {
|
||||||
datatype->desc.desc[0].elem.common.flags |= DT_FLAG_NO_GAPS;
|
datatype->desc.desc[0].elem.common.flags |= DT_FLAG_NO_GAPS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -594,7 +594,7 @@ int32_t ompi_ddt_init( void )
|
|||||||
for( i = 0; i < ompi_mpi_cxx_ldblcplex.d_f_to_c_index; i++ ) {
|
for( i = 0; i < ompi_mpi_cxx_ldblcplex.d_f_to_c_index; i++ ) {
|
||||||
ompi_datatype_t* datatype = (ompi_datatype_t*)ompi_pointer_array_get_item( ompi_datatype_f_to_c_table, i );
|
ompi_datatype_t* datatype = (ompi_datatype_t*)ompi_pointer_array_get_item( ompi_datatype_f_to_c_table, i );
|
||||||
|
|
||||||
if( (datatype->ub - datatype->lb) == (long)datatype->size ) {
|
if( (datatype->ub - datatype->lb) == (ptrdiff_t)datatype->size ) {
|
||||||
datatype->flags |= DT_FLAG_NO_GAPS;
|
datatype->flags |= DT_FLAG_NO_GAPS;
|
||||||
} else {
|
} else {
|
||||||
datatype->flags &= ~DT_FLAG_NO_GAPS;
|
datatype->flags &= ~DT_FLAG_NO_GAPS;
|
||||||
@ -714,11 +714,11 @@ static int __dump_data_desc( dt_elem_desc_t* pDesc, int nbElems, char* ptr, size
|
|||||||
(int)pDesc->loop.extent );
|
(int)pDesc->loop.extent );
|
||||||
else if( DT_END_LOOP == pDesc->elem.common.type )
|
else if( DT_END_LOOP == pDesc->elem.common.type )
|
||||||
index += snprintf( ptr + index, length - index, "prev %d elements first elem displacement %ld size of data %d\n",
|
index += snprintf( ptr + index, length - index, "prev %d elements first elem displacement %ld size of data %d\n",
|
||||||
(int)pDesc->end_loop.items, pDesc->end_loop.first_elem_disp,
|
(int)pDesc->end_loop.items, (long)pDesc->end_loop.first_elem_disp,
|
||||||
(int)pDesc->end_loop.size );
|
(int)pDesc->end_loop.size );
|
||||||
else
|
else
|
||||||
index += snprintf( ptr + index, length - index, "count %d disp 0x%lx (%ld) extent %d (size %ld)\n",
|
index += snprintf( ptr + index, length - index, "count %d disp 0x%lx (%ld) extent %d (size %ld)\n",
|
||||||
(int)pDesc->elem.count, pDesc->elem.disp, pDesc->elem.disp,
|
(int)pDesc->elem.count, (long)pDesc->elem.disp, (long)pDesc->elem.disp,
|
||||||
(int)pDesc->elem.extent, pDesc->elem.count * ompi_ddt_basicDatatypes[pDesc->elem.common.type]->size );
|
(int)pDesc->elem.extent, pDesc->elem.count * ompi_ddt_basicDatatypes[pDesc->elem.common.type]->size );
|
||||||
pDesc++;
|
pDesc++;
|
||||||
|
|
||||||
@ -757,8 +757,8 @@ void ompi_ddt_dump( const ompi_datatype_t* pData )
|
|||||||
"true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n"
|
"true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n"
|
||||||
"nbElems %d loops %d flags %X (",
|
"nbElems %d loops %d flags %X (",
|
||||||
(void*)pData, pData->name, pData->size, (int)pData->align, pData->id, (int)pData->desc.length, (int)pData->desc.used,
|
(void*)pData, pData->name, pData->size, (int)pData->align, pData->id, (int)pData->desc.length, (int)pData->desc.used,
|
||||||
pData->true_lb, pData->true_ub, pData->true_ub - pData->true_lb,
|
(long)pData->true_lb, (long)pData->true_ub, (long)(pData->true_ub - pData->true_lb),
|
||||||
pData->lb, pData->ub, pData->ub - pData->lb,
|
(long)pData->lb, (long)pData->ub, (long)(pData->ub - pData->lb),
|
||||||
(int)pData->nbElems, (int)pData->btypes[DT_LOOP], (int)pData->flags );
|
(int)pData->nbElems, (int)pData->btypes[DT_LOOP], (int)pData->flags );
|
||||||
/* dump the flags */
|
/* dump the flags */
|
||||||
if( pData->flags == DT_FLAG_PREDEFINED )
|
if( pData->flags == DT_FLAG_PREDEFINED )
|
||||||
|
@ -49,7 +49,8 @@ static inline int SAVE_OPTIMIZED_ELEMENT( dt_elem_desc_t* pElemDesc,
|
|||||||
|
|
||||||
static inline int ADD_ELEMENT( dt_elem_desc_t* pElemDesc,
|
static inline int ADD_ELEMENT( dt_elem_desc_t* pElemDesc,
|
||||||
ddt_elem_desc_t* opt_elem,
|
ddt_elem_desc_t* opt_elem,
|
||||||
uint16_t type, uint32_t count, long disp, int32_t extent )
|
uint16_t type, uint32_t count,
|
||||||
|
ptrdiff_t disp, int32_t extent )
|
||||||
{
|
{
|
||||||
if( 0 == opt_elem->count ) {
|
if( 0 == opt_elem->count ) {
|
||||||
opt_elem->common.flags = DT_FLAG_BASIC;
|
opt_elem->common.flags = DT_FLAG_BASIC;
|
||||||
@ -69,18 +70,19 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData,
|
|||||||
{
|
{
|
||||||
dt_elem_desc_t* pElemDesc;
|
dt_elem_desc_t* pElemDesc;
|
||||||
ddt_elem_desc_t opt_elem;
|
ddt_elem_desc_t opt_elem;
|
||||||
long last_disp = 0;
|
ptrdiff_t last_disp = 0;
|
||||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||||
int32_t pos_desc = 0; /* actual position in the description of the derived datatype */
|
int32_t pos_desc = 0; /* actual position in the description of the derived datatype */
|
||||||
int32_t stack_pos = 0, last_type = DT_BYTE;
|
int32_t stack_pos = 0, last_type = DT_BYTE;
|
||||||
int32_t type = DT_LOOP, last_length = 0, nbElems = 0, changes = 0, last_extent = 1;
|
int32_t type = DT_LOOP, nbElems = 0, changes = 0;
|
||||||
uint16_t last_flags = 0xFFFF; /* keep all for the first datatype */
|
|
||||||
long total_disp = 0;
|
|
||||||
int32_t optimized = 0, continuity;
|
int32_t optimized = 0, continuity;
|
||||||
|
uint16_t last_flags = 0xFFFF; /* keep all for the first datatype */
|
||||||
|
ptrdiff_t total_disp = 0, last_extent = 1;
|
||||||
|
int32_t last_length = 0;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (pData->btypes[DT_LOOP]+2) );
|
pStack = (dt_stack_t*)alloca( sizeof(dt_stack_t) * (pData->btypes[DT_LOOP]+2) );
|
||||||
SAVE_STACK( pStack, -1, 0, count, 0, pData->desc.used );
|
SAVE_STACK( pStack, -1, 0, count, 0 );
|
||||||
|
|
||||||
pTypeDesc->length = 2 * pData->desc.used + 1 /* for the fake DT_END_LOOP at the end */;
|
pTypeDesc->length = 2 * pData->desc.used + 1 /* for the fake DT_END_LOOP at the end */;
|
||||||
pTypeDesc->desc = pElemDesc = (dt_elem_desc_t*)malloc( sizeof(dt_elem_desc_t) * pTypeDesc->length );
|
pTypeDesc->desc = pElemDesc = (dt_elem_desc_t*)malloc( sizeof(dt_elem_desc_t) * pTypeDesc->length );
|
||||||
@ -119,13 +121,13 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData,
|
|||||||
ddt_loop_desc_t* loop = (ddt_loop_desc_t*)&(pData->desc.desc[pos_desc]);
|
ddt_loop_desc_t* loop = (ddt_loop_desc_t*)&(pData->desc.desc[pos_desc]);
|
||||||
ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)&(pData->desc.desc[pos_desc + loop->items]);
|
ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)&(pData->desc.desc[pos_desc + loop->items]);
|
||||||
int index = GET_FIRST_NON_LOOP( &(pData->desc.desc[pos_desc]) );
|
int index = GET_FIRST_NON_LOOP( &(pData->desc.desc[pos_desc]) );
|
||||||
long loop_disp = pData->desc.desc[pos_desc + index].elem.disp;
|
ptrdiff_t loop_disp = pData->desc.desc[pos_desc + index].elem.disp;
|
||||||
|
|
||||||
continuity = ((last_disp + last_length * (long)ompi_ddt_basicDatatypes[last_type]->size)
|
continuity = ((last_disp + last_length * (ptrdiff_t)ompi_ddt_basicDatatypes[last_type]->size)
|
||||||
== (total_disp + loop_disp));
|
== (total_disp + loop_disp));
|
||||||
if( loop->common.flags & DT_FLAG_CONTIGUOUS ) {
|
if( loop->common.flags & DT_FLAG_CONTIGUOUS ) {
|
||||||
/* the loop is contiguous or composed by contiguous elements with a gap */
|
/* the loop is contiguous or composed by contiguous elements with a gap */
|
||||||
if( loop->extent == (long)end_loop->size ) {
|
if( loop->extent == (ptrdiff_t)end_loop->size ) {
|
||||||
/* the whole loop is contiguous */
|
/* the whole loop is contiguous */
|
||||||
if( !continuity ) {
|
if( !continuity ) {
|
||||||
if( 0 != last_length ) {
|
if( 0 != last_length ) {
|
||||||
@ -160,7 +162,7 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData,
|
|||||||
/* we have a gap in the begining or the end of the loop but the whole
|
/* we have a gap in the begining or the end of the loop but the whole
|
||||||
* loop can be merged in just one memcpy.
|
* loop can be merged in just one memcpy.
|
||||||
*/
|
*/
|
||||||
CREATE_LOOP_START( pElemDesc, counter, (long)2, loop->extent, loop->common.flags );
|
CREATE_LOOP_START( pElemDesc, counter, 2, loop->extent, loop->common.flags );
|
||||||
pElemDesc++; nbElems++;
|
pElemDesc++; nbElems++;
|
||||||
CREATE_ELEM( pElemDesc, DT_BYTE, DT_FLAG_BASIC, end_loop->size, loop_disp, 1);
|
CREATE_ELEM( pElemDesc, DT_BYTE, DT_FLAG_BASIC, end_loop->size, loop_disp, 1);
|
||||||
pElemDesc++; nbElems++;
|
pElemDesc++; nbElems++;
|
||||||
@ -182,7 +184,7 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData,
|
|||||||
}
|
}
|
||||||
if( 2 == loop->items ) { /* small loop */
|
if( 2 == loop->items ) { /* small loop */
|
||||||
if( (1 == elem->count)
|
if( (1 == elem->count)
|
||||||
&& (elem->extent == (long)ompi_ddt_basicDatatypes[elem->common.type]->size) ) {
|
&& (elem->extent == (ptrdiff_t)ompi_ddt_basicDatatypes[elem->common.type]->size) ) {
|
||||||
CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags & ~DT_FLAG_CONTIGUOUS,
|
CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags & ~DT_FLAG_CONTIGUOUS,
|
||||||
loop->loops, elem->disp, loop->extent );
|
loop->loops, elem->disp, loop->extent );
|
||||||
pElemDesc++; nbElems++;
|
pElemDesc++; nbElems++;
|
||||||
@ -190,7 +192,7 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData,
|
|||||||
changes++; optimized++;
|
changes++; optimized++;
|
||||||
goto complete_loop;
|
goto complete_loop;
|
||||||
} else if( loop->loops < 3 ) {
|
} else if( loop->loops < 3 ) {
|
||||||
long elem_displ = elem->disp;
|
ptrdiff_t elem_displ = elem->disp;
|
||||||
for( i = 0; i < loop->loops; i++ ) {
|
for( i = 0; i < loop->loops; i++ ) {
|
||||||
CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags,
|
CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags,
|
||||||
elem->count, elem_displ, elem->extent );
|
elem->count, elem_displ, elem->extent );
|
||||||
@ -204,7 +206,7 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData,
|
|||||||
}
|
}
|
||||||
CREATE_LOOP_START( pElemDesc, loop->loops, loop->items, loop->extent, loop->common.flags );
|
CREATE_LOOP_START( pElemDesc, loop->loops, loop->items, loop->extent, loop->common.flags );
|
||||||
pElemDesc++; nbElems++;
|
pElemDesc++; nbElems++;
|
||||||
PUSH_STACK( pStack, stack_pos, nbElems, DT_LOOP, loop->loops, total_disp, pos_desc + loop->extent );
|
PUSH_STACK( pStack, stack_pos, nbElems, DT_LOOP, loop->loops, total_disp );
|
||||||
pos_desc++;
|
pos_desc++;
|
||||||
DDT_DUMP_STACK( pStack, stack_pos, pData->desc.desc, "advance loops" );
|
DDT_DUMP_STACK( pStack, stack_pos, pData->desc.desc, "advance loops" );
|
||||||
}
|
}
|
||||||
@ -215,7 +217,7 @@ ompi_ddt_optimize_short( ompi_datatype_t* pData,
|
|||||||
while( pData->desc.desc[pos_desc].elem.common.flags & DT_FLAG_DATA ) { /* keep doing it until we reach a non datatype element */
|
while( pData->desc.desc[pos_desc].elem.common.flags & DT_FLAG_DATA ) { /* keep doing it until we reach a non datatype element */
|
||||||
/* now here we have a basic datatype */
|
/* now here we have a basic datatype */
|
||||||
type = pData->desc.desc[pos_desc].elem.common.type;
|
type = pData->desc.desc[pos_desc].elem.common.type;
|
||||||
continuity = ((last_disp + last_length * (long)ompi_ddt_basicDatatypes[last_type]->size)
|
continuity = ((last_disp + last_length * (ptrdiff_t)ompi_ddt_basicDatatypes[last_type]->size)
|
||||||
== (total_disp + pData->desc.desc[pos_desc].elem.disp));
|
== (total_disp + pData->desc.desc[pos_desc].elem.disp));
|
||||||
|
|
||||||
if( (pData->desc.desc[pos_desc].elem.common.flags & DT_FLAG_CONTIGUOUS) && continuity &&
|
if( (pData->desc.desc[pos_desc].elem.common.flags & DT_FLAG_CONTIGUOUS) && continuity &&
|
||||||
@ -264,7 +266,7 @@ int32_t ompi_ddt_commit( ompi_datatype_t** data )
|
|||||||
{
|
{
|
||||||
ompi_datatype_t* pData = *data;
|
ompi_datatype_t* pData = *data;
|
||||||
ddt_endloop_desc_t* pLast = &(pData->desc.desc[pData->desc.used].end_loop);
|
ddt_endloop_desc_t* pLast = &(pData->desc.desc[pData->desc.used].end_loop);
|
||||||
long first_elem_disp = 0;
|
ptrdiff_t first_elem_disp = 0;
|
||||||
|
|
||||||
if( pData->flags & DT_FLAG_COMMITED ) return OMPI_SUCCESS;
|
if( pData->flags & DT_FLAG_COMMITED ) return OMPI_SUCCESS;
|
||||||
pData->flags |= DT_FLAG_COMMITED;
|
pData->flags |= DT_FLAG_COMMITED;
|
||||||
@ -299,7 +301,7 @@ int32_t ompi_ddt_commit( ompi_datatype_t** data )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the data is contiguous is useless to generate an optimized version. */
|
/* If the data is contiguous is useless to generate an optimized version. */
|
||||||
/*if( (long)pData->size == (pData->true_ub - pData->true_lb) ) return OMPI_SUCCESS; */
|
/*if( pData->size == (pData->true_ub - pData->true_lb) ) return OMPI_SUCCESS; */
|
||||||
|
|
||||||
(void)ompi_ddt_optimize_short( pData, 1, &(pData->opt_desc) );
|
(void)ompi_ddt_optimize_short( pData, 1, &(pData->opt_desc) );
|
||||||
if( 0 != pData->opt_desc.used ) {
|
if( 0 != pData->opt_desc.used ) {
|
||||||
|
@ -59,8 +59,8 @@ int32_t ompi_ddt_sndrcv( void *sbuf, int32_t scount, const ompi_datatype_t* sdty
|
|||||||
|
|
||||||
/* If same datatypes used, just copy. */
|
/* If same datatypes used, just copy. */
|
||||||
if (sdtype == rdtype) {
|
if (sdtype == rdtype) {
|
||||||
max_data = ( scount < rcount ? scount : rcount );
|
int32_t count = ( scount < rcount ? scount : rcount );
|
||||||
ompi_ddt_copy_content_same_ddt(rdtype, max_data, (char*)rbuf, (char*)sbuf);
|
ompi_ddt_copy_content_same_ddt(rdtype, count, (char*)rbuf, (char*)sbuf);
|
||||||
return ((scount > rcount) ? MPI_ERR_TRUNCATE : MPI_SUCCESS);
|
return ((scount > rcount) ? MPI_ERR_TRUNCATE : MPI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
||||||
int starting_point,
|
size_t starting_point,
|
||||||
const int* sizes );
|
const size_t* sizes );
|
||||||
|
|
||||||
static inline size_t
|
static inline size_t
|
||||||
ompi_convertor_compute_remote_size( const ompi_datatype_t* pData, const int* sizes )
|
ompi_convertor_compute_remote_size( const ompi_datatype_t* pData, const size_t* sizes )
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
@ -45,21 +45,20 @@ ompi_convertor_compute_remote_size( const ompi_datatype_t* pData, const int* siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
||||||
int starting_point, const int* sizes )
|
size_t starting_point, const size_t* sizes )
|
||||||
{
|
{
|
||||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||||
int pos_desc; /* actual position in the description of the derived datatype */
|
int pos_desc; /* actual position in the description of the derived datatype */
|
||||||
int lastLength = 0, loop_length;
|
size_t lastLength = 0;
|
||||||
const ompi_datatype_t* pData = pConvertor->pDesc;
|
const ompi_datatype_t* pData = pConvertor->pDesc;
|
||||||
int* remoteLength;
|
size_t loop_length, *remoteLength, remote_size;
|
||||||
int resting_place = starting_point;
|
size_t resting_place = starting_point;
|
||||||
dt_elem_desc_t* pElems;
|
dt_elem_desc_t* pElems;
|
||||||
size_t remote_size;
|
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
|
|
||||||
assert( 0 != starting_point );
|
assert( 0 != starting_point );
|
||||||
assert( pConvertor->bConverted != (unsigned long)starting_point );
|
assert( pConvertor->bConverted != starting_point );
|
||||||
assert( starting_point <= (int)(pConvertor->count * pData->size) );
|
assert( starting_point <=(pConvertor->count * pData->size) );
|
||||||
|
|
||||||
/*opal_output( 0, "Data extent %d size %d count %d total_size %d starting_point %d\n",
|
/*opal_output( 0, "Data extent %d size %d count %d total_size %d starting_point %d\n",
|
||||||
pData->ub - pData->lb, pData->size, pConvertor->count,
|
pData->ub - pData->lb, pData->size, pConvertor->count,
|
||||||
@ -71,25 +70,23 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
|||||||
* allow us to move quickly inside the datatype when we have a count.
|
* allow us to move quickly inside the datatype when we have a count.
|
||||||
*/
|
*/
|
||||||
pElems = pConvertor->use_desc->desc;
|
pElems = pConvertor->use_desc->desc;
|
||||||
pStack->end_loop = pConvertor->use_desc->used;
|
|
||||||
|
|
||||||
if( (pConvertor->flags & CONVERTOR_HOMOGENEOUS) && (pData->flags & DT_FLAG_CONTIGUOUS) ) {
|
if( (pConvertor->flags & CONVERTOR_HOMOGENEOUS) && (pData->flags & DT_FLAG_CONTIGUOUS) ) {
|
||||||
/* Special case for contiguous datatypes */
|
/* Special case for contiguous datatypes */
|
||||||
int cnt = starting_point / pData->size;
|
int32_t cnt = (int32_t)(starting_point / pData->size);
|
||||||
long extent = pData->ub - pData->lb;
|
ptrdiff_t extent = pData->ub - pData->lb;
|
||||||
|
|
||||||
loop_length = GET_FIRST_NON_LOOP( pElems );
|
loop_length = GET_FIRST_NON_LOOP( pElems );
|
||||||
pStack[0].disp = pElems[loop_length].elem.disp;
|
pStack[0].disp = pElems[loop_length].elem.disp;
|
||||||
pStack[0].type = DT_LOOP;
|
pStack[0].type = DT_LOOP;
|
||||||
pStack[0].count = pConvertor->count - cnt;
|
pStack[0].count = pConvertor->count - cnt;
|
||||||
cnt = starting_point - cnt * pData->size; /* number of bytes after the loop */
|
cnt = (int32_t)(starting_point - cnt * pData->size); /* number of bytes after the loop */
|
||||||
pStack[1].index = 0;
|
pStack[1].index = 0;
|
||||||
pStack[1].type = DT_BYTE;
|
pStack[1].type = DT_BYTE;
|
||||||
pStack[1].end_loop = pStack->end_loop;
|
|
||||||
pStack[1].disp = pStack[0].disp;
|
pStack[1].disp = pStack[0].disp;
|
||||||
pStack[1].count = pData->size - cnt;
|
pStack[1].count = pData->size - cnt;
|
||||||
|
|
||||||
if( (long)pData->size == extent ) { /* all elements are contiguous */
|
if( (ptrdiff_t)pData->size == extent ) { /* all elements are contiguous */
|
||||||
pStack[1].disp += starting_point;
|
pStack[1].disp += starting_point;
|
||||||
} else { /* each is contiguous but there are gaps inbetween */
|
} else { /* each is contiguous but there are gaps inbetween */
|
||||||
pStack[1].disp += (pConvertor->count - pStack[0].count) * extent + cnt;
|
pStack[1].disp += (pConvertor->count - pStack[0].count) * extent + cnt;
|
||||||
@ -102,7 +99,7 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
|||||||
|
|
||||||
/* remove from the main loop all the complete datatypes */
|
/* remove from the main loop all the complete datatypes */
|
||||||
remote_size = ompi_convertor_compute_remote_size( pData, sizes );
|
remote_size = ompi_convertor_compute_remote_size( pData, sizes );
|
||||||
count = starting_point / remote_size;
|
count = (int32_t)(starting_point / remote_size);
|
||||||
resting_place -= (remote_size * count);
|
resting_place -= (remote_size * count);
|
||||||
pStack->count = pConvertor->count - count;
|
pStack->count = pConvertor->count - count;
|
||||||
pStack->index = -1;
|
pStack->index = -1;
|
||||||
@ -111,17 +108,17 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
|||||||
pStack->disp = count * (pData->ub - pData->lb) + pElems[loop_length].elem.disp;
|
pStack->disp = count * (pData->ub - pData->lb) + pElems[loop_length].elem.disp;
|
||||||
|
|
||||||
pos_desc = 0;
|
pos_desc = 0;
|
||||||
remoteLength = (int*)alloca( sizeof(int) * (pConvertor->pDesc->btypes[DT_LOOP] + 1));
|
remoteLength = (size_t*)alloca( sizeof(size_t) * (pConvertor->pDesc->btypes[DT_LOOP] + 1));
|
||||||
remoteLength[0] = 0; /* initial value set to ZERO */
|
remoteLength[0] = 0; /* initial value set to ZERO */
|
||||||
loop_length = 0;
|
loop_length = 0;
|
||||||
|
|
||||||
/* The only way to get out of this loop is when we reach the desired position or
|
/* The only way to get out of this loop is when we reach the desired position or
|
||||||
* when we finish the whole datatype.
|
* when we finish the whole datatype.
|
||||||
*/
|
*/
|
||||||
while( pos_desc < pConvertor->pStack[0].end_loop ) {
|
while( pos_desc < (int32_t)pConvertor->use_desc->used ) {
|
||||||
if( DT_END_LOOP == pElems->elem.common.type ) { /* end of the current loop */
|
if( DT_END_LOOP == pElems->elem.common.type ) { /* end of the current loop */
|
||||||
ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)pElems;
|
ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)pElems;
|
||||||
long extent;
|
ptrdiff_t extent;
|
||||||
|
|
||||||
if( (loop_length * pStack->count) > resting_place ) {
|
if( (loop_length * pStack->count) > resting_place ) {
|
||||||
/* We will stop somewhere on this loop. To avoid moving inside the loop
|
/* We will stop somewhere on this loop. To avoid moving inside the loop
|
||||||
@ -129,7 +126,7 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
|||||||
* stop. Once this index is computed we can then reparse the loop once
|
* stop. Once this index is computed we can then reparse the loop once
|
||||||
* until we find the correct position.
|
* until we find the correct position.
|
||||||
*/
|
*/
|
||||||
int cnt = resting_place / loop_length;
|
int32_t cnt = (int32_t)(resting_place / loop_length);
|
||||||
if( pStack->index == -1 ) {
|
if( pStack->index == -1 ) {
|
||||||
extent = pData->ub - pData->lb;
|
extent = pData->ub - pData->lb;
|
||||||
} else {
|
} else {
|
||||||
@ -160,8 +157,8 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
|||||||
}
|
}
|
||||||
if( DT_LOOP == pElems->elem.common.type ) {
|
if( DT_LOOP == pElems->elem.common.type ) {
|
||||||
remoteLength[pConvertor->stack_pos] += loop_length;
|
remoteLength[pConvertor->stack_pos] += loop_length;
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, pElems->loop.loops,
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP,
|
||||||
pStack->disp, pos_desc + pElems->loop.items );
|
pElems->loop.loops, pStack->disp );
|
||||||
pos_desc++;
|
pos_desc++;
|
||||||
pElems++;
|
pElems++;
|
||||||
remoteLength[pConvertor->stack_pos] = 0;
|
remoteLength[pConvertor->stack_pos] = 0;
|
||||||
@ -172,13 +169,12 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
|
|||||||
const ompi_datatype_t* basic_type = BASIC_DDT_FROM_ELEM( (*pElems) );
|
const ompi_datatype_t* basic_type = BASIC_DDT_FROM_ELEM( (*pElems) );
|
||||||
lastLength = pElems->elem.count * basic_type->size;
|
lastLength = pElems->elem.count * basic_type->size;
|
||||||
if( resting_place < lastLength ) {
|
if( resting_place < lastLength ) {
|
||||||
int cnt = resting_place / basic_type->size;
|
int32_t cnt = (int32_t)(resting_place / basic_type->size);
|
||||||
loop_length += (cnt * basic_type->size);
|
loop_length += (cnt * basic_type->size);
|
||||||
resting_place -= (cnt * basic_type->size);
|
resting_place -= (cnt * basic_type->size);
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElems->elem.common.type,
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElems->elem.common.type,
|
||||||
pElems->elem.count - cnt,
|
pElems->elem.count - cnt,
|
||||||
pElems->elem.disp + cnt * pElems->elem.extent,
|
pElems->elem.disp + cnt * pElems->elem.extent );
|
||||||
pos_desc );
|
|
||||||
pConvertor->bConverted = starting_point - resting_place;
|
pConvertor->bConverted = starting_point - resting_place;
|
||||||
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos,
|
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos,
|
||||||
pConvertor->pDesc->desc.desc, pConvertor->pDesc->name );
|
pConvertor->pDesc->desc.desc, pConvertor->pDesc->name );
|
||||||
|
@ -50,14 +50,15 @@ static inline void position_predefined_data( ompi_convertor_t* CONVERTOR,
|
|||||||
dt_elem_desc_t* ELEM,
|
dt_elem_desc_t* ELEM,
|
||||||
uint32_t* COUNT,
|
uint32_t* COUNT,
|
||||||
char** POINTER,
|
char** POINTER,
|
||||||
uint32_t* SPACE )
|
size_t* SPACE )
|
||||||
{
|
{
|
||||||
uint32_t _copy_count = *(COUNT), _copy_blength;
|
uint32_t _copy_count = *(COUNT);
|
||||||
|
size_t _copy_blength;
|
||||||
ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
ddt_elem_desc_t* _elem = &((ELEM)->elem);
|
||||||
|
|
||||||
_copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size;
|
_copy_blength = ompi_ddt_basicDatatypes[_elem->common.type]->size;
|
||||||
if( (_copy_count * _copy_blength) > *(SPACE) ) {
|
if( (_copy_count * _copy_blength) > *(SPACE) ) {
|
||||||
_copy_count = *(SPACE) / _copy_blength;
|
_copy_count = (uint32_t)(*(SPACE) / _copy_blength);
|
||||||
if( 0 == _copy_count ) return; /* nothing to do */
|
if( 0 == _copy_count ) return; /* nothing to do */
|
||||||
}
|
}
|
||||||
_copy_blength *= _copy_count;
|
_copy_blength *= _copy_count;
|
||||||
@ -73,14 +74,14 @@ static inline void position_contiguous_loop( ompi_convertor_t* CONVERTOR,
|
|||||||
dt_elem_desc_t* ELEM,
|
dt_elem_desc_t* ELEM,
|
||||||
uint32_t* COUNT,
|
uint32_t* COUNT,
|
||||||
char** POINTER,
|
char** POINTER,
|
||||||
uint32_t* SPACE )
|
size_t* SPACE )
|
||||||
{
|
{
|
||||||
ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM);
|
||||||
ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + (ELEM)->loop.items);
|
ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + (ELEM)->loop.items);
|
||||||
size_t _copy_loops = *(COUNT);
|
uint32_t _copy_loops = *(COUNT);
|
||||||
|
|
||||||
if( (_copy_loops * _end_loop->size) > *(SPACE) )
|
if( (_copy_loops * _end_loop->size) > *(SPACE) )
|
||||||
_copy_loops = *(SPACE) / _end_loop->size;
|
_copy_loops = (uint32_t)(*(SPACE) / _end_loop->size);
|
||||||
OMPI_DDT_SAFEGUARD_POINTER( *(POINTER) + _end_loop->first_elem_disp,
|
OMPI_DDT_SAFEGUARD_POINTER( *(POINTER) + _end_loop->first_elem_disp,
|
||||||
(_copy_loops - 1) * _loop->extent + _end_loop->size,
|
(_copy_loops - 1) * _loop->extent + _end_loop->size,
|
||||||
(CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count );
|
(CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count );
|
||||||
@ -105,8 +106,8 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor,
|
|||||||
dt_elem_desc_t* description = pConvertor->use_desc->desc;
|
dt_elem_desc_t* description = pConvertor->use_desc->desc;
|
||||||
dt_elem_desc_t* pElem;
|
dt_elem_desc_t* pElem;
|
||||||
char *base_pointer = pConvertor->pBaseBuf;
|
char *base_pointer = pConvertor->pBaseBuf;
|
||||||
uint32_t iov_len_local;
|
size_t iov_len_local;
|
||||||
long extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb;
|
ptrdiff_t extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb;
|
||||||
|
|
||||||
DUMP( "ompi_convertor_generic_simple_pack( %p, &%ld )\n", (void*)pConvertor, (long)*position );
|
DUMP( "ompi_convertor_generic_simple_pack( %p, &%ld )\n", (void*)pConvertor, (long)*position );
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor,
|
|||||||
iov_len_local = *position - pConvertor->bConverted;
|
iov_len_local = *position - pConvertor->bConverted;
|
||||||
if( iov_len_local > pConvertor->pDesc->size ) {
|
if( iov_len_local > pConvertor->pDesc->size ) {
|
||||||
pStack = pConvertor->pStack; /* we're working with the full stack */
|
pStack = pConvertor->pStack; /* we're working with the full stack */
|
||||||
count_desc = iov_len_local / pConvertor->pDesc->size;
|
count_desc = (uint32_t)(iov_len_local / pConvertor->pDesc->size);
|
||||||
DO_DEBUG( opal_output( 0, "position before %ld asked %ld data size %d"
|
DO_DEBUG( opal_output( 0, "position before %ld asked %ld data size %d"
|
||||||
" iov_len_local %d count_desc %d\n",
|
" iov_len_local %d count_desc %d\n",
|
||||||
pConvertor->bConverted, *position, pConvertor->pDesc->size,
|
pConvertor->bConverted, *position, pConvertor->pDesc->size,
|
||||||
@ -139,7 +140,7 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor,
|
|||||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||||
pos_desc = pStack->index;
|
pos_desc = pStack->index;
|
||||||
base_pointer += pStack->disp;
|
base_pointer += pStack->disp;
|
||||||
count_desc = pStack->count;
|
count_desc = (uint32_t)pStack->count;
|
||||||
pStack--;
|
pStack--;
|
||||||
pConvertor->stack_pos--;
|
pConvertor->stack_pos--;
|
||||||
pElem = &(description[pos_desc]);
|
pElem = &(description[pos_desc]);
|
||||||
@ -178,7 +179,7 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor,
|
|||||||
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
||||||
}
|
}
|
||||||
if( DT_LOOP == pElem->elem.common.type ) {
|
if( DT_LOOP == pElem->elem.common.type ) {
|
||||||
long local_disp = (long)base_pointer;
|
ptrdiff_t local_disp = (ptrdiff_t)base_pointer;
|
||||||
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
||||||
POSITION_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc,
|
POSITION_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc,
|
||||||
base_pointer, iov_len_local );
|
base_pointer, iov_len_local );
|
||||||
@ -188,9 +189,9 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor,
|
|||||||
}
|
}
|
||||||
/* Save the stack with the correct last_count value. */
|
/* Save the stack with the correct last_count value. */
|
||||||
}
|
}
|
||||||
local_disp = (long)base_pointer - local_disp;
|
local_disp = (ptrdiff_t)base_pointer - local_disp;
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
||||||
pStack->disp + local_disp, pos_desc + pElem->elem.disp + 1);
|
pStack->disp + local_disp );
|
||||||
pos_desc++;
|
pos_desc++;
|
||||||
update_loop_description: /* update the current state */
|
update_loop_description: /* update the current state */
|
||||||
base_pointer = pConvertor->pBaseBuf + pStack->disp;
|
base_pointer = pConvertor->pBaseBuf + pStack->disp;
|
||||||
@ -204,7 +205,7 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor,
|
|||||||
base_pointer, iov_len_local );
|
base_pointer, iov_len_local );
|
||||||
if( 0 != count_desc ) { /* completed */
|
if( 0 != count_desc ) { /* completed */
|
||||||
type = pElem->elem.common.type;
|
type = pElem->elem.common.type;
|
||||||
pConvertor->partial_length = iov_len_local;
|
pConvertor->partial_length = (uint32_t)iov_len_local;
|
||||||
goto complete_loop;
|
goto complete_loop;
|
||||||
}
|
}
|
||||||
base_pointer = pConvertor->pBaseBuf + pStack->disp;
|
base_pointer = pConvertor->pBaseBuf + pStack->disp;
|
||||||
@ -218,7 +219,7 @@ int ompi_convertor_generic_simple_position( ompi_convertor_t* pConvertor,
|
|||||||
if( !(pConvertor->flags & CONVERTOR_COMPLETED) ) {
|
if( !(pConvertor->flags & CONVERTOR_COMPLETED) ) {
|
||||||
/* I complete an element, next step I should go to the next one */
|
/* I complete an element, next step I should go to the next one */
|
||||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc,
|
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc,
|
||||||
base_pointer - pStack->disp - pConvertor->pBaseBuf, pos_desc );
|
base_pointer - pStack->disp - pConvertor->pBaseBuf );
|
||||||
DO_DEBUG( opal_output( 0, "position save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
DO_DEBUG( opal_output( 0, "position save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||||
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -148,7 +148,8 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
* Typedefs
|
* Typedefs
|
||||||
*/
|
*/
|
||||||
typedef long MPI_Aint;
|
#include <stddef.h>
|
||||||
|
typedef ptrdiff_t MPI_Aint;
|
||||||
typedef OMPI_MPI_OFFSET_TYPE MPI_Offset;
|
typedef OMPI_MPI_OFFSET_TYPE MPI_Offset;
|
||||||
typedef struct ompi_communicator_t *MPI_Comm;
|
typedef struct ompi_communicator_t *MPI_Comm;
|
||||||
typedef struct ompi_datatype_t *MPI_Datatype;
|
typedef struct ompi_datatype_t *MPI_Datatype;
|
||||||
|
@ -45,7 +45,7 @@ mca_coll_basic_allgather_intra(void *sbuf, int scount,
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
char *rbuf_original = NULL, *inplace_temp = NULL;
|
char *rbuf_original = NULL, *inplace_temp = NULL;
|
||||||
long true_lb, true_extent, lb, extent;
|
ptrdiff_t true_lb, true_extent, lb, extent;
|
||||||
|
|
||||||
/* Handle MPI_IN_PLACE (see explanantion in reduce.c for how to
|
/* Handle MPI_IN_PLACE (see explanantion in reduce.c for how to
|
||||||
allocate temp buffer) -- note that rank 0 can use IN_PLACE
|
allocate temp buffer) -- note that rank 0 can use IN_PLACE
|
||||||
@ -112,8 +112,8 @@ mca_coll_basic_allgather_inter(void *sbuf, int scount,
|
|||||||
int err;
|
int err;
|
||||||
int i;
|
int i;
|
||||||
char *tmpbuf = NULL, *ptmp;
|
char *tmpbuf = NULL, *ptmp;
|
||||||
long rlb, slb, rextent, sextent;
|
ptrdiff_t rlb, slb, rextent, sextent;
|
||||||
long incr;
|
ptrdiff_t incr;
|
||||||
ompi_request_t *req;
|
ompi_request_t *req;
|
||||||
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ mca_coll_basic_allreduce_inter(void *sbuf, void *rbuf, int count,
|
|||||||
int rank;
|
int rank;
|
||||||
int root = 0;
|
int root = 0;
|
||||||
int rsize;
|
int rsize;
|
||||||
long lb, extent;
|
ptrdiff_t lb, extent;
|
||||||
char *tmpbuf = NULL, *pml_buffer = NULL;
|
char *tmpbuf = NULL, *pml_buffer = NULL;
|
||||||
ompi_request_t *req[2];
|
ompi_request_t *req[2];
|
||||||
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
||||||
|
@ -44,10 +44,8 @@ mca_coll_basic_exscan_intra(void *sbuf, void *rbuf, int count,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int size;
|
int size, rank, err;
|
||||||
int rank;
|
ptrdiff_t true_lb, true_extent, lb, extent;
|
||||||
int err;
|
|
||||||
long true_lb, true_extent, lb, extent;
|
|
||||||
char *free_buffer = NULL;
|
char *free_buffer = NULL;
|
||||||
char *reduce_buffer = NULL;
|
char *reduce_buffer = NULL;
|
||||||
char *source;
|
char *source;
|
||||||
|
@ -40,13 +40,9 @@ mca_coll_basic_gatherv_intra(void *sbuf, int scount,
|
|||||||
struct ompi_datatype_t *rdtype, int root,
|
struct ompi_datatype_t *rdtype, int root,
|
||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rank, size, err;
|
||||||
int rank;
|
|
||||||
int size;
|
|
||||||
int err;
|
|
||||||
char *ptmp;
|
char *ptmp;
|
||||||
long lb;
|
ptrdiff_t lb, extent;
|
||||||
long extent;
|
|
||||||
|
|
||||||
size = ompi_comm_size(comm);
|
size = ompi_comm_size(comm);
|
||||||
rank = ompi_comm_rank(comm);
|
rank = ompi_comm_rank(comm);
|
||||||
@ -116,13 +112,9 @@ mca_coll_basic_gatherv_inter(void *sbuf, int scount,
|
|||||||
struct ompi_datatype_t *rdtype, int root,
|
struct ompi_datatype_t *rdtype, int root,
|
||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rank, size, err;
|
||||||
int rank;
|
|
||||||
int size;
|
|
||||||
int err;
|
|
||||||
char *ptmp;
|
char *ptmp;
|
||||||
long lb;
|
ptrdiff_t lb, extent;
|
||||||
long extent;
|
|
||||||
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
||||||
|
|
||||||
size = ompi_comm_remote_size(comm);
|
size = ompi_comm_remote_size(comm);
|
||||||
|
@ -40,11 +40,8 @@ mca_coll_basic_reduce_lin_intra(void *sbuf, void *rbuf, int count,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
int root, struct ompi_communicator_t *comm)
|
int root, struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rank, err, size;
|
||||||
int rank;
|
ptrdiff_t true_lb, true_extent, lb, extent;
|
||||||
int err;
|
|
||||||
int size;
|
|
||||||
long true_lb, true_extent, lb, extent;
|
|
||||||
char *free_buffer = NULL;
|
char *free_buffer = NULL;
|
||||||
char *pml_buffer = NULL;
|
char *pml_buffer = NULL;
|
||||||
char *inplace_temp = NULL;
|
char *inplace_temp = NULL;
|
||||||
@ -276,15 +273,9 @@ mca_coll_basic_reduce_log_intra(void *sbuf, void *rbuf, int count,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
int root, struct ompi_communicator_t *comm)
|
int root, struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, size, rank, vrank;
|
||||||
int size;
|
int err, peer, dim, mask;
|
||||||
int rank;
|
ptrdiff_t true_lb, true_extent, lb, extent;
|
||||||
int vrank;
|
|
||||||
int err;
|
|
||||||
int peer;
|
|
||||||
int dim;
|
|
||||||
int mask;
|
|
||||||
long true_lb, true_extent, lb, extent;
|
|
||||||
char *free_buffer = NULL;
|
char *free_buffer = NULL;
|
||||||
char *free_rbuf = NULL;
|
char *free_rbuf = NULL;
|
||||||
char *pml_buffer = NULL;
|
char *pml_buffer = NULL;
|
||||||
@ -490,11 +481,8 @@ mca_coll_basic_reduce_lin_inter(void *sbuf, void *rbuf, int count,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
int root, struct ompi_communicator_t *comm)
|
int root, struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rank, err, size;
|
||||||
int rank;
|
ptrdiff_t true_lb, true_extent, lb, extent;
|
||||||
int err;
|
|
||||||
int size;
|
|
||||||
long true_lb, true_extent, lb, extent;
|
|
||||||
char *free_buffer = NULL;
|
char *free_buffer = NULL;
|
||||||
char *pml_buffer = NULL;
|
char *pml_buffer = NULL;
|
||||||
|
|
||||||
|
@ -43,12 +43,8 @@ mca_coll_basic_reduce_scatter_intra(void *sbuf, void *rbuf, int *rcounts,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, err, rank, size, count;
|
||||||
int err;
|
ptrdiff_t true_lb, true_extent, lb, extent;
|
||||||
int rank;
|
|
||||||
int size;
|
|
||||||
int count;
|
|
||||||
long true_lb, true_extent, lb, extent;
|
|
||||||
int *disps = NULL;
|
int *disps = NULL;
|
||||||
char *free_buffer = NULL;
|
char *free_buffer = NULL;
|
||||||
char *pml_buffer = NULL;
|
char *pml_buffer = NULL;
|
||||||
@ -138,12 +134,9 @@ mca_coll_basic_reduce_scatter_inter(void *sbuf, void *rbuf, int *rcounts,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int err, i;
|
int err, i, rank, root = 0, rsize;
|
||||||
int rank;
|
|
||||||
int root = 0;
|
|
||||||
int rsize;
|
|
||||||
int totalcounts, tcount;
|
int totalcounts, tcount;
|
||||||
long lb, extent;
|
ptrdiff_t lb, extent;
|
||||||
char *tmpbuf = NULL, *tmpbuf2 = NULL, *tbuf = NULL;
|
char *tmpbuf = NULL, *tmpbuf2 = NULL, *tbuf = NULL;
|
||||||
ompi_request_t *req;
|
ompi_request_t *req;
|
||||||
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
||||||
|
@ -42,10 +42,8 @@ mca_coll_basic_scan_intra(void *sbuf, void *rbuf, int count,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int size;
|
int size, rank, err;
|
||||||
int rank;
|
ptrdiff_t true_lb, true_extent, lb, extent;
|
||||||
int err;
|
|
||||||
long true_lb, true_extent, lb, extent;
|
|
||||||
char *free_buffer = NULL;
|
char *free_buffer = NULL;
|
||||||
char *pml_buffer = NULL;
|
char *pml_buffer = NULL;
|
||||||
|
|
||||||
|
@ -42,13 +42,9 @@ mca_coll_basic_scatter_intra(void *sbuf, int scount,
|
|||||||
struct ompi_datatype_t *rdtype,
|
struct ompi_datatype_t *rdtype,
|
||||||
int root, struct ompi_communicator_t *comm)
|
int root, struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rank, size, err;
|
||||||
int rank;
|
|
||||||
int size;
|
|
||||||
int err;
|
|
||||||
char *ptmp;
|
char *ptmp;
|
||||||
long lb;
|
ptrdiff_t lb, incr;
|
||||||
long incr;
|
|
||||||
|
|
||||||
/* Initialize */
|
/* Initialize */
|
||||||
|
|
||||||
@ -112,13 +108,9 @@ mca_coll_basic_scatter_inter(void *sbuf, int scount,
|
|||||||
struct ompi_datatype_t *rdtype,
|
struct ompi_datatype_t *rdtype,
|
||||||
int root, struct ompi_communicator_t *comm)
|
int root, struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rank, size, err;
|
||||||
int rank;
|
|
||||||
int size;
|
|
||||||
int err;
|
|
||||||
char *ptmp;
|
char *ptmp;
|
||||||
long lb;
|
ptrdiff_t lb, incr;
|
||||||
long incr;
|
|
||||||
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
||||||
|
|
||||||
/* Initialize */
|
/* Initialize */
|
||||||
|
@ -42,13 +42,9 @@ mca_coll_basic_scatterv_intra(void *sbuf, int *scounts,
|
|||||||
struct ompi_datatype_t *rdtype, int root,
|
struct ompi_datatype_t *rdtype, int root,
|
||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rank, size, err;
|
||||||
int rank;
|
|
||||||
int size;
|
|
||||||
int err;
|
|
||||||
char *ptmp;
|
char *ptmp;
|
||||||
long lb;
|
ptrdiff_t lb, extent;
|
||||||
long extent;
|
|
||||||
|
|
||||||
/* Initialize */
|
/* Initialize */
|
||||||
|
|
||||||
@ -118,13 +114,9 @@ mca_coll_basic_scatterv_inter(void *sbuf, int *scounts,
|
|||||||
struct ompi_datatype_t *rdtype, int root,
|
struct ompi_datatype_t *rdtype, int root,
|
||||||
struct ompi_communicator_t *comm)
|
struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rank, size, err;
|
||||||
int rank;
|
|
||||||
int size;
|
|
||||||
int err;
|
|
||||||
char *ptmp;
|
char *ptmp;
|
||||||
long lb;
|
ptrdiff_t lb, extent;
|
||||||
long extent;
|
|
||||||
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
ompi_request_t **reqs = comm->c_coll_basic_data->mccb_reqs;
|
||||||
|
|
||||||
/* Initialize */
|
/* Initialize */
|
||||||
|
@ -46,7 +46,7 @@ int mca_coll_hierarch_allreduce_intra(void *sbuf, void *rbuf, int count,
|
|||||||
struct ompi_communicator_t *lcomm=NULL;
|
struct ompi_communicator_t *lcomm=NULL;
|
||||||
int rank;
|
int rank;
|
||||||
int lroot, llroot;
|
int lroot, llroot;
|
||||||
long extent, true_extent, lb, true_lb;
|
ptrdiff_t extent, true_extent, lb, true_lb;
|
||||||
char *tmpbuf=NULL, *tbuf=NULL;
|
char *tmpbuf=NULL, *tbuf=NULL;
|
||||||
int ret=OMPI_SUCCESS;
|
int ret=OMPI_SUCCESS;
|
||||||
int root=0;
|
int root=0;
|
||||||
|
@ -46,7 +46,7 @@ int mca_coll_hierarch_reduce_intra(void *sbuf, void *rbuf, int count,
|
|||||||
struct ompi_communicator_t *lcomm=NULL;
|
struct ompi_communicator_t *lcomm=NULL;
|
||||||
int rank;
|
int rank;
|
||||||
int lroot, llroot;
|
int lroot, llroot;
|
||||||
long extent, true_extent, lb, true_lb;
|
ptrdiff_t extent, true_extent, lb, true_lb;
|
||||||
char *tmpbuf=NULL, *tbuf=NULL;
|
char *tmpbuf=NULL, *tbuf=NULL;
|
||||||
int ret=OMPI_SUCCESS;
|
int ret=OMPI_SUCCESS;
|
||||||
|
|
||||||
|
@ -109,12 +109,10 @@ int mca_coll_hierarch_reduce_tmp(void *sbuf, void *rbuf, int count,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
int root, struct ompi_communicator_t *comm)
|
int root, struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, err, size;
|
||||||
int err;
|
|
||||||
int size;
|
|
||||||
char *pml_buffer = NULL;
|
char *pml_buffer = NULL;
|
||||||
long extent, lb;
|
ptrdiff_t extent, lb;
|
||||||
int rank=ompi_comm_rank(comm);;
|
int rank = ompi_comm_rank(comm);;
|
||||||
|
|
||||||
/* If not root, send data to the root. */
|
/* If not root, send data to the root. */
|
||||||
if (rank != root) {
|
if (rank != root) {
|
||||||
|
@ -62,7 +62,7 @@ int mca_coll_sm_reduce_intra(void *sbuf, void* rbuf, int count,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
int root, struct ompi_communicator_t *comm)
|
int root, struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int32_t size;
|
size_t size;
|
||||||
|
|
||||||
/* There are several possibilities:
|
/* There are several possibilities:
|
||||||
*
|
*
|
||||||
@ -77,7 +77,7 @@ int mca_coll_sm_reduce_intra(void *sbuf, void* rbuf, int count,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ompi_ddt_type_size(dtype, &size);
|
ompi_ddt_type_size(dtype, &size);
|
||||||
if (size > mca_coll_sm_component.sm_control_size) {
|
if ((int)size > mca_coll_sm_component.sm_control_size) {
|
||||||
return comm->c_coll_basic_module->coll_reduce(sbuf, rbuf, count,
|
return comm->c_coll_basic_module->coll_reduce(sbuf, rbuf, count,
|
||||||
dtype, op, root, comm);
|
dtype, op, root, comm);
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count,
|
|||||||
mca_coll_sm_in_use_flag_t *flag;
|
mca_coll_sm_in_use_flag_t *flag;
|
||||||
ompi_convertor_t convertor;
|
ompi_convertor_t convertor;
|
||||||
mca_coll_base_mpool_index_t *index;
|
mca_coll_base_mpool_index_t *index;
|
||||||
int32_t ddt_size;
|
size_t ddt_size;
|
||||||
size_t segment_ddt_count, segment_ddt_bytes, zero = 0;
|
size_t segment_ddt_count, segment_ddt_bytes, zero = 0;
|
||||||
|
|
||||||
/* Setup some identities */
|
/* Setup some identities */
|
||||||
@ -182,7 +182,7 @@ static int reduce_inorder(void *sbuf, void* rbuf, int count,
|
|||||||
|
|
||||||
if (root == rank) {
|
if (root == rank) {
|
||||||
char *reduce_temp_buffer, *free_buffer, *reduce_target;
|
char *reduce_temp_buffer, *free_buffer, *reduce_target;
|
||||||
long true_lb, true_extent, lb, extent;
|
ptrdiff_t true_lb, true_extent, lb, extent;
|
||||||
char *inplace_temp;
|
char *inplace_temp;
|
||||||
int peer;
|
int peer;
|
||||||
size_t count_left = (size_t)count;
|
size_t count_left = (size_t)count;
|
||||||
|
@ -40,16 +40,13 @@ int ompi_coll_tuned_alltoall_intra_pairwise(void *sbuf, int scount,
|
|||||||
int rank, size, step;
|
int rank, size, step;
|
||||||
int sendto, recvfrom;
|
int sendto, recvfrom;
|
||||||
void * tmpsend, *tmprecv;
|
void * tmpsend, *tmprecv;
|
||||||
MPI_Aint sext, rext;
|
ptrdiff_t lb, sext, rext;
|
||||||
long lb;
|
|
||||||
|
|
||||||
|
|
||||||
size = ompi_comm_size(comm);
|
size = ompi_comm_size(comm);
|
||||||
rank = ompi_comm_rank(comm);
|
rank = ompi_comm_rank(comm);
|
||||||
|
|
||||||
OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:alltoall_intra_pairwise rank %d", rank));
|
OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:alltoall_intra_pairwise rank %d", rank));
|
||||||
|
|
||||||
|
|
||||||
err = ompi_ddt_get_extent (sdtype, &lb, &sext);
|
err = ompi_ddt_get_extent (sdtype, &lb, &sext);
|
||||||
if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; }
|
if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; }
|
||||||
|
|
||||||
@ -91,23 +88,19 @@ int ompi_coll_tuned_alltoall_intra_bruck(void *sbuf, int scount,
|
|||||||
{
|
{
|
||||||
int i, k, line = -1;
|
int i, k, line = -1;
|
||||||
int rank, size;
|
int rank, size;
|
||||||
MPI_Aint sext, rext;
|
|
||||||
int sendto, recvfrom, distance, *displs=NULL, *blen=NULL;
|
int sendto, recvfrom, distance, *displs=NULL, *blen=NULL;
|
||||||
int maxpacksize, packsize, position;
|
int maxpacksize, packsize, position;
|
||||||
char * tmpbuf=NULL, *packbuf=NULL;
|
char * tmpbuf=NULL, *packbuf=NULL;
|
||||||
long lb;
|
ptrdiff_t lb, sext, rext;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int weallocated = 0;
|
int weallocated = 0;
|
||||||
MPI_Datatype iddt;
|
MPI_Datatype iddt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
size = ompi_comm_size(comm);
|
size = ompi_comm_size(comm);
|
||||||
rank = ompi_comm_rank(comm);
|
rank = ompi_comm_rank(comm);
|
||||||
|
|
||||||
OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:alltoall_intra_bruck rank %d", rank));
|
OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:alltoall_intra_bruck rank %d", rank));
|
||||||
|
|
||||||
|
|
||||||
err = ompi_ddt_get_extent (sdtype, &lb, &sext);
|
err = ompi_ddt_get_extent (sdtype, &lb, &sext);
|
||||||
if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; }
|
if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; }
|
||||||
|
|
||||||
@ -258,8 +251,7 @@ int ompi_coll_tuned_alltoall_intra_two_procs(void *sbuf, int scount,
|
|||||||
int rank;
|
int rank;
|
||||||
int sendto, recvfrom;
|
int sendto, recvfrom;
|
||||||
void * tmpsend, *tmprecv;
|
void * tmpsend, *tmprecv;
|
||||||
MPI_Aint sext, rext;
|
ptrdiff_t sext, rext, lb;
|
||||||
long lb;
|
|
||||||
|
|
||||||
rank = ompi_comm_rank(comm);
|
rank = ompi_comm_rank(comm);
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ ompi_coll_tuned_bcast_intra_chain ( void *buff, int count,
|
|||||||
int new_sendcount; /* used to mane the size for the next pipelined receive */
|
int new_sendcount; /* used to mane the size for the next pipelined receive */
|
||||||
int realsegsize;
|
int realsegsize;
|
||||||
char *tmpbuf = (char*)buff;
|
char *tmpbuf = (char*)buff;
|
||||||
long type_extent, lb;
|
size_t typelng;
|
||||||
int typelng;
|
ptrdiff_t type_extent, lb;
|
||||||
ompi_request_t *base_req, *new_req;
|
ompi_request_t *base_req, *new_req;
|
||||||
ompi_coll_chain_t* chain;
|
ompi_coll_chain_t* chain;
|
||||||
|
|
||||||
@ -245,9 +245,8 @@ ompi_coll_tuned_bcast_intra_split_bintree ( void* buffer,
|
|||||||
int sendcount[2]; /* the same like segcount, except for the last segment */
|
int sendcount[2]; /* the same like segcount, except for the last segment */
|
||||||
int realsegsize[2];
|
int realsegsize[2];
|
||||||
char *tmpbuf[2];
|
char *tmpbuf[2];
|
||||||
int type_size;
|
size_t type_size;
|
||||||
long type_extent;
|
ptrdiff_t type_extent, lb;
|
||||||
long lb;
|
|
||||||
ompi_request_t *base_req, *new_req;
|
ompi_request_t *base_req, *new_req;
|
||||||
ompi_coll_tree_t *tree;
|
ompi_coll_tree_t *tree;
|
||||||
|
|
||||||
@ -506,9 +505,8 @@ ompi_coll_tuned_bcast_intra_bintree ( void* buffer,
|
|||||||
int sendcount; /* the same like segcount, except for the last segment */
|
int sendcount; /* the same like segcount, except for the last segment */
|
||||||
int realsegsize;
|
int realsegsize;
|
||||||
char *tmpbuf;
|
char *tmpbuf;
|
||||||
int type_size;
|
size_t type_size;
|
||||||
long type_extent;
|
ptrdiff_t type_extent, lb;
|
||||||
long lb;
|
|
||||||
ompi_request_t *base_req, *new_req, *send_reqs[2];
|
ompi_request_t *base_req, *new_req, *send_reqs[2];
|
||||||
ompi_coll_tree_t *tree;
|
ompi_coll_tree_t *tree;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ ompi_coll_tuned_allreduce_intra_dec_dynamic (void *sbuf, void *rbuf, int count,
|
|||||||
|
|
||||||
/* we do, so calc the message size or what ever we need and use this for the evaluation */
|
/* we do, so calc the message size or what ever we need and use this for the evaluation */
|
||||||
int alg, faninout, segsize;
|
int alg, faninout, segsize;
|
||||||
int dsize;
|
size_t dsize;
|
||||||
|
|
||||||
ompi_ddt_type_size (dtype, &dsize);
|
ompi_ddt_type_size (dtype, &dsize);
|
||||||
dsize *= count;
|
dsize *= count;
|
||||||
@ -111,7 +111,7 @@ int ompi_coll_tuned_alltoall_intra_dec_dynamic(void *sbuf, int scount,
|
|||||||
/* we do, so calc the message size or what ever we need and use this for the evaluation */
|
/* we do, so calc the message size or what ever we need and use this for the evaluation */
|
||||||
int comsize;
|
int comsize;
|
||||||
int alg, faninout, segsize;
|
int alg, faninout, segsize;
|
||||||
int dsize;
|
size_t dsize;
|
||||||
|
|
||||||
ompi_ddt_type_size (sdtype, &dsize);
|
ompi_ddt_type_size (sdtype, &dsize);
|
||||||
comsize = ompi_comm_size(comm);
|
comsize = ompi_comm_size(comm);
|
||||||
@ -190,7 +190,7 @@ int ompi_coll_tuned_bcast_intra_dec_dynamic(void *buff, int count,
|
|||||||
|
|
||||||
/* we do, so calc the message size or what ever we need and use this for the evaluation */
|
/* we do, so calc the message size or what ever we need and use this for the evaluation */
|
||||||
int alg, faninout, segsize;
|
int alg, faninout, segsize;
|
||||||
int dsize;
|
size_t dsize;
|
||||||
|
|
||||||
ompi_ddt_type_size (datatype, &dsize);
|
ompi_ddt_type_size (datatype, &dsize);
|
||||||
dsize *= count;
|
dsize *= count;
|
||||||
@ -235,7 +235,7 @@ int ompi_coll_tuned_reduce_intra_dec_dynamic( void *sendbuf, void *recvbuf,
|
|||||||
|
|
||||||
/* we do, so calc the message size or what ever we need and use this for the evaluation */
|
/* we do, so calc the message size or what ever we need and use this for the evaluation */
|
||||||
int alg, faninout, segsize;
|
int alg, faninout, segsize;
|
||||||
int dsize;
|
size_t dsize;
|
||||||
|
|
||||||
ompi_ddt_type_size (datatype, &dsize);
|
ompi_ddt_type_size (datatype, &dsize);
|
||||||
dsize *= count;
|
dsize *= count;
|
||||||
|
@ -47,13 +47,12 @@ int ompi_coll_tuned_reduce_intra_chain( void *sendbuf, void *recvbuf, int count,
|
|||||||
char *inbuf[2] = {(char*)NULL, (char*)NULL};
|
char *inbuf[2] = {(char*)NULL, (char*)NULL};
|
||||||
char *accumbuf = (char*)NULL;
|
char *accumbuf = (char*)NULL;
|
||||||
char *sendtmpbuf = (char*)NULL;
|
char *sendtmpbuf = (char*)NULL;
|
||||||
long ext, lb;
|
ptrdiff_t ext, lb;
|
||||||
unsigned long typelng;
|
size_t typelng;
|
||||||
int allocedaccumbuf = 0;
|
int allocedaccumbuf = 0;
|
||||||
ompi_request_t* reqs[2];
|
ompi_request_t* reqs[2];
|
||||||
ompi_coll_chain_t* chain;
|
ompi_coll_chain_t* chain;
|
||||||
|
|
||||||
|
|
||||||
size = ompi_comm_size(comm);
|
size = ompi_comm_size(comm);
|
||||||
rank = ompi_comm_rank(comm);
|
rank = ompi_comm_rank(comm);
|
||||||
|
|
||||||
@ -334,11 +333,8 @@ ompi_coll_tuned_reduce_intra_basic_linear(void *sbuf, void *rbuf, int count,
|
|||||||
struct ompi_op_t *op,
|
struct ompi_op_t *op,
|
||||||
int root, struct ompi_communicator_t *comm)
|
int root, struct ompi_communicator_t *comm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, rank, err, size;
|
||||||
int rank;
|
ptrdiff_t true_lb, true_extent, lb, extent;
|
||||||
int err;
|
|
||||||
int size;
|
|
||||||
long true_lb, true_extent, lb, extent;
|
|
||||||
char *free_buffer = NULL;
|
char *free_buffer = NULL;
|
||||||
char *pml_buffer = NULL;
|
char *pml_buffer = NULL;
|
||||||
char *inplace_temp = NULL;
|
char *inplace_temp = NULL;
|
||||||
|
@ -636,7 +636,7 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
ompi_osc_pt2pt_longreq_t *longreq;
|
ompi_osc_pt2pt_longreq_t *longreq;
|
||||||
long lb, extent, true_lb, true_extent;
|
ptrdiff_t lb, extent, true_lb, true_extent;
|
||||||
size_t buflen;
|
size_t buflen;
|
||||||
|
|
||||||
/* figure out how big a buffer we need */
|
/* figure out how big a buffer we need */
|
||||||
|
@ -644,7 +644,7 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
ompi_osc_rdma_longreq_t *longreq;
|
ompi_osc_rdma_longreq_t *longreq;
|
||||||
long lb, extent, true_lb, true_extent;
|
ptrdiff_t lb, extent, true_lb, true_extent;
|
||||||
size_t buflen;
|
size_t buflen;
|
||||||
|
|
||||||
/* figure out how big a buffer we need */
|
/* figure out how big a buffer we need */
|
||||||
|
@ -67,7 +67,7 @@ do { \
|
|||||||
do { \
|
do { \
|
||||||
size_t i, length = 0; \
|
size_t i, length = 0; \
|
||||||
uint32_t ui1 = 0; \
|
uint32_t ui1 = 0; \
|
||||||
uint32_t ui2 = 0; \
|
size_t ui2 = 0; \
|
||||||
mca_pml_dr_buffer_t** buffers = frag->buffers; \
|
mca_pml_dr_buffer_t** buffers = frag->buffers; \
|
||||||
bool do_csum = mca_pml_dr.enable_csum && \
|
bool do_csum = mca_pml_dr.enable_csum && \
|
||||||
(btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM); \
|
(btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM); \
|
||||||
|
@ -270,7 +270,7 @@ static int mca_pml_ob1_recv_request_ack(
|
|||||||
mca_bml_base_btl_array_get_size(&bml_endpoint->btl_rdma)) {
|
mca_bml_base_btl_array_get_size(&bml_endpoint->btl_rdma)) {
|
||||||
char* base;
|
char* base;
|
||||||
char* align;
|
char* align;
|
||||||
long lb;
|
ptrdiff_t lb;
|
||||||
|
|
||||||
/* round this up/down to the next aligned address */
|
/* round this up/down to the next aligned address */
|
||||||
ompi_ddt_type_lb(recvreq->req_recv.req_convertor.pDesc, &lb);
|
ompi_ddt_type_lb(recvreq->req_recv.req_convertor.pDesc, &lb);
|
||||||
@ -696,7 +696,7 @@ int mca_pml_ob1_recv_request_schedule_exclusive(
|
|||||||
|
|
||||||
if(0 == recvreq->req_rdma_cnt) {
|
if(0 == recvreq->req_rdma_cnt) {
|
||||||
char* base;
|
char* base;
|
||||||
long lb;
|
ptrdiff_t lb;
|
||||||
|
|
||||||
if(mca_pml_ob1.leave_pinned_pipeline) {
|
if(mca_pml_ob1.leave_pinned_pipeline) {
|
||||||
/* lookup and/or create a cached registration */
|
/* lookup and/or create a cached registration */
|
||||||
|
@ -1071,7 +1071,7 @@ int mca_pml_ob1_send_request_put_frag(
|
|||||||
/* if registration doesnt exist - create one */
|
/* if registration doesnt exist - create one */
|
||||||
if (mca_pml_ob1.leave_pinned_pipeline && reg == NULL) {
|
if (mca_pml_ob1.leave_pinned_pipeline && reg == NULL) {
|
||||||
unsigned char* base;
|
unsigned char* base;
|
||||||
long lb;
|
ptrdiff_t lb;
|
||||||
ompi_ddt_type_lb(sendreq->req_send.req_convertor.pDesc, &lb);
|
ompi_ddt_type_lb(sendreq->req_send.req_convertor.pDesc, &lb);
|
||||||
base = (unsigned char*)sendreq->req_send.req_convertor.pBaseBuf + lb + offset;
|
base = (unsigned char*)sendreq->req_send.req_convertor.pBaseBuf + lb + offset;
|
||||||
reg = mca_pml_ob1_rdma_register(bml_btl, base, frag->rdma_length);
|
reg = mca_pml_ob1_rdma_register(bml_btl, base, frag->rdma_length);
|
||||||
|
@ -80,9 +80,9 @@ extern "C" {
|
|||||||
if ( (DDT)->flags & DT_FLAG_PREDEFINED ) { \
|
if ( (DDT)->flags & DT_FLAG_PREDEFINED ) { \
|
||||||
(RC) = MPI_ERR_BUFFER; \
|
(RC) = MPI_ERR_BUFFER; \
|
||||||
} else { \
|
} else { \
|
||||||
unsigned long size = 0; \
|
size_t size = 0; \
|
||||||
long true_lb = 0; \
|
ptrdiff_t true_lb = 0; \
|
||||||
long true_extended = 0; \
|
ptrdiff_t true_extended = 0; \
|
||||||
ompi_ddt_get_size((DDT), &size); \
|
ompi_ddt_get_size((DDT), &size); \
|
||||||
ompi_ddt_get_true_extent((DDT), &true_lb, &true_extended); \
|
ompi_ddt_get_true_extent((DDT), &true_lb, &true_extended); \
|
||||||
if ( 0 < size && 0 == true_lb ) { \
|
if ( 0 < size && 0 == true_lb ) { \
|
||||||
|
@ -34,7 +34,8 @@ 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)
|
||||||
{
|
{
|
||||||
int size, i;
|
int i;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
|
@ -36,7 +36,7 @@ int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype,
|
|||||||
int count)
|
int count)
|
||||||
{
|
{
|
||||||
int rc = MPI_SUCCESS;
|
int rc = MPI_SUCCESS;
|
||||||
int32_t size;
|
size_t size;
|
||||||
|
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
||||||
@ -50,7 +50,7 @@ int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype,
|
|||||||
|
|
||||||
if (status != MPI_STATUS_IGNORE) {
|
if (status != MPI_STATUS_IGNORE) {
|
||||||
ompi_ddt_type_size( datatype, &size );
|
ompi_ddt_type_size( datatype, &size );
|
||||||
status->_count = count * size;
|
status->_count = (int)(count * size);
|
||||||
}
|
}
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
static const char FUNC_NAME[] = "MPI_Type_create_darray";
|
static const char FUNC_NAME[] = "MPI_Type_create_darray";
|
||||||
|
|
||||||
static MPI_Datatype cyclic( int32_t darg, int32_t gsize, int32_t r, int32_t psize, MPI_Datatype oldtype )
|
static ompi_datatype_t* cyclic( int32_t darg, int32_t gsize, int32_t r, int32_t psize, ompi_datatype_t* oldtype )
|
||||||
{
|
{
|
||||||
int count, darg_last;
|
int count, darg_last;
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ int MPI_Type_create_darray(int size,
|
|||||||
|
|
||||||
{
|
{
|
||||||
int32_t i, darg_i, step, end_loop, *r;
|
int32_t i, darg_i, step, end_loop, *r;
|
||||||
MPI_Datatype temptype;
|
ompi_datatype_t* temptype;
|
||||||
|
|
||||||
if (MPI_PARAM_CHECK) {
|
if (MPI_PARAM_CHECK) {
|
||||||
int prod_psize = 1;
|
int prod_psize = 1;
|
||||||
@ -154,7 +154,6 @@ int MPI_Type_create_darray(int size,
|
|||||||
} while( i != end_loop );
|
} while( i != end_loop );
|
||||||
|
|
||||||
free( r );
|
free( r );
|
||||||
/* This function is not yet implemented */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int* a_i[8];
|
int* a_i[8];
|
||||||
|
@ -66,7 +66,7 @@ int MPI_Win_create(void *base, MPI_Aint size, int disp_unit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create window and return */
|
/* create window and return */
|
||||||
ret = ompi_win_create(base, size, disp_unit, comm,
|
ret = ompi_win_create(base, (size_t)size, disp_unit, comm,
|
||||||
info, win);
|
info, win);
|
||||||
if (OMPI_SUCCESS != ret) {
|
if (OMPI_SUCCESS != ret) {
|
||||||
*win = MPI_WIN_NULL;
|
*win = MPI_WIN_NULL;
|
||||||
|
@ -72,7 +72,7 @@ ompi_win_finalize(void)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ompi_win_create(void *base, long size,
|
ompi_win_create(void *base, size_t size,
|
||||||
int disp_unit, ompi_communicator_t *comm,
|
int disp_unit, ompi_communicator_t *comm,
|
||||||
ompi_info_t *info,
|
ompi_info_t *info,
|
||||||
ompi_win_t** newwin)
|
ompi_win_t** newwin)
|
||||||
|
@ -79,7 +79,7 @@ struct ompi_win_t {
|
|||||||
int w_disp_unit;
|
int w_disp_unit;
|
||||||
|
|
||||||
void *w_baseptr;
|
void *w_baseptr;
|
||||||
long w_size;
|
size_t w_size;
|
||||||
|
|
||||||
/** Current epoch / mode (access, expose, lock, etc.). Checked by
|
/** Current epoch / mode (access, expose, lock, etc.). Checked by
|
||||||
the argument checking code in the MPI layer, set by the OSC
|
the argument checking code in the MPI layer, set by the OSC
|
||||||
@ -97,7 +97,7 @@ OMPI_DECLSPEC extern ompi_win_t ompi_mpi_win_null;
|
|||||||
int ompi_win_init(void);
|
int ompi_win_init(void);
|
||||||
int ompi_win_finalize(void);
|
int ompi_win_finalize(void);
|
||||||
|
|
||||||
int ompi_win_create(void *base, long size, int disp_unit,
|
int ompi_win_create(void *base, size_t size, int disp_unit,
|
||||||
ompi_communicator_t *comm, ompi_info_t *info,
|
ompi_communicator_t *comm, ompi_info_t *info,
|
||||||
ompi_win_t **newwin);
|
ompi_win_t **newwin);
|
||||||
|
|
||||||
|
134
opal/util/crc.c
134
opal/util/crc.c
@ -66,16 +66,16 @@ unsigned long
|
|||||||
opal_bcopy_csum_partial (
|
opal_bcopy_csum_partial (
|
||||||
const void * source,
|
const void * source,
|
||||||
void * destination,
|
void * destination,
|
||||||
unsigned long copylen,
|
size_t copylen,
|
||||||
unsigned long csumlen,
|
size_t csumlen,
|
||||||
unsigned long * lastPartialLong,
|
unsigned long * lastPartialLong,
|
||||||
unsigned long * lastPartialLength
|
size_t* lastPartialLength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned long * src = (unsigned long *) source;
|
unsigned long * src = (unsigned long *) source;
|
||||||
unsigned long * dest = (unsigned long *) destination;
|
unsigned long * dest = (unsigned long *) destination;
|
||||||
unsigned long csum = 0;
|
unsigned long csum = 0;
|
||||||
ssize_t csumlenresidue;
|
size_t csumlenresidue;
|
||||||
unsigned long i, temp;
|
unsigned long i, temp;
|
||||||
|
|
||||||
csumlenresidue = (csumlen > copylen) ? (csumlen - copylen) : 0;
|
csumlenresidue = (csumlen > copylen) ? (csumlen - copylen) : 0;
|
||||||
@ -116,18 +116,18 @@ opal_bcopy_csum_partial (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* fast path... */
|
else { /* fast path... */
|
||||||
unsigned long numLongs = copylen/sizeof(unsigned long);
|
size_t numLongs = copylen/sizeof(unsigned long);
|
||||||
for(i = 0; i < numLongs; i++) {
|
for(i = 0; i < numLongs; i++) {
|
||||||
csum += *src;
|
csum += *src;
|
||||||
*dest++ = *src++;
|
*dest++ = *src++;
|
||||||
}
|
}
|
||||||
*lastPartialLong = 0;
|
*lastPartialLong = 0;
|
||||||
*lastPartialLength = 0;
|
*lastPartialLength = 0;
|
||||||
if (WORDALIGNED(copylen) && (csumlenresidue == 0)) {
|
if (WORDALIGNED(copylen) && (csumlenresidue == 0)) {
|
||||||
return(csum);
|
return(csum);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
copylen -= i * sizeof(unsigned long);
|
copylen -= i * sizeof(unsigned long);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (WORDALIGNED(source)) {
|
} else if (WORDALIGNED(source)) {
|
||||||
@ -144,36 +144,36 @@ opal_bcopy_csum_partial (
|
|||||||
copylen -= sizeof(unsigned long) - *lastPartialLength;
|
copylen -= sizeof(unsigned long) - *lastPartialLength;
|
||||||
/* now we have an unaligned source and an unknown alignment for our destination */
|
/* now we have an unaligned source and an unknown alignment for our destination */
|
||||||
if (WORDALIGNED(dest)) {
|
if (WORDALIGNED(dest)) {
|
||||||
unsigned long numLongs = copylen/sizeof(unsigned long);
|
size_t numLongs = copylen/sizeof(unsigned long);
|
||||||
for(i = 0; i < numLongs; i++) {
|
for(i = 0; i < numLongs; i++) {
|
||||||
memcpy(&temp, src, sizeof(temp));
|
memcpy(&temp, src, sizeof(temp));
|
||||||
src++;
|
src++;
|
||||||
csum += temp;
|
csum += temp;
|
||||||
*dest++ = temp;
|
*dest++ = temp;
|
||||||
}
|
}
|
||||||
copylen -= i * sizeof(unsigned long);
|
copylen -= i * sizeof(unsigned long);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for( ;copylen >= sizeof(*src); copylen -= sizeof(*src)) {
|
for( ;copylen >= sizeof(*src); copylen -= sizeof(*src)) {
|
||||||
memcpy(&temp, src, sizeof(temp));
|
memcpy(&temp, src, sizeof(temp));
|
||||||
src++;
|
src++;
|
||||||
csum += temp;
|
csum += temp;
|
||||||
memcpy(dest, &temp, sizeof(temp));
|
memcpy(dest, &temp, sizeof(temp));
|
||||||
dest++;
|
dest++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*lastPartialLong = 0;
|
*lastPartialLong = 0;
|
||||||
*lastPartialLength = 0;
|
*lastPartialLength = 0;
|
||||||
}
|
}
|
||||||
else { /* NO, we don't... */
|
else { /* NO, we don't... */
|
||||||
memcpy(((char *)&temp + *lastPartialLength), src, copylen);
|
memcpy(((char *)&temp + *lastPartialLength), src, copylen);
|
||||||
memcpy(dest, ((char *)&temp + *lastPartialLength), copylen);
|
memcpy(dest, ((char *)&temp + *lastPartialLength), copylen);
|
||||||
src = (unsigned long *)((char *)src + copylen);
|
src = (unsigned long *)((char *)src + copylen);
|
||||||
dest = (unsigned long *)((char *)dest + copylen);
|
dest = (unsigned long *)((char *)dest + copylen);
|
||||||
csum += (temp - *lastPartialLong);
|
csum += (temp - *lastPartialLong);
|
||||||
*lastPartialLong = temp;
|
*lastPartialLong = temp;
|
||||||
*lastPartialLength += copylen;
|
*lastPartialLength += copylen;
|
||||||
copylen = 0;
|
copylen = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -256,20 +256,20 @@ opal_bcopy_csum_partial (
|
|||||||
copylen -= sizeof(unsigned long) - *lastPartialLength;
|
copylen -= sizeof(unsigned long) - *lastPartialLength;
|
||||||
/* now we have an unknown alignment for our source and destination */
|
/* now we have an unknown alignment for our source and destination */
|
||||||
if (WORDALIGNED(src) && WORDALIGNED(dest)) {
|
if (WORDALIGNED(src) && WORDALIGNED(dest)) {
|
||||||
unsigned long numLongs = copylen/sizeof(unsigned long);
|
size_t numLongs = copylen/sizeof(unsigned long);
|
||||||
for(i = 0; i < numLongs; i++) {
|
for(i = 0; i < numLongs; i++) {
|
||||||
csum += *src;
|
csum += *src;
|
||||||
*dest++ = *src++;
|
*dest++ = *src++;
|
||||||
}
|
}
|
||||||
copylen -= i * sizeof(unsigned long);
|
copylen -= i * sizeof(unsigned long);
|
||||||
}
|
}
|
||||||
else { /* safe but slower for all other alignments */
|
else { /* safe but slower for all other alignments */
|
||||||
for( ;copylen >= sizeof(*src); copylen -= sizeof(*src)) {
|
for( ;copylen >= sizeof(*src); copylen -= sizeof(*src)) {
|
||||||
memcpy(&temp, src, sizeof(temp));
|
memcpy(&temp, src, sizeof(temp));
|
||||||
src++;
|
src++;
|
||||||
csum += temp;
|
csum += temp;
|
||||||
memcpy(dest, &temp, sizeof(temp));
|
memcpy(dest, &temp, sizeof(temp));
|
||||||
dest++;
|
dest++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*lastPartialLong = 0;
|
*lastPartialLong = 0;
|
||||||
@ -359,7 +359,7 @@ opal_bcopy_csum_partial (
|
|||||||
memcpy(&temp, src, copylen);
|
memcpy(&temp, src, copylen);
|
||||||
memcpy(dest, &temp, copylen);
|
memcpy(dest, &temp, copylen);
|
||||||
}
|
}
|
||||||
if (csumlenresidue < (ssize_t)(sizeof(unsigned long) - copylen - *lastPartialLength)) {
|
if (csumlenresidue < (sizeof(unsigned long) - copylen - *lastPartialLength)) {
|
||||||
temp = *lastPartialLong;
|
temp = *lastPartialLong;
|
||||||
memcpy(((char *)&temp + *lastPartialLength), src, (copylen + csumlenresidue));
|
memcpy(((char *)&temp + *lastPartialLength), src, (copylen + csumlenresidue));
|
||||||
/* avoid unsigned arithmetic overflow by subtracting the old partial */
|
/* avoid unsigned arithmetic overflow by subtracting the old partial */
|
||||||
@ -413,16 +413,16 @@ unsigned int
|
|||||||
opal_bcopy_uicsum_partial (
|
opal_bcopy_uicsum_partial (
|
||||||
const void * source,
|
const void * source,
|
||||||
void * destination,
|
void * destination,
|
||||||
unsigned long copylen,
|
size_t copylen,
|
||||||
unsigned long csumlen,
|
size_t csumlen,
|
||||||
unsigned int * lastPartialInt,
|
unsigned int* lastPartialInt,
|
||||||
unsigned int * lastPartialLength
|
size_t* lastPartialLength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned int * src = (unsigned int *) source;
|
unsigned int * src = (unsigned int *) source;
|
||||||
unsigned int * dest = (unsigned int *) destination;
|
unsigned int * dest = (unsigned int *) destination;
|
||||||
unsigned int csum = 0;
|
unsigned int csum = 0;
|
||||||
ssize_t csumlenresidue;
|
size_t csumlenresidue;
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
unsigned int temp;
|
unsigned int temp;
|
||||||
|
|
||||||
@ -464,18 +464,18 @@ opal_bcopy_uicsum_partial (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* fast path... */
|
else { /* fast path... */
|
||||||
unsigned long numLongs = copylen/sizeof(unsigned int);
|
size_t numLongs = copylen/sizeof(unsigned int);
|
||||||
for(i = 0; i < numLongs; i++) {
|
for(i = 0; i < numLongs; i++) {
|
||||||
csum += *src;
|
csum += *src;
|
||||||
*dest++ = *src++;
|
*dest++ = *src++;
|
||||||
}
|
}
|
||||||
*lastPartialInt = 0;
|
*lastPartialInt = 0;
|
||||||
*lastPartialLength = 0;
|
*lastPartialLength = 0;
|
||||||
if (INTALIGNED(copylen) && (csumlenresidue == 0)) {
|
if (INTALIGNED(copylen) && (csumlenresidue == 0)) {
|
||||||
return(csum);
|
return(csum);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
copylen -= i * sizeof(unsigned int);
|
copylen -= i * sizeof(unsigned int);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (INTALIGNED(source)) {
|
} else if (INTALIGNED(source)) {
|
||||||
@ -492,7 +492,7 @@ opal_bcopy_uicsum_partial (
|
|||||||
copylen -= sizeof(unsigned int) - *lastPartialLength;
|
copylen -= sizeof(unsigned int) - *lastPartialLength;
|
||||||
/* now we have an unaligned source and an unknown alignment for our destination */
|
/* now we have an unaligned source and an unknown alignment for our destination */
|
||||||
if (INTALIGNED(dest)) {
|
if (INTALIGNED(dest)) {
|
||||||
unsigned long numLongs = copylen/sizeof(unsigned int);
|
size_t numLongs = copylen/sizeof(unsigned int);
|
||||||
for(i = 0; i < numLongs; i++) {
|
for(i = 0; i < numLongs; i++) {
|
||||||
memcpy(&temp, src, sizeof(temp));
|
memcpy(&temp, src, sizeof(temp));
|
||||||
src++;
|
src++;
|
||||||
@ -604,7 +604,7 @@ opal_bcopy_uicsum_partial (
|
|||||||
copylen -= sizeof(unsigned int) - *lastPartialLength;
|
copylen -= sizeof(unsigned int) - *lastPartialLength;
|
||||||
/* now we have an unknown alignment for our source and destination */
|
/* now we have an unknown alignment for our source and destination */
|
||||||
if (INTALIGNED(src) && INTALIGNED(dest)) {
|
if (INTALIGNED(src) && INTALIGNED(dest)) {
|
||||||
unsigned long numLongs = copylen/sizeof(unsigned int);
|
size_t numLongs = copylen/sizeof(unsigned int);
|
||||||
for(i = 0; i < numLongs; i++) {
|
for(i = 0; i < numLongs; i++) {
|
||||||
csum += *src;
|
csum += *src;
|
||||||
*dest++ = *src++;
|
*dest++ = *src++;
|
||||||
@ -707,7 +707,7 @@ opal_bcopy_uicsum_partial (
|
|||||||
memcpy(&temp, src, copylen);
|
memcpy(&temp, src, copylen);
|
||||||
memcpy(dest, &temp, copylen);
|
memcpy(dest, &temp, copylen);
|
||||||
}
|
}
|
||||||
if (csumlenresidue < (ssize_t)(sizeof(unsigned int) - copylen - *lastPartialLength)) {
|
if (csumlenresidue < (sizeof(unsigned int) - copylen - *lastPartialLength)) {
|
||||||
temp = *lastPartialInt;
|
temp = *lastPartialInt;
|
||||||
memcpy(((char *)&temp + *lastPartialLength), src, (copylen + csumlenresidue));
|
memcpy(((char *)&temp + *lastPartialLength), src, (copylen + csumlenresidue));
|
||||||
/* avoid unsigned arithmetic overflow by subtracting the old partial
|
/* avoid unsigned arithmetic overflow by subtracting the old partial
|
||||||
@ -769,9 +769,9 @@ opal_bcopy_uicsum_partial (
|
|||||||
unsigned long
|
unsigned long
|
||||||
opal_csum_partial (
|
opal_csum_partial (
|
||||||
const void * source,
|
const void * source,
|
||||||
unsigned long csumlen,
|
size_t csumlen,
|
||||||
unsigned long * lastPartialLong,
|
unsigned long* lastPartialLong,
|
||||||
unsigned long * lastPartialLength
|
size_t* lastPartialLength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned long * src = (unsigned long *) source;
|
unsigned long * src = (unsigned long *) source;
|
||||||
@ -811,17 +811,17 @@ opal_csum_partial (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* fast path... */
|
else { /* fast path... */
|
||||||
unsigned long numLongs = csumlen/sizeof(unsigned long);
|
size_t numLongs = csumlen/sizeof(unsigned long);
|
||||||
for(i = 0; i < numLongs; i++) {
|
for(i = 0; i < numLongs; i++) {
|
||||||
csum += *src++;
|
csum += *src++;
|
||||||
}
|
}
|
||||||
*lastPartialLong = 0;
|
*lastPartialLong = 0;
|
||||||
*lastPartialLength = 0;
|
*lastPartialLength = 0;
|
||||||
if (WORDALIGNED(csumlen)) {
|
if (WORDALIGNED(csumlen)) {
|
||||||
return(csum);
|
return(csum);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
csumlen -= i * sizeof(unsigned long);
|
csumlen -= i * sizeof(unsigned long);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -919,9 +919,9 @@ opal_csum_partial (
|
|||||||
unsigned int
|
unsigned int
|
||||||
opal_uicsum_partial (
|
opal_uicsum_partial (
|
||||||
const void * source,
|
const void * source,
|
||||||
unsigned long csumlen,
|
size_t csumlen,
|
||||||
unsigned int * lastPartialInt,
|
unsigned int* lastPartialInt,
|
||||||
unsigned int * lastPartialLength
|
size_t* lastPartialLength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned int * src = (unsigned int *) source;
|
unsigned int * src = (unsigned int *) source;
|
||||||
@ -961,17 +961,17 @@ opal_uicsum_partial (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* fast path... */
|
else { /* fast path... */
|
||||||
unsigned long numLongs = csumlen/sizeof(unsigned int);
|
size_t numLongs = csumlen/sizeof(unsigned int);
|
||||||
for(i = 0; i < numLongs; i++) {
|
for(i = 0; i < numLongs; i++) {
|
||||||
csum += *src++;
|
csum += *src++;
|
||||||
}
|
}
|
||||||
*lastPartialInt = 0;
|
*lastPartialInt = 0;
|
||||||
*lastPartialLength = 0;
|
*lastPartialLength = 0;
|
||||||
if (INTALIGNED(csumlen)) {
|
if (INTALIGNED(csumlen)) {
|
||||||
return(csum);
|
return(csum);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
csumlen -= i * sizeof(unsigned int);
|
csumlen -= i * sizeof(unsigned int);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1099,11 +1099,11 @@ void opal_initialize_crc_table(void)
|
|||||||
unsigned int opal_bcopy_uicrc_partial(
|
unsigned int opal_bcopy_uicrc_partial(
|
||||||
const void * source,
|
const void * source,
|
||||||
void * destination,
|
void * destination,
|
||||||
unsigned long copylen,
|
size_t copylen,
|
||||||
unsigned long crclen,
|
size_t crclen,
|
||||||
unsigned int partial_crc)
|
unsigned int partial_crc)
|
||||||
{
|
{
|
||||||
unsigned long crclenresidue = (crclen > copylen) ? (crclen - copylen) : 0;
|
size_t crclenresidue = (crclen > copylen) ? (crclen - copylen) : 0;
|
||||||
register int i, j;
|
register int i, j;
|
||||||
register unsigned char t;
|
register unsigned char t;
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
@ -1162,7 +1162,7 @@ unsigned int opal_bcopy_uicrc_partial(
|
|||||||
|
|
||||||
|
|
||||||
unsigned int opal_uicrc_partial(
|
unsigned int opal_uicrc_partial(
|
||||||
const void * source, unsigned long crclen, unsigned int partial_crc)
|
const void * source, size_t crclen, unsigned int partial_crc)
|
||||||
{
|
{
|
||||||
register int i, j;
|
register int i, j;
|
||||||
register unsigned char * t;
|
register unsigned char * t;
|
||||||
|
@ -39,22 +39,22 @@ OPAL_DECLSPEC unsigned long
|
|||||||
opal_bcopy_csum_partial(
|
opal_bcopy_csum_partial(
|
||||||
const void * source,
|
const void * source,
|
||||||
void * destination,
|
void * destination,
|
||||||
unsigned long copylen,
|
size_t copylen,
|
||||||
unsigned long csumlen,
|
size_t csumlen,
|
||||||
unsigned long * lastPartialLong,
|
unsigned long* lastPartialLong,
|
||||||
unsigned long * lastPartialLength
|
size_t* lastPartialLength
|
||||||
);
|
);
|
||||||
|
|
||||||
static inline unsigned long
|
static inline unsigned long
|
||||||
opal_bcopy_csum (
|
opal_bcopy_csum (
|
||||||
const void * source,
|
const void * source,
|
||||||
void * destination,
|
void * destination,
|
||||||
unsigned long copylen,
|
size_t copylen,
|
||||||
unsigned long csumlen
|
size_t csumlen
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned long plong = 0;
|
unsigned long plong = 0;
|
||||||
unsigned long plength = 0;
|
size_t plength = 0;
|
||||||
return opal_bcopy_csum_partial(source, destination, copylen, csumlen, &plong, &plength);
|
return opal_bcopy_csum_partial(source, destination, copylen, csumlen, &plong, &plength);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,55 +62,55 @@ OPAL_DECLSPEC unsigned int
|
|||||||
opal_bcopy_uicsum_partial (
|
opal_bcopy_uicsum_partial (
|
||||||
const void * source,
|
const void * source,
|
||||||
void * destination,
|
void * destination,
|
||||||
unsigned long copylen,
|
size_t copylen,
|
||||||
unsigned long csumlen,
|
size_t csumlen,
|
||||||
unsigned int * lastPartialInt,
|
unsigned int* lastPartialInt,
|
||||||
unsigned int * lastPartialLength
|
size_t* lastPartialLength
|
||||||
);
|
);
|
||||||
|
|
||||||
static inline unsigned int
|
static inline unsigned int
|
||||||
opal_bcopy_uicsum (
|
opal_bcopy_uicsum (
|
||||||
const void * source,
|
const void * source,
|
||||||
void * destination,
|
void * destination,
|
||||||
unsigned long copylen,
|
size_t copylen,
|
||||||
unsigned long csumlen
|
size_t csumlen
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned int pint = 0;
|
unsigned int pint = 0;
|
||||||
unsigned int plength = 0;
|
size_t plength = 0;
|
||||||
return opal_bcopy_uicsum_partial(source, destination, copylen, csumlen, &pint, &plength);
|
return opal_bcopy_uicsum_partial(source, destination, copylen, csumlen, &pint, &plength);
|
||||||
}
|
}
|
||||||
|
|
||||||
OPAL_DECLSPEC unsigned long
|
OPAL_DECLSPEC unsigned long
|
||||||
opal_csum_partial (
|
opal_csum_partial (
|
||||||
const void * source,
|
const void * source,
|
||||||
unsigned long csumlen,
|
size_t csumlen,
|
||||||
unsigned long * lastPartialLong,
|
unsigned long* lastPartialLong,
|
||||||
unsigned long * lastPartialLength
|
size_t* lastPartialLength
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
static inline unsigned long
|
static inline unsigned long
|
||||||
opal_csum(const void * source, unsigned long csumlen)
|
opal_csum(const void * source, size_t csumlen)
|
||||||
{
|
{
|
||||||
unsigned long lastPartialLong = 0;
|
unsigned long lastPartialLong = 0;
|
||||||
unsigned long lastPartialLength = 0;
|
size_t lastPartialLength = 0;
|
||||||
return opal_csum_partial(source, csumlen, &lastPartialLong, &lastPartialLength);
|
return opal_csum_partial(source, csumlen, &lastPartialLong, &lastPartialLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
OPAL_DECLSPEC unsigned int
|
OPAL_DECLSPEC unsigned int
|
||||||
opal_uicsum_partial (
|
opal_uicsum_partial (
|
||||||
const void * source,
|
const void * source,
|
||||||
unsigned long csumlen,
|
size_t csumlen,
|
||||||
unsigned int * lastPartialInt,
|
unsigned int * lastPartialInt,
|
||||||
unsigned int * lastPartialLength
|
size_t* lastPartialLength
|
||||||
);
|
);
|
||||||
|
|
||||||
static inline unsigned int
|
static inline unsigned int
|
||||||
opal_uicsum(const void * source, unsigned long csumlen)
|
opal_uicsum(const void * source, size_t csumlen)
|
||||||
{
|
{
|
||||||
unsigned int lastPartialInt = 0;
|
unsigned int lastPartialInt = 0;
|
||||||
unsigned int lastPartialLength = 0;
|
size_t lastPartialLength = 0;
|
||||||
return opal_uicsum_partial(source, csumlen, &lastPartialInt, &lastPartialLength);
|
return opal_uicsum_partial(source, csumlen, &lastPartialInt, &lastPartialLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,16 +124,16 @@ OPAL_DECLSPEC unsigned int
|
|||||||
opal_bcopy_uicrc_partial(
|
opal_bcopy_uicrc_partial(
|
||||||
const void * source,
|
const void * source,
|
||||||
void * destination,
|
void * destination,
|
||||||
unsigned long copylen,
|
size_t copylen,
|
||||||
unsigned long crclen,
|
size_t crclen,
|
||||||
unsigned int partial_crc);
|
unsigned int partial_crc);
|
||||||
|
|
||||||
static inline unsigned int
|
static inline unsigned int
|
||||||
opal_bcopy_uicrc(
|
opal_bcopy_uicrc(
|
||||||
const void * source,
|
const void * source,
|
||||||
void * destination,
|
void * destination,
|
||||||
unsigned long copylen,
|
size_t copylen,
|
||||||
unsigned long crclen)
|
size_t crclen)
|
||||||
{
|
{
|
||||||
return opal_bcopy_uicrc_partial(source, destination, copylen, crclen, CRC_INITIAL_REGISTER);
|
return opal_bcopy_uicrc_partial(source, destination, copylen, crclen, CRC_INITIAL_REGISTER);
|
||||||
}
|
}
|
||||||
@ -141,12 +141,12 @@ opal_bcopy_uicrc(
|
|||||||
OPAL_DECLSPEC unsigned int
|
OPAL_DECLSPEC unsigned int
|
||||||
opal_uicrc_partial(
|
opal_uicrc_partial(
|
||||||
const void * source,
|
const void * source,
|
||||||
unsigned long crclen,
|
size_t crclen,
|
||||||
unsigned int partial_crc);
|
unsigned int partial_crc);
|
||||||
|
|
||||||
|
|
||||||
static inline unsigned int
|
static inline unsigned int
|
||||||
opal_uicrc(const void * source, unsigned long crclen)
|
opal_uicrc(const void * source, size_t crclen)
|
||||||
{
|
{
|
||||||
return opal_uicrc_partial(source, crclen, CRC_INITIAL_REGISTER);
|
return opal_uicrc_partial(source, crclen, CRC_INITIAL_REGISTER);
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user