Add more knowledge into the master convertor. Now all the conversion
function are stored in a single location, th master convertor. With the old information (mainly the remote sizes for each predefined data-type) now we know everything we need about the remote peers. This commit was SVN r9829.
Этот коммит содержится в:
родитель
4438be5bcb
Коммит
3929ae7010
@ -84,6 +84,9 @@ void ompi_convertor_destroy_masters( void )
|
||||
}
|
||||
}
|
||||
|
||||
extern conversion_fct_t ompi_ddt_heterogeneous_copy_functions[DT_MAX_PREDEFINED];
|
||||
extern conversion_fct_t ompi_ddt_copy_functions[DT_MAX_PREDEFINED];
|
||||
|
||||
ompi_convertor_master_t* ompi_convertor_find_or_create_master( uint32_t remote_arch )
|
||||
{
|
||||
ompi_convertor_master_t* master = ompi_convertor_master_list;
|
||||
@ -142,6 +145,13 @@ ompi_convertor_master_t* ompi_convertor_find_or_create_master( uint32_t remote_a
|
||||
} else {
|
||||
opal_output( 0, "Unknown sizeof(fortran logical) for the remote architecture\n" );
|
||||
}
|
||||
|
||||
if( master->remote_arch == ompi_mpi_local_arch ) {
|
||||
master->pFunctions = ompi_ddt_copy_functions;
|
||||
} else {
|
||||
master->pFunctions = ompi_ddt_heterogeneous_copy_functions;
|
||||
}
|
||||
|
||||
/* We're done so far, return th mater convertor */
|
||||
return master;
|
||||
}
|
||||
@ -154,7 +164,6 @@ ompi_convertor_t* ompi_convertor_create( int32_t remote_arch, int32_t mode )
|
||||
master = ompi_convertor_find_or_create_master( remote_arch );
|
||||
|
||||
convertor->remoteArch = remote_arch;
|
||||
convertor->pFunctions = ompi_ddt_copy_functions;
|
||||
convertor->stack_pos = 0;
|
||||
|
||||
return convertor;
|
||||
@ -461,7 +470,6 @@ ompi_convertor_prepare_for_recv( ompi_convertor_t* convertor,
|
||||
if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) {
|
||||
#if OMPI_ENABLE_HETEROGENEOUS_SUPPORT
|
||||
if (convertor->remoteArch != ompi_mpi_local_arch) {
|
||||
convertor->pFunctions = ompi_ddt_heterogeneous_copy_functions;
|
||||
convertor->fAdvance = ompi_unpack_general_checksum;
|
||||
} else
|
||||
#endif
|
||||
@ -474,7 +482,6 @@ ompi_convertor_prepare_for_recv( ompi_convertor_t* convertor,
|
||||
} else {
|
||||
#if OMPI_ENABLE_HETEROGENEOUS_SUPPORT
|
||||
if (convertor->remoteArch != ompi_mpi_local_arch) {
|
||||
convertor->pFunctions = ompi_ddt_heterogeneous_copy_functions;
|
||||
convertor->fAdvance = ompi_unpack_general;
|
||||
} else
|
||||
#endif
|
||||
@ -550,7 +557,7 @@ int ompi_convertor_clone( const ompi_convertor_t* source,
|
||||
destination->fAdvance = source->fAdvance;
|
||||
destination->memAlloc_fn = source->memAlloc_fn;
|
||||
destination->memAlloc_userdata = source->memAlloc_userdata;
|
||||
destination->pFunctions = source->pFunctions;
|
||||
destination->master = source->master;
|
||||
destination->local_size = source->local_size;
|
||||
destination->remote_size = source->remote_size;
|
||||
/* create the stack */
|
||||
|
@ -46,7 +46,6 @@ extern "C" {
|
||||
#define CONVERTOR_CLONE 0x00100000
|
||||
#define CONVERTOR_WITH_CHECKSUM 0x00200000
|
||||
#define CONVERTOR_TYPE_MASK 0x00FF0000
|
||||
#define CONVERTOR_STATE_MASK 0xFF000000
|
||||
#define CONVERTOR_STATE_START 0x01000000
|
||||
#define CONVERTOR_STATE_COMPLETE 0x02000000
|
||||
#define CONVERTOR_STATE_ALLOC 0x04000000
|
||||
@ -55,11 +54,6 @@ extern "C" {
|
||||
|
||||
typedef struct ompi_convertor_t ompi_convertor_t;
|
||||
|
||||
typedef int32_t (*conversion_fct_t)( ompi_convertor_t* pConvertor, uint32_t count,
|
||||
const void* from, uint32_t from_len, long from_extent,
|
||||
void* to, uint32_t to_length, long to_extent,
|
||||
uint32_t *advance );
|
||||
|
||||
typedef int32_t (*convertor_advance_fct_t)( ompi_convertor_t* pConvertor,
|
||||
struct iovec* iov,
|
||||
uint32_t* out_size,
|
||||
@ -104,7 +98,6 @@ struct ompi_convertor_t {
|
||||
memalloc_fct_t memAlloc_fn; /**< pointer to the memory allocation function */
|
||||
void* memAlloc_userdata; /**< user data for the malloc function */
|
||||
struct ompi_convertor_master_t* master; /* the master convertor */
|
||||
conversion_fct_t* pFunctions; /**< the convertor functions pointer */
|
||||
/* All others fields get modified for every call to pack/unpack functions */
|
||||
uint32_t stack_pos; /**< the actual position on the stack */
|
||||
size_t bConverted; /**< # of bytes already converted */
|
||||
@ -121,9 +114,6 @@ OMPI_DECLSPEC extern ompi_convertor_t* ompi_mpi_external32_convertor;
|
||||
OMPI_DECLSPEC extern ompi_convertor_t* ompi_mpi_local_convertor;
|
||||
OMPI_DECLSPEC extern uint32_t ompi_mpi_local_arch;
|
||||
|
||||
extern conversion_fct_t ompi_ddt_copy_functions[];
|
||||
extern conversion_fct_t ompi_ddt_heterogeneous_copy_functions[];
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
@ -250,9 +240,8 @@ ompi_convertor_copy_and_prepare_for_send( const ompi_convertor_t* pSrcConv,
|
||||
ompi_convertor_t* convertor )
|
||||
{
|
||||
convertor->remoteArch = pSrcConv->remoteArch;
|
||||
convertor->pFunctions = pSrcConv->pFunctions;
|
||||
convertor->flags = (pSrcConv->flags | flags) & ~CONVERTOR_STATE_MASK;
|
||||
|
||||
convertor->flags = (pSrcConv->flags | flags);
|
||||
convertor->master = pSrcConv->master;
|
||||
return ompi_convertor_prepare_for_send( convertor, datatype, count, pUserBuf );
|
||||
}
|
||||
|
||||
@ -273,9 +262,9 @@ ompi_convertor_copy_and_prepare_for_recv( const ompi_convertor_t* pSrcConv,
|
||||
ompi_convertor_t* convertor )
|
||||
{
|
||||
convertor->remoteArch = pSrcConv->remoteArch;
|
||||
convertor->pFunctions = pSrcConv->pFunctions;
|
||||
convertor->flags = (pSrcConv->flags | flags) & ~CONVERTOR_STATE_MASK;
|
||||
|
||||
convertor->flags = (pSrcConv->flags | flags);
|
||||
convertor->master = pSrcConv->master;
|
||||
|
||||
return ompi_convertor_prepare_for_recv( convertor, datatype, count, pUserBuf );
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,16 @@
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/datatype/convertor.h"
|
||||
|
||||
typedef int32_t (*conversion_fct_t)( ompi_convertor_t* pConvertor, uint32_t count,
|
||||
const void* from, uint32_t from_len, long from_extent,
|
||||
void* to, uint32_t to_length, long to_extent,
|
||||
uint32_t *advance );
|
||||
|
||||
typedef struct ompi_convertor_master_t {
|
||||
struct ompi_convertor_master_t* next;
|
||||
uint32_t remote_arch;
|
||||
const int32_t remote_sizes[DT_MAX_PREDEFINED];
|
||||
conversion_fct_t* pFunctions; /**< the convertor functions pointer */
|
||||
} ompi_convertor_master_t;
|
||||
|
||||
/*
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "ompi/datatype/convertor.h"
|
||||
#include "ompi/datatype/datatype_internal.h"
|
||||
#include "ompi/datatype/datatype_checksum.h"
|
||||
#include "ompi/datatype/convertor_internal.h"
|
||||
|
||||
/*
|
||||
* This function is used to copy data from one buffer to another. The assumption
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "ompi/datatype/convertor.h"
|
||||
#include "ompi/datatype/datatype_internal.h"
|
||||
#include "ompi/datatype/datatype_checksum.h"
|
||||
|
||||
#include "ompi/datatype/convertor_internal.h"
|
||||
|
||||
static inline void
|
||||
ompi_dt_swap_bytes(void *to_p, const void *from_p, const long size)
|
||||
|
@ -18,8 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/datatype/convertor.h"
|
||||
#include "ompi/datatype/convertor_internal.h"
|
||||
#include "ompi/datatype/datatype_internal.h"
|
||||
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
@ -69,6 +68,7 @@ ompi_unpack_general_function( ompi_convertor_t* pConvertor,
|
||||
uint32_t advance; /* number of bytes that we should advance the buffer */
|
||||
long disp_desc = 0; /* compute displacement for truncated data */
|
||||
int bConverted = 0; /* number of bytes converted this time */
|
||||
const ompi_convertor_master_t* master = pConvertor->master;
|
||||
dt_elem_desc_t* pElems;
|
||||
int oCount = (pConvertor->pDesc->ub - pConvertor->pDesc->lb) * pConvertor->count;
|
||||
char* pInput;
|
||||
@ -128,10 +128,10 @@ ompi_unpack_general_function( ompi_convertor_t* pConvertor,
|
||||
while( pElems[pos_desc].elem.common.flags & DT_FLAG_DATA ) {
|
||||
/* now here we have a basic datatype */
|
||||
type = pElems[pos_desc].elem.common.type;
|
||||
rc = pConvertor->pFunctions[type]( pConvertor, count_desc,
|
||||
pInput, iCount, ompi_ddt_basicDatatypes[type]->size,
|
||||
pConvertor->pBaseBuf + pStack->disp + disp_desc,
|
||||
oCount, pElems[pos_desc].elem.extent, &advance );
|
||||
rc = master->pFunctions[type]( pConvertor, count_desc,
|
||||
pInput, iCount, ompi_ddt_basicDatatypes[type]->size,
|
||||
pConvertor->pBaseBuf + pStack->disp + disp_desc,
|
||||
oCount, pElems[pos_desc].elem.extent, &advance );
|
||||
iCount -= advance; /* decrease the available space in the buffer */
|
||||
pInput += advance; /* increase the pointer to the buffer */
|
||||
bConverted += advance;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user