Skip to content

Commit 19607da

Browse files
author
Sergey Oblomov
committed
PML/UCX: create convertor clone instead of stack reset
Signed-off-by: Sergey Oblomov <[email protected]>
1 parent 7c5de01 commit 19607da

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

ompi/mca/pml/ucx/pml_ucx_datatype.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,32 @@ static ucs_status_t pml_ucx_generic_datatype_unpack(void *state, size_t offset,
8181

8282
uint32_t iov_count;
8383
struct iovec iov;
84+
opal_convertor_t conv;
8485

8586
iov_count = 1;
8687
iov.iov_base = (void*)src;
8788
iov.iov_len = length;
8889

89-
/* if we detected out-of-order message - apply hack: reset datatype stack
90-
* of convertor to allow re-build it on set_position call */
91-
if ((offset != convertor->offset) &&
92-
!(convertor->opal_conv.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) ) {
93-
opal_convertor_reset_stack_at_beginning(&convertor->opal_conv);
90+
/* in case if unordered message arrived - create separate convertor to
91+
* unpack data. */
92+
if (offset != convertor->offset) {
93+
OBJ_CONSTRUCT(&conv, opal_convertor_t);
94+
opal_convertor_copy_and_prepare_for_recv(ompi_proc_local_proc->super.proc_convertor,
95+
&convertor->datatype->super,
96+
convertor->opal_conv.count,
97+
convertor->opal_conv.pBaseBuf, 0,
98+
&conv);
99+
opal_convertor_set_position(&conv, &offset);
100+
opal_convertor_unpack(&conv, &iov, &iov_count, &length);
101+
opal_convertor_cleanup(&conv);
102+
OBJ_DESTRUCT(&conv);
103+
/* permanently switch to un-ordered mode */
104+
convertor->offset = 0;
105+
} else {
106+
opal_convertor_set_position(&convertor->opal_conv, &offset);
107+
opal_convertor_unpack(&convertor->opal_conv, &iov, &iov_count, &length);
108+
convertor->offset += length;
94109
}
95-
opal_convertor_set_position(&convertor->opal_conv, &offset);
96-
opal_convertor_unpack(&convertor->opal_conv, &iov, &iov_count, &length);
97-
convertor->offset = offset + length;
98110
return UCS_OK;
99111
}
100112

opal/datatype/opal_convertor.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,6 @@ int opal_convertor_create_stack_at_begining( opal_convertor_t* convertor,
409409
}
410410

411411

412-
int32_t opal_convertor_reset_stack_at_beginning( opal_convertor_t* convertor )
413-
{
414-
return opal_convertor_create_stack_at_begining( convertor, opal_datatype_local_sizes );
415-
}
416-
417-
418412
int32_t opal_convertor_set_position_nocheck( opal_convertor_t* convertor,
419413
size_t* position )
420414
{

opal/datatype/opal_convertor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,6 @@ opal_convertor_set_position( opal_convertor_t* convertor,
339339
return opal_convertor_set_position_nocheck( convertor, position );
340340
}
341341

342-
/*
343-
*
344-
*/
345-
OPAL_DECLSPEC int32_t
346-
opal_convertor_reset_stack_at_beginning( opal_convertor_t* convertor );
347342
/*
348343
*
349344
*/

0 commit comments

Comments
 (0)