Skip to content

Commit

Permalink
!5 HMPI: Fix some bugs and synchronize format
Browse files Browse the repository at this point in the history
* fix some bugs and synchronize format
  • Loading branch information
zsppp1 authored and razor1991 committed Aug 8, 2023
1 parent 389ba65 commit 84d4955
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion ompi/mca/coll/ucg/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ mca_coll_ucg_la_LIBADD = $(coll_ucg_LIBS)
mca_coll_ucg_la_LDFLAGS = -module -avoid-version $(coll_ucg_LDFLAGS)

noinst_LTLIBRARIES = $(component_noinst)
libmca_coll_ucg_la_SOURCES = $(coll_ucg_sources)
libmca_coll_ucg_la_SOURCES =$(coll_ucg_sources)
libmca_coll_ucg_la_LIBADD = $(coll_ucg_LIBS)
libmca_coll_ucg_la_LDFLAGS = -module -avoid-version $(coll_ucg_LDFLAGS)
26 changes: 13 additions & 13 deletions ompi/mca/coll/ucg/coll_ucg.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ typedef struct {
bool initialized;

/** MCA parameter */
int priority; /* Priority of this component */
int verbose; /* Verbose level of this component */
int max_rcache_size; /* Max size of request cache */
char *disable_coll; /* JUST FOR TEST, may remove later */
char *topology; /* Topology file path */
int priority; /* Priority of this component */
int verbose; /* Verbose level of this component */
int max_rcache_size; /* Max size of request cache */
char *disable_coll; /* JUST FOR TEST, may remove later */
char *topology; /* Topology file path */

ucg_context_h ucg_context;

char **blacklist; /** disabled collective operations */
char **blacklist; /** disabled collective operations */
} mca_coll_ucg_component_t;
OMPI_MODULE_DECLSPEC extern mca_coll_ucg_component_t mca_coll_ucg_component;

Expand Down Expand Up @@ -167,7 +167,7 @@ int mca_coll_ucg_ibcast(void *buffer, int count, MPI_Datatype datatype, int root
mca_coll_base_module_t *module);

int mca_coll_ucg_ibcast_cache(void *buffer, int count, MPI_Datatype datatype, int root,
ompi_communicator_t *comm, ompi_request_t **request,
ompi_communicator_t *comm, ompi_request_t **request,
mca_coll_base_module_t *module);

int mca_coll_ucg_bcast_init(void *buffer, int count, MPI_Datatype datatype, int root,
Expand All @@ -186,10 +186,10 @@ int mca_coll_ucg_alltoallv_cache(const void *sbuf, const int *scounts, const int
ompi_communicator_t *comm, mca_coll_base_module_t *module);

int mca_coll_ucg_ialltoallv(const void *sbuf, const int *scounts, const int *sdispls,
ompi_datatype_t *sdtype, void *rbuf, const int *rcounts,
const int *rdispls, ompi_datatype_t *rdtype,
ompi_communicator_t *comm, ompi_request_t **request,
mca_coll_base_module_t *module);
ompi_datatype_t *sdtype, void *rbuf, const int *rcounts,
const int *rdispls, ompi_datatype_t *rdtype,
ompi_communicator_t *comm, ompi_request_t **request,
mca_coll_base_module_t *module);

int mca_coll_ucg_ialltoallv_cache(const void *sbuf, const int *scounts, const int *sdispls,
ompi_datatype_t *sdtype, void *rbuf, const int *rcounts,
Expand All @@ -203,7 +203,7 @@ int mca_coll_ucg_alltoallv_init(const void *sbuf, const int *scounts, const int
ompi_communicator_t *comm, ompi_info_t *info,
ompi_request_t **request, mca_coll_base_module_t *module);

/*barrier */
/* barrier */
int mca_coll_ucg_barrier(ompi_communicator_t *comm, mca_coll_base_module_t *module);

int mca_coll_ucg_barrier_cache(ompi_communicator_t *comm, mca_coll_base_module_t *module);
Expand All @@ -217,7 +217,7 @@ int mca_coll_ucg_ibarrier_cache(ompi_communicator_t *comm, ompi_request_t **requ
int mca_coll_ucg_barrier_init(ompi_communicator_t *comm, ompi_info_t *info,
ompi_request_t **request, mca_coll_base_module_t *module);

/*scatterv */
/* scatterv */
int mca_coll_ucg_scatterv(const void *sbuf, const int *scounts, const int *disps,
ompi_datatype_t *sdtype, void *rbuf, int rcount,
ompi_datatype_t *rdtype, int root,
Expand Down
2 changes: 1 addition & 1 deletion ompi/mca/coll/ucg/coll_ucg_allgatherv.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2022-2022 Huawei Technologies Co., Ltd.
* All rights reserved.
* All rights reserved.
* COPYRIGHT$
*
* Additional copyrights may follow
Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/coll/ucg/coll_ucg_gatherv.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ int mca_coll_ucg_igatherv_cache(const void *sbuf, int sendcount,
fallback:
UCG_DEBUG("fallback igatherv");
return ucg_module->previous_igatherv(sbuf, sendcount, sdtype, rbuf,
recvcounts, disps, rdtype, root, comm, request,
ucg_module->previous_gatherv_module);
recvcounts, disps, rdtype, root, comm, request,
ucg_module->previous_gatherv_module);
}

int mca_coll_ucg_gatherv_init(const void *sbuf, int sendcount,
Expand Down
26 changes: 13 additions & 13 deletions ompi/mca/coll/ucg/coll_ucg_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/pml/ucx/pml_ucx.h"

/* Ensure coll ucg can be dlopened if global var "ompi_pml_ucx" is not existed */
/* Ensure coll ucg can be dlopened if global var "ompi_pml_ucx" is not existed*/
mca_pml_ucx_module_t ompi_pml_ucx __attribute__((weak));

#define MCA_COLL_UCG_SET_HANDLER(_api) \
if (mca_coll_ucg_is_api_enable(#_api)) { \
module->super.coll_ ## _api = mca_coll_ucg_ ## _api; \
module->super.coll_ ## _api = mca_coll_ucg_ ## _api;\
}

#define MCA_COLL_UCG_SET_CACHE_HANDLER(_api) \
if (mca_coll_ucg_is_api_enable(#_api)) { \
module->super.coll_ ## _api = mca_coll_ucg_ ## _api ## _cache; \
module->super.coll_ ## _api = mca_coll_ucg_ ## _api ## _cache; \
}

#define MCA_COLL_UCG_SAVE_FALLBACK(_api) \
Expand Down Expand Up @@ -90,24 +90,24 @@ static ucg_status_t mca_coll_ucg_oob_blocking_allgather(const void *sendbuf,
//bcast recvbuf to all rank
for (i = 1; i < size; i++) {
rc = MCA_PML_CALL(send((char *)recvbuf, size * count, MPI_CHAR, i,
MCA_COLL_BASE_TAG_ALLGATHER,
MCA_PML_BASE_SEND_STANDARD, comm));
MCA_COLL_BASE_TAG_ALLGATHER,
MCA_PML_BASE_SEND_STANDARD, comm));
if (rc != OMPI_SUCCESS) {
goto out;
}
}
} else {
//send data to rank 0
rc = MCA_PML_CALL(send((char *)sendbuf, count, MPI_CHAR, 0, MCA_COLL_BASE_TAG_ALLGATHER,
MCA_PML_BASE_SEND_STANDARD, comm));
MCA_PML_BASE_SEND_STANDARD, comm));
if (rc != OMPI_SUCCESS) {
goto out;
}

//recv gather data from rank 0
rc = MCA_PML_CALL(recv((char *)recvbuf, size * count, MPI_CHAR, 0,
MCA_COLL_BASE_TAG_ALLGATHER, comm,
MPI_STATUS_IGNORE));
MCA_COLL_BASE_TAG_ALLGATHER, comm,
MPI_STATUS_IGNORE));
if (rc != OMPI_SUCCESS) {
goto out;
}
Expand Down Expand Up @@ -575,31 +575,31 @@ static void mca_coll_ucg_module_construct(mca_coll_ucg_module_t *module)
MCA_COLL_UCG_SET_CACHE_HANDLER(allreduce);
MCA_COLL_UCG_SET_CACHE_HANDLER(barrier);
MCA_COLL_UCG_SET_CACHE_HANDLER(bcast);
// MCA_COLL_UCG_SET_CACHE_HANDLER(alltoallv);
MCA_COLL_UCG_SET_CACHE_HANDLER(alltoallv);
// MCA_COLL_UCG_SET_CACHE_HANDLER(scatterv);
MCA_COLL_UCG_SET_CACHE_HANDLER(gatherv);
MCA_COLL_UCG_SET_CACHE_HANDLER(allgatherv);

MCA_COLL_UCG_SET_CACHE_HANDLER(iallreduce);
MCA_COLL_UCG_SET_CACHE_HANDLER(ibarrier);
MCA_COLL_UCG_SET_CACHE_HANDLER(ibcast);
// MCA_COLL_UCG_SET_CACHE_HANDLER(ialltoallv);
MCA_COLL_UCG_SET_CACHE_HANDLER(ialltoallv);
MCA_COLL_UCG_SET_CACHE_HANDLER(iscatterv);
MCA_COLL_UCG_SET_CACHE_HANDLER(igatherv);
MCA_COLL_UCG_SET_CACHE_HANDLER(iallgatherv);
} else {
MCA_COLL_UCG_SET_HANDLER(allreduce);
MCA_COLL_UCG_SET_HANDLER(barrier);
MCA_COLL_UCG_SET_HANDLER(bcast);
// MCA_COLL_UCG_SET_HANDLER(alltoallv);
MCA_COLL_UCG_SET_HANDLER(alltoallv);
// MCA_COLL_UCG_SET_HANDLER(scatterv);
MCA_COLL_UCG_SET_HANDLER(gatherv);
MCA_COLL_UCG_SET_HANDLER(allgatherv);

MCA_COLL_UCG_SET_HANDLER(iallreduce);
MCA_COLL_UCG_SET_HANDLER(ibarrier);
MCA_COLL_UCG_SET_HANDLER(ibcast);
// MCA_COLL_UCG_SET_HANDLER(ialltoallv);
MCA_COLL_UCG_SET_HANDLER(ialltoallv);
MCA_COLL_UCG_SET_HANDLER(iscatterv);
MCA_COLL_UCG_SET_HANDLER(igatherv);
MCA_COLL_UCG_SET_HANDLER(iallgatherv);
Expand All @@ -608,7 +608,7 @@ static void mca_coll_ucg_module_construct(mca_coll_ucg_module_t *module)
MCA_COLL_UCG_SET_HANDLER(allreduce_init);
MCA_COLL_UCG_SET_HANDLER(barrier_init);
MCA_COLL_UCG_SET_HANDLER(bcast_init);
// MCA_COLL_UCG_SET_HANDLER(alltoallv_init);
MCA_COLL_UCG_SET_HANDLER(alltoallv_init);
MCA_COLL_UCG_SET_HANDLER(scatterv_init);
MCA_COLL_UCG_SET_HANDLER(gatherv_init);
MCA_COLL_UCG_SET_HANDLER(allgatherv_init);
Expand Down
8 changes: 4 additions & 4 deletions ompi/mca/coll/ucg/coll_ucg_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void mca_coll_ucg_rpool_cleanup(void)
int mca_coll_ucg_subargs_pool_init(uint32_t size)
{
OBJ_CONSTRUCT(&mca_coll_ucg_subargs_pool.flist, opal_free_list_t);
int rc = opal_free_list_init(&mca_coll_ucg_subargs_pool.flist,
int rc = opal_free_list_init(&mca_coll_ucg_subargs_pool.flist,
sizeof(mca_coll_ucg_subargs_t) + 4 * size * sizeof(int),
opal_cache_line_size, OBJ_CLASS(mca_coll_ucg_subargs_t),
0, 0,
Expand Down Expand Up @@ -367,7 +367,7 @@ void mca_coll_ucg_rcache_mark_cacheable(mca_coll_ucg_req_t *coll_req,
mca_coll_ucg_args_t *key)
{
OBJ_CONSTRUCT(&coll_req->list, opal_list_item_t);
mca_coll_ucg_rcache_coll_req_args_init(&coll_req->args, key); // deep copy
mca_coll_ucg_rcache_coll_req_args_init(&coll_req->args, key); // deep copy
ucg_coll_ucg_rcache_ref(coll_req);
coll_req->cacheable = true;
return;
Expand Down Expand Up @@ -577,7 +577,7 @@ int mca_coll_ucg_request_common_init(mca_coll_ucg_req_t *coll_req,
ucg_request_info_t *info = &coll_req->info;
info->field_mask = 0;
if (nb || persistent) {
//For those case, the request is not done in the current call stack.
// For those case, the request is not done in the current call stack.
info->field_mask |= UCG_REQUEST_INFO_FIELD_CB;
info->complete_cb.cb = mca_coll_ucg_request_complete;
info->complete_cb.arg = coll_req;
Expand Down Expand Up @@ -622,7 +622,7 @@ int mca_coll_ucg_request_execute(mca_coll_ucg_req_t *coll_req)

int count = 0;
while (UCG_INPROGRESS == (status = ucg_request_test(ucg_req))) {
//TODO: test wether opal_progress() can be removed
// TODO: test wether opal_progress() can be removed
if (++count % 1000 == 0) {
opal_progress();
}
Expand Down
8 changes: 4 additions & 4 deletions ompi/mca/coll/ucg/coll_ucg_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
} while(0)

/*
* Non-blocking execution pattern:
* Non-blockingexecution pattern:
* 1. Initialize coll request
* 2. Non-blocking execute
* 3. Mark coll request cacheable
* 4. Assign ompi request
* If any failure, go to fallback.
* If any failure, goto fallback.
*/
#define MCA_COLL_UCG_REQUEST_PATTERN_NB(_ompi_req, _cache_key, _coll_request_init, ...) \
do {\
Expand Down Expand Up @@ -126,12 +126,12 @@ typedef struct {
typedef struct {
opal_free_list_item_t super;
int buf[];
}mca_coll_ucg_subargs_t;
} mca_coll_ucg_subargs_t;
OBJ_CLASS_DECLARATION(mca_coll_ucg_subargs_t);

typedef struct {
opal_free_list_t flist;
}mca_coll_ucg_subargs_pool_t;
} mca_coll_ucg_subargs_pool_t;

typedef struct mca_coll_bcast_args {
void *buffer;
Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/coll/ucg/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Copyright (c) 2022-2022 Huawei Technologies Co., Ltd.
# All rights reserved.
# $COPYRIGHT$
#
#
# Additional copyrights may follow
#
#
# $HEADER$
#

Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/coll/ucg/owner.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# owner/status file
#
# owner/status file
# owner: institution that is responsible for this package
# status: e.g. active, maintenance, unmaintained
#
Expand Down

0 comments on commit 84d4955

Please sign in to comment.