Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ompi/mpi/c/pack_external.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -78,10 +78,10 @@ int MPI_Pack_external(const char datarep[], const void *inbuf, int incount,
* CONVERTOR_SEND_CONVERSION in order to force the convertor to do anything
* more than just packing the data.
*/
opal_convertor_copy_and_prepare_for_send( ompi_mpi_external32_convertor,
&(datatype->super), incount, (void *) inbuf,
CONVERTOR_SEND_CONVERSION,
&local_convertor );
opal_convertor_copy_and_prepare_for_send_external( ompi_mpi_external32_convertor,
&(datatype->super), incount, (void *) inbuf,
CONVERTOR_SEND_CONVERSION,
&local_convertor );

/* Check for truncation */
opal_convertor_get_packed_size( &local_convertor, &size );
Expand Down
6 changes: 3 additions & 3 deletions ompi/mpi/c/unpack_external.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -72,8 +72,8 @@ int MPI_Unpack_external (const char datarep[], const void *inbuf, MPI_Aint insiz
OBJ_CONSTRUCT(&local_convertor, opal_convertor_t);

/* the resulting convertor will be set to the position ZERO */
opal_convertor_copy_and_prepare_for_recv( ompi_mpi_external32_convertor,
&(datatype->super), outcount, outbuf, 0, &local_convertor );
opal_convertor_copy_and_prepare_for_recv_external( ompi_mpi_external32_convertor,
&(datatype->super), outcount, outbuf, 0, &local_convertor );

/* Check for truncation */
opal_convertor_get_packed_size( &local_convertor, &size );
Expand Down
64 changes: 55 additions & 9 deletions opal/datatype/opal_convertor.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2013 Research Organization for Information Science
* Copyright (c) 2013-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -451,7 +451,6 @@ int32_t opal_convertor_set_position_nocheck( opal_convertor_t* convertor,
/**
* Compute the remote size.
*/
#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
#define OPAL_CONVERTOR_COMPUTE_REMOTE_SIZE(convertor, datatype, bdt_mask) \
{ \
if( OPAL_UNLIKELY(0 != (bdt_mask)) ) { \
Expand All @@ -472,13 +471,6 @@ int32_t opal_convertor_set_position_nocheck( opal_convertor_t* convertor,
convertor->use_desc = &(datatype->desc); \
} \
}
#else
#define OPAL_CONVERTOR_COMPUTE_REMOTE_SIZE(convertor, datatype, bdt_mask) \
{ \
assert(0 == (bdt_mask)); \
(void)bdt_mask; /* silence compiler warning */ \
}
#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT */

/**
* This macro will initialize a convertor based on a previously created
Expand Down Expand Up @@ -592,6 +584,32 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
}


int32_t opal_convertor_prepare_for_recv_external( opal_convertor_t* convertor,
const struct opal_datatype_t* datatype,
int32_t count,
const void* pUserBuf )
{
/* Here I should check that the data is not overlapping */

convertor->flags |= CONVERTOR_RECV;
#if OPAL_CUDA_SUPPORT
mca_cuda_convertor_init(convertor, pUserBuf);
#endif

OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf );

assert(! (convertor->flags & CONVERTOR_WITH_CHECKSUM));
if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) {
convertor->fAdvance = opal_unpack_general;
} else if( convertor->pDesc->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
convertor->fAdvance = opal_unpack_homogeneous_contig;
} else {
convertor->fAdvance = opal_generic_simple_unpack;
}
return OPAL_SUCCESS;
}


int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
const struct opal_datatype_t* datatype,
int32_t count,
Expand Down Expand Up @@ -628,6 +646,34 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
return OPAL_SUCCESS;
}

int32_t opal_convertor_prepare_for_send_external( opal_convertor_t* convertor,
const struct opal_datatype_t* datatype,
int32_t count,
const void* pUserBuf )
{
#if OPAL_CUDA_SUPPORT
mca_cuda_convertor_init(convertor, pUserBuf);
#endif

OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf );
convertor->flags |= CONVERTOR_SEND;

assert(! (convertor->flags & CONVERTOR_WITH_CHECKSUM));

if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) {
convertor->fAdvance = opal_pack_general;
} else if( datatype->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
if( ((datatype->ub - datatype->lb) == (OPAL_PTRDIFF_TYPE)datatype->size)
|| (1 >= convertor->count) )
convertor->fAdvance = opal_pack_homogeneous_contig;
else
convertor->fAdvance = opal_pack_homogeneous_contig_with_gaps;
} else {
convertor->fAdvance = opal_generic_simple_pack;
}
return OPAL_SUCCESS;
}

/*
* These functions can be used in order to create an IDENTICAL copy of one convertor. In this
* context IDENTICAL means that the datatype and count and all other properties of the basic
Expand Down
45 changes: 45 additions & 0 deletions opal/datatype/opal_convertor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2014 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -249,6 +251,28 @@ static inline int32_t opal_convertor_copy_and_prepare_for_send( const opal_conve
return opal_convertor_prepare_for_send( convertor, datatype, count, pUserBuf );
}

/*
*
*/
OPAL_DECLSPEC int32_t opal_convertor_prepare_for_send_external( opal_convertor_t* convertor,
const struct opal_datatype_t* datatype,
int32_t count,
const void* pUserBuf);

static inline int32_t opal_convertor_copy_and_prepare_for_send_external( const opal_convertor_t* pSrcConv,
const struct opal_datatype_t* datatype,
int32_t count,
const void* pUserBuf,
int32_t flags,
opal_convertor_t* convertor )
{
convertor->remoteArch = pSrcConv->remoteArch;
convertor->flags = pSrcConv->flags | flags;
convertor->master = pSrcConv->master;

return opal_convertor_prepare_for_send_external( convertor, datatype, count, pUserBuf );
}

/*
*
*/
Expand All @@ -270,6 +294,27 @@ static inline int32_t opal_convertor_copy_and_prepare_for_recv( const opal_conve
return opal_convertor_prepare_for_recv( convertor, datatype, count, pUserBuf );
}

/*
*
*/
OPAL_DECLSPEC int32_t opal_convertor_prepare_for_recv_external( opal_convertor_t* convertor,
const struct opal_datatype_t* datatype,
int32_t count,
const void* pUserBuf );
static inline int32_t opal_convertor_copy_and_prepare_for_recv_external( const opal_convertor_t* pSrcConv,
const struct opal_datatype_t* datatype,
int32_t count,
const void* pUserBuf,
int32_t flags,
opal_convertor_t* convertor )
{
convertor->remoteArch = pSrcConv->remoteArch;
convertor->flags = (pSrcConv->flags | flags);
convertor->master = pSrcConv->master;

return opal_convertor_prepare_for_recv_external( convertor, datatype, count, pUserBuf );
}

/*
* Give access to the raw memory layout based on the datatype.
*/
Expand Down
Loading