From 0eabdd94986248e13aa0ab313734d26438276107 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 26 Aug 2005 22:41:04 +0000 Subject: [PATCH] The correct way to detect if a contiguous datatpe has gaps around (in the begining or at the end) is to check the size and the extent (not the true extent). If there are gaps we should adapt the source and the destination to match these gaps (especially if the gaps are in the begining). This commit was SVN r7060. --- ompi/datatype/dt_unpack.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ompi/datatype/dt_unpack.c b/ompi/datatype/dt_unpack.c index 53b57d43b2..4f0279d078 100644 --- a/ompi/datatype/dt_unpack.c +++ b/ompi/datatype/dt_unpack.c @@ -765,7 +765,12 @@ int32_t ompi_ddt_copy_content_same_ddt( const ompi_datatype_t* datatype, int32_t */ if( (datatype->flags & DT_FLAG_CONTIGUOUS) == DT_FLAG_CONTIGUOUS ) { long extent = (datatype->ub - datatype->lb); - if( (long)datatype->size == (datatype->true_ub - datatype->true_lb) ) { /* all contiguous */ + /* Now that we know the datatype is contiguous, we should move the 2 pointers + * source and destination to the correct displacement. + */ + pDestBuf += datatype->lb; + pSrcBuf += datatype->lb; + if( (long)datatype->size == extent ) { /* all contiguous == no gaps around */ int total_length = datatype->size * count; lastLength = 128 * 1024; if( lastLength > total_length ) lastLength = total_length;