diff --git a/ompi/mca/pml/ucx/pml_ucx_datatype.c b/ompi/mca/pml/ucx/pml_ucx_datatype.c index 9651c6b8ca..951b41139a 100644 --- a/ompi/mca/pml/ucx/pml_ucx_datatype.c +++ b/ompi/mca/pml/ucx/pml_ucx_datatype.c @@ -81,20 +81,32 @@ static ucs_status_t pml_ucx_generic_datatype_unpack(void *state, size_t offset, uint32_t iov_count; struct iovec iov; + opal_convertor_t conv; iov_count = 1; iov.iov_base = (void*)src; iov.iov_len = length; - /* if we detected out-of-order message - apply hack: reset datatype stack - * of convertor to allow re-build it on set_position call */ - if ((offset != convertor->offset) && - !(convertor->opal_conv.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) ) { - opal_convertor_reset_stack_at_beginning(&convertor->opal_conv); + /* in case if unordered message arrived - create separate convertor to + * unpack data. */ + if (offset != convertor->offset) { + OBJ_CONSTRUCT(&conv, opal_convertor_t); + opal_convertor_copy_and_prepare_for_recv(ompi_proc_local_proc->super.proc_convertor, + &convertor->datatype->super, + convertor->opal_conv.count, + convertor->opal_conv.pBaseBuf, 0, + &conv); + opal_convertor_set_position(&conv, &offset); + opal_convertor_unpack(&conv, &iov, &iov_count, &length); + opal_convertor_cleanup(&conv); + OBJ_DESTRUCT(&conv); + /* permanently switch to un-ordered mode */ + convertor->offset = 0; + } else { + opal_convertor_set_position(&convertor->opal_conv, &offset); + opal_convertor_unpack(&convertor->opal_conv, &iov, &iov_count, &length); + convertor->offset += length; } - opal_convertor_set_position(&convertor->opal_conv, &offset); - opal_convertor_unpack(&convertor->opal_conv, &iov, &iov_count, &length); - convertor->offset = offset + length; return UCS_OK; } diff --git a/opal/datatype/opal_convertor.c b/opal/datatype/opal_convertor.c index ec0c07688d..63b4d71408 100644 --- a/opal/datatype/opal_convertor.c +++ b/opal/datatype/opal_convertor.c @@ -409,12 +409,6 @@ int opal_convertor_create_stack_at_begining( opal_convertor_t* convertor, } -int32_t opal_convertor_reset_stack_at_beginning( opal_convertor_t* convertor ) -{ - return opal_convertor_create_stack_at_begining( convertor, opal_datatype_local_sizes ); -} - - int32_t opal_convertor_set_position_nocheck( opal_convertor_t* convertor, size_t* position ) { diff --git a/opal/datatype/opal_convertor.h b/opal/datatype/opal_convertor.h index fc7890972c..22a2bb1de3 100644 --- a/opal/datatype/opal_convertor.h +++ b/opal/datatype/opal_convertor.h @@ -339,11 +339,6 @@ opal_convertor_set_position( opal_convertor_t* convertor, return opal_convertor_set_position_nocheck( convertor, position ); } -/* - * - */ -OPAL_DECLSPEC int32_t -opal_convertor_reset_stack_at_beginning( opal_convertor_t* convertor ); /* * */