Skip to content

Commit

Permalink
Merge latest of local ompiv5
Browse files Browse the repository at this point in the history
Changes wrt module to load the acoll component properly are added
  • Loading branch information
amd-nithyavs committed May 10, 2024
1 parent 4c198e7 commit 2f7c5e2
Showing 1 changed file with 49 additions and 21 deletions.
70 changes: 49 additions & 21 deletions ompi/mca/coll/acoll/coll_acoll_module.c
Expand Up @@ -16,6 +16,10 @@
#include "ompi/mca/coll/coll.h"
#include "coll_acoll.h"


static int acoll_module_enable(mca_coll_base_module_t *module, struct ompi_communicator_t *comm);
static int acoll_module_disable(mca_coll_base_module_t *module, struct ompi_communicator_t *comm);

/*
* Initial query function that is invoked during MPI_INIT, allowing
* this component to disqualify itself if it doesn't support the
Expand All @@ -27,6 +31,26 @@ int mca_coll_acoll_init_query(bool enable_progress_threads, bool enable_mpi_thre
return OMPI_SUCCESS;
}



#define ACOLL_INSTALL_COLL_API(__comm, __module, __api) \
do \
{ \
if (__module->super.coll_##__api) \
{ \
MCA_COLL_INSTALL_API(__comm, __api, __module->super.coll_##__api, &__module->super, "acoll"); \
} \
} while (0)

#define ACOLL_UNINSTALL_COLL_API(__comm, __module, __api) \
do \
{ \
if (__comm->c_coll->coll_##__api##_module == &__module->super) \
{ \
MCA_COLL_INSTALL_API(__comm, __api, NULL, NULL, "acoll"); \
} \
} while (0)

/*
* Invoked when there's a new communicator that has been created.
* Look at the communicator and decide which set of functions and
Expand Down Expand Up @@ -124,49 +148,53 @@ mca_coll_base_module_t *mca_coll_acoll_comm_query(struct ompi_communicator_t *co

/* Choose whether to use [intra|inter], and [subgroup|normal]-based
* algorithms. */
acoll_module->super.coll_module_enable = mca_coll_acoll_module_enable;
acoll_module->super.coll_module_enable = acoll_module_enable;
acoll_module->super.coll_module_disable = acoll_module_disable;

acoll_module->super.coll_allgather = mca_coll_acoll_allgather;
acoll_module->super.coll_allgatherv = NULL;
acoll_module->super.coll_allreduce = mca_coll_acoll_allreduce_intra;
acoll_module->super.coll_alltoall = NULL;
acoll_module->super.coll_alltoallv = NULL;
acoll_module->super.coll_alltoallw = NULL;
acoll_module->super.coll_barrier = mca_coll_acoll_barrier_intra;
acoll_module->super.coll_bcast = mca_coll_acoll_bcast;
acoll_module->super.coll_exscan = NULL;
acoll_module->super.coll_gather = mca_coll_acoll_gather_intra;
acoll_module->super.coll_gatherv = NULL;
acoll_module->super.coll_reduce = mca_coll_acoll_reduce_intra;
acoll_module->super.coll_reduce_scatter_block = NULL;
acoll_module->super.coll_reduce_scatter = NULL;
acoll_module->super.coll_scan = NULL;
acoll_module->super.coll_scatter = NULL;
acoll_module->super.coll_scatterv = NULL;

acoll_module->super.coll_neighbor_allgather = NULL;
acoll_module->super.coll_neighbor_allgatherv = NULL;
acoll_module->super.coll_neighbor_alltoall = NULL;
acoll_module->super.coll_neighbor_alltoallv = NULL;
acoll_module->super.coll_neighbor_alltoallw = NULL;

acoll_module->super.coll_reduce_local = NULL;

return &(acoll_module->super);
}

/*
* Init module on the communicator
*/
int mca_coll_acoll_module_enable(mca_coll_base_module_t *module, struct ompi_communicator_t *comm)
static int acoll_module_enable(mca_coll_base_module_t *module, struct ompi_communicator_t *comm)
{
mca_coll_acoll_module_t *acoll_module = (mca_coll_acoll_module_t *) module;

/* prepare the placeholder for the array of request* */
module->base_data = OBJ_NEW(mca_coll_base_comm_t);
if (NULL == module->base_data) {
return OMPI_ERROR;
}

ACOLL_INSTALL_COLL_API(comm, acoll_module, allgather);
ACOLL_INSTALL_COLL_API(comm, acoll_module, allreduce);
ACOLL_INSTALL_COLL_API(comm, acoll_module, barrier);
ACOLL_INSTALL_COLL_API(comm, acoll_module, bcast);
ACOLL_INSTALL_COLL_API(comm, acoll_module, gather);
ACOLL_INSTALL_COLL_API(comm, acoll_module, reduce);

/* All done */
return OMPI_SUCCESS;
}

static int acoll_module_disable(mca_coll_base_module_t *module, struct ompi_communicator_t *comm)
{
mca_coll_acoll_module_t *acoll_module = (mca_coll_acoll_module_t *) module;

ACOLL_UNINSTALL_COLL_API(comm, acoll_module, allgather);
ACOLL_UNINSTALL_COLL_API(comm, acoll_module, allreduce);
ACOLL_UNINSTALL_COLL_API(comm, acoll_module, barrier);
ACOLL_UNINSTALL_COLL_API(comm, acoll_module, bcast);
ACOLL_UNINSTALL_COLL_API(comm, acoll_module, gather);
ACOLL_UNINSTALL_COLL_API(comm, acoll_module, reduce);

return OMPI_SUCCESS;
}

0 comments on commit 2f7c5e2

Please sign in to comment.