Skip to content

Commit 0482a5b

Browse files
authored
Merge pull request #6438 from bosilca/issues/6436/v3.0
Issues/6436/v3.0
2 parents aa3abb8 + 1098a39 commit 0482a5b

File tree

3 files changed

+383
-11
lines changed

3 files changed

+383
-11
lines changed

opal/datatype/opal_convertor_raw.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* reserved.
66
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
77
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
8-
* Copyright (c) 2017 Research Organization for Information Science
9-
* and Technology (RIST). All rights reserved.
8+
* Copyright (c) 2017-2019 Research Organization for Information Science
9+
* and Technology (RIST). All rights reserved.
1010
* $COPYRIGHT$
1111
*
1212
* Additional copyrights may follow
@@ -102,7 +102,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
102102
/* now here we have a basic datatype */
103103
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
104104
pConvertor->pDesc, pConvertor->count );
105-
DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %lu}\n",
105+
DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %" PRIsize_t "}\n",
106106
index, (void*)source_base, (unsigned long)blength ); );
107107
iov[index].iov_base = (IOVBASE_TYPE *) source_base;
108108
iov[index].iov_len = blength;
@@ -115,7 +115,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
115115
for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
116116
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
117117
pConvertor->pDesc, pConvertor->count );
118-
DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %lu}\n",
118+
DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n",
119119
index, (void*)source_base, (unsigned long)blength ); );
120120
iov[index].iov_base = (IOVBASE_TYPE *) source_base;
121121
iov[index].iov_len = blength;
@@ -170,23 +170,30 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
170170
ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)(pElem + pElem->loop.items);
171171

172172
if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
173-
uint32_t i;
174-
source_base += end_loop->first_elem_disp;
175-
for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
173+
ptrdiff_t offset = end_loop->first_elem_disp;
174+
source_base += offset;
175+
for(size_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) {
176176
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf,
177177
pConvertor->pDesc, pConvertor->count );
178178
iov[index].iov_base = (IOVBASE_TYPE *) source_base;
179179
iov[index].iov_len = end_loop->size;
180180
source_base += pElem->loop.extent;
181181
raw_data += end_loop->size;
182182
count_desc--;
183+
DO_DEBUG( opal_output( 0, "raw contig loop generate iov[%d] = {base %p, length %" PRIsize_t "}"
184+
"space %lu [pos_desc %d]\n",
185+
index, iov[index].iov_base, iov[index].iov_len,
186+
(unsigned long)raw_data, pos_desc ); );
183187
}
184-
source_base -= end_loop->first_elem_disp;
188+
source_base -= offset;
185189
if( 0 == count_desc ) { /* completed */
186190
pos_desc += pElem->loop.items + 1;
187191
goto update_loop_description;
188192
}
189193
}
194+
if( index == *iov_count ) { /* all iov have been filled, we need to bail out */
195+
goto complete_loop;
196+
}
190197
local_disp = (ptrdiff_t)source_base - local_disp;
191198
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc,
192199
pStack->disp + local_disp);

test/datatype/Makefile.am

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# reserved.
55
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
66
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
7-
# Copyright (c) 2014-2015 Research Organization for Information Science
8-
# and Technology (RIST). All rights reserved.
7+
# Copyright (c) 2014-2019 Research Organization for Information Science
8+
# and Technology (RIST). All rights reserved.
99
# Copyright (c) 2016 IBM Corporation. All rights reserved.
1010
# $COPYRIGHT$
1111
#
@@ -15,7 +15,7 @@
1515
#
1616

1717
if PROJECT_OMPI
18-
MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw unpack_ooo ddt_pack external32
18+
MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw ddt_raw2 unpack_ooo ddt_pack external32
1919
MPI_CHECKS = to_self
2020
endif
2121
TESTS = opal_datatype_test unpack_hetero $(MPI_TESTS)
@@ -40,6 +40,12 @@ ddt_raw_LDADD = \
4040
$(top_builddir)/ompi/lib@[email protected] \
4141
$(top_builddir)/opal/lib@[email protected]
4242

43+
ddt_raw2_SOURCES = ddt_raw2.c ddt_lib.c ddt_lib.h
44+
ddt_raw2_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS)
45+
ddt_raw2_LDADD = \
46+
$(top_builddir)/ompi/lib@[email protected] \
47+
$(top_builddir)/opal/lib@[email protected]
48+
4349
ddt_pack_SOURCES = ddt_pack.c
4450
ddt_pack_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS)
4551
ddt_pack_LDADD = \

0 commit comments

Comments
 (0)