Rename files.
This commit was SVN r9324.
Этот коммит содержится в:
родитель
9955eb2f2e
Коммит
6babf2f874
@ -43,21 +43,19 @@ libdatatype_la_SOURCES = \
|
||||
dt_destroy.c \
|
||||
dt_module.c \
|
||||
dt_optimize.c \
|
||||
dt_pack.c \
|
||||
datatype_pack.c datatype_unpack.c \
|
||||
dt_sndrcv.c \
|
||||
dt_unpack.c \
|
||||
fake_stack.c \
|
||||
dt_args.c \
|
||||
dt_arch.c \
|
||||
dt_copy.c \
|
||||
dt_external32.c \
|
||||
dt_match_size.c \
|
||||
convertor.c \
|
||||
new_position.c \
|
||||
convertor.c position.c \
|
||||
datatype_memcpy.c copy_functions.c get_count.c
|
||||
|
||||
# these sources will be compiled with the special -D
|
||||
libdatatype_reliable_la_SOURCES = dt_pack.c dt_unpack.c
|
||||
libdatatype_reliable_la_SOURCES = datatype_pack.c datatype_unpack.c
|
||||
libdatatype_reliable_la_CFLAGS = -DCHECKSUM $(AM_CFLAGS)
|
||||
|
||||
# Conditionally install the header files
|
||||
|
@ -1,182 +0,0 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/datatype/convertor.h"
|
||||
#include "ompi/datatype/datatype_internal.h"
|
||||
|
||||
#include "ompi/datatype/datatype_checksum.h"
|
||||
#include "ompi/datatype/datatype_pack.h"
|
||||
|
||||
|
||||
/* The pack/unpack functions need a cleanup. I have to create a proper interface to access
|
||||
* all basic functionalities, hence using them as basic blocks for all conversion functions.
|
||||
*
|
||||
* But first let's make some global assumptions:
|
||||
* - a datatype (with the flag DT_DATA set) will have the contiguous flags set if and only if
|
||||
* the data is really contiguous (extent equal with size)
|
||||
* - for the DT_LOOP type the DT_CONTIGUOUS flag set means that the content of the loop is
|
||||
* contiguous but with a gap in the begining or at the end.
|
||||
* - the DT_CONTIGUOUS flag for the type DT_END_LOOP is meaningless.
|
||||
*/
|
||||
int32_t
|
||||
ompi_generic_simple_pack_function( ompi_convertor_t* pConvertor,
|
||||
struct iovec* iov, uint32_t* out_size,
|
||||
size_t* max_data,
|
||||
int32_t* freeAfter )
|
||||
{
|
||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
uint16_t type; /* type at current position */
|
||||
size_t total_packed = 0; /* total amount packed this time */
|
||||
dt_elem_desc_t* description;
|
||||
dt_elem_desc_t* pElem;
|
||||
const ompi_datatype_t *pData = pConvertor->pDesc;
|
||||
char *source_base, *destination;
|
||||
uint32_t iov_len_local, iov_count, required_space = 0;
|
||||
|
||||
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 ); );
|
||||
|
||||
description = pConvertor->use_desc->desc;
|
||||
|
||||
/* For the first step we have to add both displacement to the source. After in the
|
||||
* main while loop we will set back the source_base to the correct value. This is
|
||||
* due to the fact that the convertor can stop in the middle of a data with a count
|
||||
*/
|
||||
source_base = pConvertor->pBaseBuf;
|
||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||
pos_desc = pStack->index;
|
||||
source_base += pStack->disp;
|
||||
count_desc = pStack->count;
|
||||
pStack--;
|
||||
pConvertor->stack_pos--;
|
||||
pElem = &(description[pos_desc]);
|
||||
source_base += pStack->disp;
|
||||
|
||||
DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %d disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
pos_desc, count_desc, source_base - pConvertor->pBaseBuf,
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
||||
|
||||
for( iov_count = 0; iov_count < (*out_size); iov_count++ ) {
|
||||
if( required_space > ((*max_data) - total_packed) )
|
||||
break; /* do not pack over the boundaries even if there are more iovecs */
|
||||
if( iov[iov_count].iov_base == NULL ) {
|
||||
/*
|
||||
* ALLOCATE SOME MEMORY ...
|
||||
*/
|
||||
size_t length = iov[iov_count].iov_len;
|
||||
if( length <= 0 )
|
||||
length = pConvertor->local_size - pConvertor->bConverted;
|
||||
if( ((*max_data) - total_packed) < length )
|
||||
length = (*max_data) - total_packed;
|
||||
assert( 0 < length );
|
||||
iov[iov_count].iov_base = pConvertor->memAlloc_fn( &length, pConvertor->memAlloc_userdata );
|
||||
iov[iov_count].iov_len = length;
|
||||
*freeAfter = (*freeAfter) | (1 << iov_count);
|
||||
}
|
||||
destination = iov[iov_count].iov_base;
|
||||
iov_len_local = iov[iov_count].iov_len;
|
||||
while( 1 ) {
|
||||
if( DT_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
||||
DO_DEBUG( opal_output( 0, "pack end_loop count %d stack_pos %d pos_desc %d disp %ld space %d\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( pConvertor->stack_pos == 0 ) {
|
||||
/* we lie about the size of the next element in order to
|
||||
* make sure we exit the main loop.
|
||||
*/
|
||||
required_space = 0xffffffff;
|
||||
pConvertor->flags |= CONVERTOR_COMPLETED;
|
||||
goto complete_loop; /* completed */
|
||||
}
|
||||
pConvertor->stack_pos--;
|
||||
pStack--;
|
||||
pos_desc++;
|
||||
} else {
|
||||
pos_desc = pStack->index + 1;
|
||||
if( pStack->index == -1 ) {
|
||||
pStack->disp += (pData->ub - pData->lb);
|
||||
} else {
|
||||
assert( DT_LOOP == description[pStack->index].loop.common.type );
|
||||
pStack->disp += description[pStack->index].loop.extent;
|
||||
}
|
||||
}
|
||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "pack new_loop count %d stack_pos %d pos_desc %d disp %ld space %d\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
||||
}
|
||||
if( DT_LOOP == pElem->elem.common.type ) {
|
||||
long local_disp = (long)source_base;
|
||||
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
||||
PACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc,
|
||||
source_base, destination, iov_len_local );
|
||||
if( 0 == count_desc ) { /* completed */
|
||||
pos_desc += pElem->loop.items + 1;
|
||||
goto update_loop_description;
|
||||
}
|
||||
/* Save the stack with the correct last_count value. */
|
||||
}
|
||||
local_disp = (long)source_base - local_disp;
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
||||
pStack->disp + local_disp, pos_desc + pElem->elem.disp + 1);
|
||||
pos_desc++;
|
||||
update_loop_description: /* update the current state */
|
||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" );
|
||||
continue;
|
||||
}
|
||||
while( pElem->elem.common.flags & DT_FLAG_DATA ) {
|
||||
/* now here we have a basic datatype */
|
||||
PACK_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc,
|
||||
source_base, destination, iov_len_local );
|
||||
if( 0 != count_desc ) { /* completed */
|
||||
type = pElem->elem.common.type;
|
||||
required_space = ompi_ddt_basicDatatypes[type]->size;
|
||||
goto complete_loop;
|
||||
}
|
||||
source_base = pConvertor->pBaseBuf + pStack->disp;
|
||||
pos_desc++; /* advance to the next data */
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
}
|
||||
}
|
||||
complete_loop:
|
||||
iov[iov_count].iov_len -= iov_len_local; /* update the amount of valid data */
|
||||
total_packed += iov[iov_count].iov_len;
|
||||
pConvertor->bConverted += iov[iov_count].iov_len; /* update the already converted bytes */
|
||||
}
|
||||
*max_data = total_packed;
|
||||
*out_size = iov_count;
|
||||
if( !(pConvertor->flags & CONVERTOR_COMPLETED) ) {
|
||||
/* I complete an element, next step I should go to the next one */
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc,
|
||||
source_base - pStack->disp - pConvertor->pBaseBuf, pos_desc );
|
||||
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 ); );
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,201 +0,0 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/datatype/convertor.h"
|
||||
#include "ompi/datatype/datatype_internal.h"
|
||||
|
||||
#include "ompi/datatype/datatype_checksum.h"
|
||||
#include "ompi/datatype/datatype_unpack.h"
|
||||
|
||||
/* The pack/unpack functions need a cleanup. I have to create a proper interface to access
|
||||
* all basic functionalities, hence using them as basic blocks for all conversion functions.
|
||||
*
|
||||
* But first let's make some global assumptions:
|
||||
* - a datatype (with the flag DT_DATA set) will have the contiguous flags set if and only if
|
||||
* the data is really contiguous (extent equal with size)
|
||||
* - for the DT_LOOP type the DT_CONTIGUOUS flag set means that the content of the loop is
|
||||
* contiguous but with a gap in the begining or at the end.
|
||||
* - the DT_CONTIGUOUS flag for the type DT_END_LOOP is meaningless.
|
||||
*/
|
||||
int32_t
|
||||
ompi_generic_simple_unpack_function( ompi_convertor_t* pConvertor,
|
||||
struct iovec* iov, uint32_t* out_size,
|
||||
size_t* max_data,
|
||||
int32_t* freeAfter )
|
||||
{
|
||||
dt_stack_t* pStack; /* pointer to the position on the stack */
|
||||
uint32_t pos_desc; /* actual position in the description of the derived datatype */
|
||||
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
|
||||
uint16_t type = DT_MAX_PREDEFINED; /* type at current position */
|
||||
size_t total_unpacked = 0; /* total size unpacked this time */
|
||||
dt_elem_desc_t* description;
|
||||
dt_elem_desc_t* pElem;
|
||||
const ompi_datatype_t *pData = pConvertor->pDesc;
|
||||
char *user_memory_base, *packed_buffer;
|
||||
uint32_t iov_len_local, iov_count, required_space = 0;
|
||||
|
||||
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 ); );
|
||||
|
||||
description = pConvertor->use_desc->desc;
|
||||
|
||||
/* For the first step we have to add both displacement to the source. After in the
|
||||
* main while loop we will set back the source_base to the correct value. This is
|
||||
* due to the fact that the convertor can stop in the middle of a data with a count
|
||||
*/
|
||||
user_memory_base = pConvertor->pBaseBuf;
|
||||
pStack = pConvertor->pStack + pConvertor->stack_pos;
|
||||
pos_desc = pStack->index;
|
||||
user_memory_base += pStack->disp;
|
||||
count_desc = pStack->count;
|
||||
pStack--;
|
||||
pConvertor->stack_pos--;
|
||||
pElem = &(description[pos_desc]);
|
||||
user_memory_base += pStack->disp;
|
||||
|
||||
DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %d disp %ld\n"
|
||||
"stack_pos %d pos_desc %d count_desc %d disp %ld\n",
|
||||
pos_desc, count_desc, user_memory_base - pConvertor->pBaseBuf,
|
||||
pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); );
|
||||
|
||||
for( iov_count = 0; iov_count < (*out_size); iov_count++ ) {
|
||||
if( required_space > ((*max_data) - total_unpacked) )
|
||||
break; /* do not pack over the boundaries even if there are more iovecs */
|
||||
|
||||
packed_buffer = iov[iov_count].iov_base;
|
||||
iov_len_local = iov[iov_count].iov_len;
|
||||
if( 0 != pConvertor->pending_length ) {
|
||||
uint32_t element_length = ompi_ddt_basicDatatypes[pElem->elem.common.type]->size;
|
||||
uint32_t missing_length = element_length - pConvertor->pending_length;
|
||||
|
||||
assert( pElem->elem.common.flags & DT_FLAG_DATA );
|
||||
memcpy( pConvertor->pending + pConvertor->pending_length, packed_buffer, missing_length );
|
||||
packed_buffer = pConvertor->pending;
|
||||
DO_DEBUG( opal_output( 0, "unpack pending from the last unpack %d out of %d bytes\n",
|
||||
pConvertor->pending_length, ompi_ddt_basicDatatypes[pElem->elem.common.type]->size ); );
|
||||
UNPACK_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc,
|
||||
packed_buffer, user_memory_base, element_length );
|
||||
if( 0 == count_desc ) {
|
||||
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
|
||||
pos_desc++; /* advance to the next data */
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
}
|
||||
assert( 0 == element_length );
|
||||
packed_buffer = (char*)iov[iov_count].iov_base + missing_length;
|
||||
iov_len_local -= missing_length;
|
||||
pConvertor->pending_length = 0; /* nothing more inside */
|
||||
}
|
||||
while( 1 ) {
|
||||
if( DT_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
|
||||
DO_DEBUG( opal_output( 0, "unpack end_loop count %d stack_pos %d pos_desc %d disp %ld space %d\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
||||
if( --(pStack->count) == 0 ) { /* end of loop */
|
||||
if( pConvertor->stack_pos == 0 ) {
|
||||
/* we lie about the size of the next element in order to
|
||||
* make sure we exit the main loop.
|
||||
*/
|
||||
required_space = 0xffffffff;
|
||||
pConvertor->flags |= CONVERTOR_COMPLETED;
|
||||
goto complete_loop; /* completed */
|
||||
}
|
||||
pConvertor->stack_pos--;
|
||||
pStack--;
|
||||
pos_desc++;
|
||||
} else {
|
||||
pos_desc = pStack->index + 1;
|
||||
if( pStack->index == -1 ) {
|
||||
pStack->disp += (pData->ub - pData->lb);
|
||||
} else {
|
||||
assert( DT_LOOP == description[pStack->index].loop.common.type );
|
||||
pStack->disp += description[pStack->index].loop.extent;
|
||||
}
|
||||
}
|
||||
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DO_DEBUG( opal_output( 0, "unpack new_loop count %d stack_pos %d pos_desc %d disp %ld space %d\n",
|
||||
pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, iov_len_local ); );
|
||||
}
|
||||
if( DT_LOOP == pElem->elem.common.type ) {
|
||||
long local_disp = (long)user_memory_base;
|
||||
if( pElem->loop.common.flags & DT_FLAG_CONTIGUOUS ) {
|
||||
UNPACK_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc,
|
||||
packed_buffer, user_memory_base, iov_len_local );
|
||||
if( 0 == count_desc ) { /* completed */
|
||||
pos_desc += pElem->loop.items + 1;
|
||||
goto update_loop_description;
|
||||
}
|
||||
/* Save the stack with the correct last_count value. */
|
||||
}
|
||||
local_disp = (long)user_memory_base - local_disp;
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_LOOP, count_desc,
|
||||
pStack->disp + local_disp, pos_desc + pElem->elem.disp + 1);
|
||||
pos_desc++;
|
||||
update_loop_description: /* update the current state */
|
||||
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" );
|
||||
continue;
|
||||
}
|
||||
while( pElem->elem.common.flags & DT_FLAG_DATA ) {
|
||||
/* now here we have a basic datatype */
|
||||
UNPACK_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc,
|
||||
packed_buffer, user_memory_base, iov_len_local );
|
||||
if( 0 != count_desc ) { /* completed */
|
||||
type = pElem->elem.common.type;
|
||||
assert (type < DT_MAX_PREDEFINED);
|
||||
required_space = ompi_ddt_basicDatatypes[type]->size;
|
||||
goto complete_loop;
|
||||
}
|
||||
user_memory_base = pConvertor->pBaseBuf + pStack->disp;
|
||||
pos_desc++; /* advance to the next data */
|
||||
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
|
||||
}
|
||||
}
|
||||
complete_loop:
|
||||
if( !(pConvertor->flags & CONVERTOR_COMPLETED) && (0 != iov_len_local) ) {
|
||||
/* We have some partial data here. Let's copy it into the convertor
|
||||
* and keep it hot until the next round.
|
||||
*/
|
||||
assert (type < DT_MAX_PREDEFINED);
|
||||
assert( iov_len_local < ompi_ddt_basicDatatypes[type]->size );
|
||||
memcpy( pConvertor->pending, packed_buffer, iov_len_local );
|
||||
DO_DEBUG( opal_output( 0, "Saving %d bytes for the next call\n", iov_len_local ); );
|
||||
pConvertor->pending_length = iov_len_local;
|
||||
iov_len_local = 0;
|
||||
}
|
||||
iov[iov_count].iov_len -= iov_len_local; /* update the amount of valid data */
|
||||
total_unpacked += iov[iov_count].iov_len;
|
||||
pConvertor->bConverted += iov[iov_count].iov_len; /* update the already converted bytes */
|
||||
}
|
||||
*max_data = total_unpacked;
|
||||
*out_size = iov_count;
|
||||
if( !(pConvertor->flags & CONVERTOR_COMPLETED) ) {
|
||||
/* I complete an element, next step I should go to the next one */
|
||||
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, DT_BYTE, count_desc,
|
||||
user_memory_base - pStack->disp - pConvertor->pBaseBuf, pos_desc );
|
||||
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 ); );
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user