Skip to content

Commit 192152f

Browse files
author
Sergey Oblomov
committed
PML/UCX: create convertor clone on unordered recv
picked from master commit: 7c5de01 19607da 5ec2691 Signed-off-by: Sergey Oblomov <[email protected]>
1 parent 5d920bc commit 192152f

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

ompi/mca/pml/ucx/pml_ucx_datatype.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ static void* pml_ucx_generic_datatype_start_unpack(void *context, void *buffer,
4040

4141
OMPI_DATATYPE_RETAIN(datatype);
4242
convertor->datatype = datatype;
43+
convertor->offset = 0;
4344
opal_convertor_copy_and_prepare_for_recv(ompi_proc_local_proc->super.proc_convertor,
4445
&datatype->super, count, buffer, 0,
4546
&convertor->opal_conv);
@@ -80,13 +81,31 @@ static ucs_status_t pml_ucx_generic_datatype_unpack(void *state, size_t offset,
8081

8182
uint32_t iov_count;
8283
struct iovec iov;
84+
opal_convertor_t conv;
8385

8486
iov_count = 1;
8587
iov.iov_base = (void*)src;
8688
iov.iov_len = length;
8789

88-
opal_convertor_set_position(&convertor->opal_conv, &offset);
89-
opal_convertor_unpack(&convertor->opal_conv, &iov, &iov_count, &length);
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_unpack(&convertor->opal_conv, &iov, &iov_count, &length);
107+
convertor->offset += length;
108+
}
90109
return UCS_OK;
91110
}
92111

ompi/mca/pml/ucx/pml_ucx_datatype.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ struct pml_ucx_convertor {
1717
opal_free_list_item_t super;
1818
ompi_datatype_t *datatype;
1919
opal_convertor_t opal_conv;
20+
size_t offset;
2021
};
2122

2223

0 commit comments

Comments
 (0)