Skip to content

Commit 00ad168

Browse files
committed
WIP: Add smsc endpoints to HAN
Signed-off-by: Luke Robison <[email protected]>
1 parent 4544311 commit 00ad168

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

ompi/mca/coll/han/coll_han.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "coll_han_trigger.h"
4242
#include "ompi/mca/coll/han/coll_han_dynamic.h"
4343
#include "coll_han_algorithms.h"
44+
#include "opal/mca/smsc/smsc.h"
4445

4546
/*
4647
* Today;
@@ -341,6 +342,7 @@ typedef struct mca_coll_han_module_t {
341342

342343
/* Sub-communicator */
343344
struct ompi_communicator_t *sub_comm[NB_TOPO_LVL];
345+
mca_smsc_endpoint_t **local_smsc_eps;
344346
} mca_coll_han_module_t;
345347
OBJ_CLASS_DECLARATION(mca_coll_han_module_t);
346348

ompi/mca/coll/han/coll_han_module.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ mca_coll_han_module_destruct(mca_coll_han_module_t * module)
138138
free(module->cached_topo);
139139
module->cached_topo = NULL;
140140
}
141+
if (module->local_smsc_eps != NULL) {
142+
int low_size = ompi_comm_size(module->sub_comm[0]);
143+
for (i=0; i<low_size; i++) {
144+
mca_smsc->return_endpoint( module->local_smsc_eps[i] );
145+
}
146+
}
141147
for(i=0 ; i<NB_TOPO_LVL ; i++) {
142148
if(NULL != module->sub_comm[i]) {
143149
ompi_comm_free(&(module->sub_comm[i]));

ompi/mca/coll/han/coll_han_subcomms.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "mpi.h"
2626
#include "coll_han.h"
2727
#include "coll_han_dynamic.h"
28+
#include "opal/mca/smsc/smsc.h"
2829

2930
#define HAN_SUBCOM_SAVE_COLLECTIVE(FALLBACKS, COMM, HANM, COLL) \
3031
do { \
@@ -183,6 +184,20 @@ int mca_coll_han_comm_create_new(struct ompi_communicator_t *comm,
183184
HAN_SUBCOM_LOAD_COLLECTIVE(fallbacks, comm, han_module, gather);
184185
HAN_SUBCOM_LOAD_COLLECTIVE(fallbacks, comm, han_module, scatter);
185186

187+
if (mca_smsc) {
188+
han_module->local_smsc_eps = malloc( sizeof(*han_module->local_smsc_eps) * low_size);
189+
for (int jlow=0; jlow<low_size; jlow++) {
190+
struct ompi_proc_t* ompi_proc = ompi_comm_peer_lookup(*low_comm, jlow);
191+
han_module->local_smsc_eps[jlow] = mca_smsc->get_endpoint(&ompi_proc->super);
192+
}
193+
OPAL_OUTPUT_VERBOSE((30, mca_coll_han_component.han_output,
194+
"Han created SMSC endpoints for low_comm\n"));
195+
} else {
196+
han_module->local_smsc_eps = NULL;
197+
OPAL_OUTPUT_VERBOSE((30, mca_coll_han_component.han_output,
198+
"Han did not find any SMSC components\n"));
199+
}
200+
186201
OBJ_DESTRUCT(&comm_info);
187202
return OMPI_SUCCESS;
188203

@@ -350,6 +365,20 @@ int mca_coll_han_comm_create(struct ompi_communicator_t *comm,
350365
HAN_SUBCOM_LOAD_COLLECTIVE(fallbacks, comm, han_module, gather);
351366
HAN_SUBCOM_LOAD_COLLECTIVE(fallbacks, comm, han_module, scatter);
352367

368+
if (mca_smsc) {
369+
han_module->local_smsc_eps = malloc( sizeof(*han_module->local_smsc_eps) * low_size);
370+
for (int jlow=0; jlow<low_size; jlow++) {
371+
struct ompi_proc_t* ompi_proc = ompi_comm_peer_lookup(low_comms[1], jlow);
372+
han_module->local_smsc_eps[jlow] = mca_smsc->get_endpoint(&ompi_proc->super);
373+
}
374+
OPAL_OUTPUT_VERBOSE((30, mca_coll_han_component.han_output,
375+
"Han created SMSC endpoints for low_comm\n"));
376+
} else {
377+
han_module->local_smsc_eps = NULL;
378+
OPAL_OUTPUT_VERBOSE((30, mca_coll_han_component.han_output,
379+
"Han did not find any SMSC components\n"));
380+
}
381+
353382
OBJ_DESTRUCT(&comm_info);
354383
return OMPI_SUCCESS;
355384
}

0 commit comments

Comments
 (0)