Skip to content

Commit ea40d48

Browse files
authored
Merge pull request #6295 from ggouaillardet/topic/opal_convertor_raw
opal/datatype: fix opal_convertor_raw()
2 parents f9338da + 0832ab5 commit ea40d48

File tree

3 files changed

+352
-7
lines changed

3 files changed

+352
-7
lines changed

opal/datatype/opal_convertor_raw.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
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-2018 Research Organization for Information Science
8+
* Copyright (c) 2017-2019 Research Organization for Information Science
99
* and Technology (RIST). All rights reserved.
1010
* $COPYRIGHT$
1111
*
@@ -170,8 +170,18 @@ 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-
source_base += end_loop->first_elem_disp;
174-
for(size_t 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 = count_desc; i > 0; i--, index++ ) {
176+
if (index >= *iov_count) {
177+
dt_elem_desc_t* nElem = pElem + 1;
178+
while (nElem->elem.common.type == OPAL_DATATYPE_LOOP) {
179+
nElem++;
180+
}
181+
assert(OPAL_DATATYPE_END_LOOP != nElem->elem.common.type);
182+
offset = nElem->elem.disp;
183+
break;
184+
}
175185
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf,
176186
pConvertor->pDesc, pConvertor->count );
177187
iov[index].iov_base = (IOVBASE_TYPE *) source_base;
@@ -180,7 +190,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
180190
raw_data += end_loop->size;
181191
count_desc--;
182192
}
183-
source_base -= end_loop->first_elem_disp;
193+
source_base -= offset;
184194
if( 0 == count_desc ) { /* completed */
185195
pos_desc += pElem->loop.items + 1;
186196
goto update_loop_description;

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 large_data
18+
MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw ddt_raw2 unpack_ooo ddt_pack external32 large_data
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@OMPI_LIBMPI_NAME@.la \
4141
$(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la
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@OMPI_LIBMPI_NAME@.la \
47+
$(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la
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)