Skip to content

Commit d60cc62

Browse files
authored
Merge pull request #9664 from vspetrov/v4.0.x
V4.0.x: coll/hcoll: fixes fallback on rooted ops
2 parents 1cc0be1 + 7e2b98a commit d60cc62

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

ompi/mca/coll/hcoll/coll_hcoll_ops.c

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,19 @@ int mca_coll_hcoll_gather(const void *sbuf, int scount,
155155
struct ompi_datatype_t *rdtype,
156156
int root,
157157
struct ompi_communicator_t *comm,
158-
mca_coll_base_module_t *module){
158+
mca_coll_base_module_t *module)
159+
{
160+
mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module;
159161
dte_data_representation_t stype;
160162
dte_data_representation_t rtype;
161163
int rc;
164+
162165
HCOL_VERBOSE(20,"RUNNING HCOL GATHER");
163-
mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module;
166+
167+
if (root != comm->c_my_rank) {
168+
rdtype = sdtype;
169+
}
170+
164171
stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED);
165172
rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED);
166173
if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) {
@@ -367,13 +374,19 @@ int mca_coll_hcoll_gatherv(const void* sbuf, int scount,
367374
struct ompi_communicator_t *comm,
368375
mca_coll_base_module_t *module)
369376
{
377+
mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module;
370378
dte_data_representation_t stype;
371379
dte_data_representation_t rtype;
372380
int rc;
373381
HCOL_VERBOSE(20,"RUNNING HCOL GATHERV");
374-
mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module;
382+
383+
if (root != comm->c_my_rank) {
384+
rdtype = sdtype;
385+
}
386+
375387
stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED);
376388
rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED);
389+
377390
if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) {
378391
/*If we are here then datatype is not simple predefined datatype */
379392
/*In future we need to add more complex mapping to the dte_data_representation_t */
@@ -386,7 +399,9 @@ int mca_coll_hcoll_gatherv(const void* sbuf, int scount,
386399
comm, hcoll_module->previous_gatherv_module);
387400
return rc;
388401
}
389-
rc = hcoll_collectives.coll_gatherv((void *)sbuf, scount, stype, rbuf, (int *)rcounts, (int *)displs, rtype, root, hcoll_module->hcoll_context);
402+
rc = hcoll_collectives.coll_gatherv((void *)sbuf, scount, stype, rbuf,
403+
(int *)rcounts, (int *)displs, rtype,
404+
root, hcoll_module->hcoll_context);
390405
if (HCOLL_SUCCESS != rc){
391406
HCOL_VERBOSE(20,"RUNNING FALLBACK GATHERV");
392407
rc = hcoll_module->previous_gatherv(sbuf,scount,sdtype,
@@ -651,13 +666,20 @@ int mca_coll_hcoll_igatherv(const void* sbuf, int scount,
651666
ompi_request_t ** request,
652667
mca_coll_base_module_t *module)
653668
{
669+
mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module;
654670
dte_data_representation_t stype;
655671
dte_data_representation_t rtype;
656672
int rc;
657673
void** rt_handle;
674+
658675
HCOL_VERBOSE(20,"RUNNING HCOL IGATHERV");
659-
mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module;
676+
660677
rt_handle = (void**) request;
678+
679+
if (root != comm->c_my_rank) {
680+
rdtype = sdtype;
681+
}
682+
661683
stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED);
662684
rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED);
663685
if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) {

0 commit comments

Comments
 (0)