Skip to content

Commit 1b4bf91

Browse files
author
hasegawa.kento
committed
COLL/UCC: fix coding style and error handling
Signed-off-by: hasegawa.kento <hasegawa.kento@fujitsu.com>
1 parent 4171fdb commit 1b4bf91

18 files changed

+297
-274
lines changed

ompi/mca/coll/ucc/coll_ucc.h

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct mca_coll_ucc_component_t {
6262
ucc_lib_attr_t ucc_lib_attr;
6363
ucc_coll_type_t cts_requested;
6464
ucc_coll_type_t nb_cts_requested;
65-
ucc_coll_type_t pc_cts_requested;
65+
ucc_coll_type_t ps_cts_requested;
6666
ucc_context_h ucc_context;
6767
opal_free_list_t requests;
6868
};
@@ -134,34 +134,34 @@ struct mca_coll_ucc_module_t {
134134
mca_coll_base_module_t* previous_scatter_module;
135135
mca_coll_base_module_iscatter_fn_t previous_iscatter;
136136
mca_coll_base_module_t* previous_iscatter_module;
137-
mca_coll_base_module_allreduce_init_fn_t previous_allreduce_init;
138-
mca_coll_base_module_t *previous_allreduce_init_module;
139-
mca_coll_base_module_reduce_init_fn_t previous_reduce_init;
140-
mca_coll_base_module_t *previous_reduce_init_module;
141-
mca_coll_base_module_barrier_init_fn_t previous_barrier_init;
142-
mca_coll_base_module_t *previous_barrier_init_module;
143-
mca_coll_base_module_bcast_init_fn_t previous_bcast_init;
144-
mca_coll_base_module_t *previous_bcast_init_module;
145-
mca_coll_base_module_alltoall_init_fn_t previous_alltoall_init;
146-
mca_coll_base_module_t *previous_alltoall_init_module;
147-
mca_coll_base_module_alltoallv_init_fn_t previous_alltoallv_init;
148-
mca_coll_base_module_t *previous_alltoallv_init_module;
149-
mca_coll_base_module_allgather_init_fn_t previous_allgather_init;
150-
mca_coll_base_module_t *previous_allgather_init_module;
151-
mca_coll_base_module_allgatherv_init_fn_t previous_allgatherv_init;
152-
mca_coll_base_module_t *previous_allgatherv_init_module;
153-
mca_coll_base_module_gather_init_fn_t previous_gather_init;
154-
mca_coll_base_module_t *previous_gather_init_module;
155-
mca_coll_base_module_gatherv_init_fn_t previous_gatherv_init;
156-
mca_coll_base_module_t *previous_gatherv_init_module;
137+
mca_coll_base_module_allreduce_init_fn_t previous_allreduce_init;
138+
mca_coll_base_module_t* previous_allreduce_init_module;
139+
mca_coll_base_module_reduce_init_fn_t previous_reduce_init;
140+
mca_coll_base_module_t* previous_reduce_init_module;
141+
mca_coll_base_module_barrier_init_fn_t previous_barrier_init;
142+
mca_coll_base_module_t* previous_barrier_init_module;
143+
mca_coll_base_module_bcast_init_fn_t previous_bcast_init;
144+
mca_coll_base_module_t* previous_bcast_init_module;
145+
mca_coll_base_module_alltoall_init_fn_t previous_alltoall_init;
146+
mca_coll_base_module_t* previous_alltoall_init_module;
147+
mca_coll_base_module_alltoallv_init_fn_t previous_alltoallv_init;
148+
mca_coll_base_module_t* previous_alltoallv_init_module;
149+
mca_coll_base_module_allgather_init_fn_t previous_allgather_init;
150+
mca_coll_base_module_t* previous_allgather_init_module;
151+
mca_coll_base_module_allgatherv_init_fn_t previous_allgatherv_init;
152+
mca_coll_base_module_t* previous_allgatherv_init_module;
153+
mca_coll_base_module_gather_init_fn_t previous_gather_init;
154+
mca_coll_base_module_t* previous_gather_init_module;
155+
mca_coll_base_module_gatherv_init_fn_t previous_gatherv_init;
156+
mca_coll_base_module_t* previous_gatherv_init_module;
157157
mca_coll_base_module_reduce_scatter_block_init_fn_t previous_reduce_scatter_block_init;
158-
mca_coll_base_module_t *previous_reduce_scatter_block_init_module;
159-
mca_coll_base_module_reduce_scatter_init_fn_t previous_reduce_scatter_init;
160-
mca_coll_base_module_t *previous_reduce_scatter_init_module;
161-
mca_coll_base_module_scatterv_init_fn_t previous_scatterv_init;
162-
mca_coll_base_module_t *previous_scatterv_init_module;
163-
mca_coll_base_module_scatter_init_fn_t previous_scatter_init;
164-
mca_coll_base_module_t *previous_scatter_init_module;
158+
mca_coll_base_module_t* previous_reduce_scatter_block_init_module;
159+
mca_coll_base_module_reduce_scatter_init_fn_t previous_reduce_scatter_init;
160+
mca_coll_base_module_t* previous_reduce_scatter_init_module;
161+
mca_coll_base_module_scatterv_init_fn_t previous_scatterv_init;
162+
mca_coll_base_module_t* previous_scatterv_init_module;
163+
mca_coll_base_module_scatter_init_fn_t previous_scatter_init;
164+
mca_coll_base_module_t* previous_scatter_init_module;
165165
};
166166
typedef struct mca_coll_ucc_module_t mca_coll_ucc_module_t;
167167
OBJ_CLASS_DECLARATION(mca_coll_ucc_module_t);

ompi/mca/coll/ucc/coll_ucc_allgather.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
#include "coll_ucc_common.h"
1212

1313
static inline ucc_status_t
14-
mca_coll_ucc_allgather_iniz(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype,
15-
void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype,
16-
bool persistent, mca_coll_ucc_module_t *ucc_module, ucc_coll_req_h *req,
17-
mca_coll_ucc_req_t *coll_req)
14+
mca_coll_ucc_allgather_init_common(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype,
15+
void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype,
16+
bool persistent, mca_coll_ucc_module_t *ucc_module,
17+
ucc_coll_req_h *req,
18+
mca_coll_ucc_req_t *coll_req)
1819
{
1920
ucc_datatype_t ucc_sdt = UCC_DT_INT8, ucc_rdt = UCC_DT_INT8;
2021
bool is_inplace = (MPI_IN_PLACE == sbuf);
@@ -79,8 +80,9 @@ int mca_coll_ucc_allgather(const void *sbuf, size_t scount, struct ompi_datatype
7980
ucc_coll_req_h req;
8081

8182
UCC_VERBOSE(3, "running ucc allgather");
82-
COLL_UCC_CHECK(mca_coll_ucc_allgather_iniz(sbuf, scount, sdtype, rbuf, rcount, rdtype, false,
83-
ucc_module, &req, NULL));
83+
COLL_UCC_CHECK(mca_coll_ucc_allgather_init_common(sbuf, scount, sdtype,
84+
rbuf, rcount, rdtype,
85+
false, ucc_module, &req, NULL));
8486
COLL_UCC_POST_AND_CHECK(req);
8587
COLL_UCC_CHECK(coll_ucc_req_wait(req));
8688
return OMPI_SUCCESS;
@@ -102,8 +104,9 @@ int mca_coll_ucc_iallgather(const void *sbuf, size_t scount, struct ompi_datatyp
102104

103105
UCC_VERBOSE(3, "running ucc iallgather");
104106
COLL_UCC_GET_REQ(coll_req);
105-
COLL_UCC_CHECK(mca_coll_ucc_allgather_iniz(sbuf, scount, sdtype, rbuf, rcount, rdtype, false,
106-
ucc_module, &req, coll_req));
107+
COLL_UCC_CHECK(mca_coll_ucc_allgather_init_common(sbuf, scount, sdtype,
108+
rbuf, rcount, rdtype,
109+
false, ucc_module, &req, coll_req));
107110
COLL_UCC_POST_AND_CHECK(req);
108111
*request = &coll_req->super;
109112
return OMPI_SUCCESS;
@@ -125,10 +128,11 @@ int mca_coll_ucc_allgather_init(const void *sbuf, size_t scount, struct ompi_dat
125128
ucc_coll_req_h req;
126129
mca_coll_ucc_req_t *coll_req = NULL;
127130

128-
COLL_UCC_GET_REQ_PC(coll_req);
131+
COLL_UCC_GET_REQ_PERSISTENT(coll_req);
129132
UCC_VERBOSE(3, "allgather_init init %p", coll_req);
130-
COLL_UCC_CHECK(mca_coll_ucc_allgather_iniz(sbuf, scount, sdtype, rbuf, rcount, rdtype, true,
131-
ucc_module, &req, coll_req));
133+
COLL_UCC_CHECK(mca_coll_ucc_allgather_init_common(sbuf, scount, sdtype,
134+
rbuf, rcount, rdtype,
135+
true, ucc_module, &req, coll_req));
132136
*request = &coll_req->super;
133137
return OMPI_SUCCESS;
134138
fallback:

ompi/mca/coll/ucc/coll_ucc_allgatherv.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
#include "coll_ucc_common.h"
1212

1313
static inline ucc_status_t
14-
mca_coll_ucc_allgatherv_iniz(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype,
15-
void *rbuf, ompi_count_array_t rcounts, ompi_disp_array_t rdisps,
16-
struct ompi_datatype_t *rdtype, bool persistent,
17-
mca_coll_ucc_module_t *ucc_module, ucc_coll_req_h *req,
18-
mca_coll_ucc_req_t *coll_req)
14+
mca_coll_ucc_allgatherv_init_common(const void *sbuf, size_t scount,
15+
struct ompi_datatype_t *sdtype,
16+
void* rbuf, ompi_count_array_t rcounts, ompi_disp_array_t rdisps,
17+
struct ompi_datatype_t *rdtype,
18+
bool persistent, mca_coll_ucc_module_t *ucc_module,
19+
ucc_coll_req_h *req,
20+
mca_coll_ucc_req_t *coll_req)
1921
{
2022
ucc_datatype_t ucc_sdt = UCC_DT_INT8, ucc_rdt = UCC_DT_INT8;
2123
bool is_inplace = (MPI_IN_PLACE == sbuf);
@@ -36,7 +38,8 @@ mca_coll_ucc_allgatherv_iniz(const void *sbuf, size_t scount, struct ompi_dataty
3638

3739
flags = (ompi_count_array_is_64bit(rcounts) ? UCC_COLL_ARGS_FLAG_COUNT_64BIT : 0) |
3840
(ompi_disp_array_is_64bit(rdisps) ? UCC_COLL_ARGS_FLAG_DISPLACEMENTS_64BIT : 0) |
39-
(is_inplace ? UCC_COLL_ARGS_FLAG_IN_PLACE : 0);
41+
(is_inplace ? UCC_COLL_ARGS_FLAG_IN_PLACE : 0) |
42+
(persistent ? UCC_COLL_ARGS_FLAG_PERSISTENT : 0);
4043

4144
ucc_coll_args_t coll = {
4245
.mask = flags ? UCC_COLL_ARGS_FIELD_FLAGS : 0,
@@ -57,10 +60,6 @@ mca_coll_ucc_allgatherv_iniz(const void *sbuf, size_t scount, struct ompi_dataty
5760
}
5861
};
5962

60-
if (true == persistent) {
61-
coll.mask |= UCC_COLL_ARGS_FIELD_FLAGS;
62-
coll.flags |= UCC_COLL_ARGS_FLAG_PERSISTENT;
63-
}
6463
COLL_UCC_REQ_INIT(coll_req, req, coll, ucc_module);
6564
return UCC_OK;
6665
fallback:
@@ -79,8 +78,9 @@ int mca_coll_ucc_allgatherv(const void *sbuf, size_t scount,
7978

8079
UCC_VERBOSE(3, "running ucc allgatherv");
8180

82-
COLL_UCC_CHECK(mca_coll_ucc_allgatherv_iniz(sbuf, scount, sdtype, rbuf, rcounts, rdisps, rdtype,
83-
false, ucc_module, &req, NULL));
81+
COLL_UCC_CHECK(mca_coll_ucc_allgatherv_init_common(sbuf, scount, sdtype,
82+
rbuf, rcounts, rdisps, rdtype,
83+
false, ucc_module, &req, NULL));
8484
COLL_UCC_POST_AND_CHECK(req);
8585
COLL_UCC_CHECK(coll_ucc_req_wait(req));
8686
return OMPI_SUCCESS;
@@ -105,8 +105,9 @@ int mca_coll_ucc_iallgatherv(const void *sbuf, size_t scount,
105105

106106
UCC_VERBOSE(3, "running ucc iallgatherv");
107107
COLL_UCC_GET_REQ(coll_req);
108-
COLL_UCC_CHECK(mca_coll_ucc_allgatherv_iniz(sbuf, scount, sdtype, rbuf, rcounts, rdisps, rdtype,
109-
false, ucc_module, &req, coll_req));
108+
COLL_UCC_CHECK(mca_coll_ucc_allgatherv_init_common(sbuf, scount, sdtype,
109+
rbuf, rcounts, rdisps, rdtype,
110+
false, ucc_module, &req, coll_req));
110111
COLL_UCC_POST_AND_CHECK(req);
111112
*request = &coll_req->super;
112113
return OMPI_SUCCESS;
@@ -130,10 +131,11 @@ int mca_coll_ucc_allgatherv_init(const void *sbuf, size_t scount, struct ompi_da
130131
ucc_coll_req_h req;
131132
mca_coll_ucc_req_t *coll_req = NULL;
132133

133-
COLL_UCC_GET_REQ_PC(coll_req);
134+
COLL_UCC_GET_REQ_PERSISTENT(coll_req);
134135
UCC_VERBOSE(3, "allgatherv_init init %p", coll_req);
135-
COLL_UCC_CHECK(mca_coll_ucc_allgatherv_iniz(sbuf, scount, sdtype, rbuf, rcounts, rdisps, rdtype,
136-
true, ucc_module, &req, coll_req));
136+
COLL_UCC_CHECK(mca_coll_ucc_allgatherv_init_common(sbuf, scount, sdtype,
137+
rbuf, rcounts, rdisps, rdtype,
138+
true, ucc_module, &req, coll_req));
137139
*request = &coll_req->super;
138140
return OMPI_SUCCESS;
139141
fallback:

ompi/mca/coll/ucc/coll_ucc_allreduce.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010

1111
#include "coll_ucc_common.h"
1212

13-
static inline ucc_status_t mca_coll_ucc_allreduce_iniz(const void *sbuf, void *rbuf, size_t count,
14-
struct ompi_datatype_t *dtype,
15-
struct ompi_op_t *op, bool persistent,
16-
mca_coll_ucc_module_t *ucc_module,
17-
ucc_coll_req_h *req,
18-
mca_coll_ucc_req_t *coll_req)
13+
static inline ucc_status_t mca_coll_ucc_allreduce_init_common(const void *sbuf, void *rbuf, size_t count,
14+
struct ompi_datatype_t *dtype,
15+
struct ompi_op_t *op, bool persistent, mca_coll_ucc_module_t *ucc_module,
16+
ucc_coll_req_h *req,
17+
mca_coll_ucc_req_t *coll_req)
1918
{
2019
ucc_datatype_t ucc_dt;
2120
ucc_reduction_op_t ucc_op;
@@ -73,8 +72,8 @@ int mca_coll_ucc_allreduce(const void *sbuf, void *rbuf, size_t count,
7372
ucc_coll_req_h req;
7473

7574
UCC_VERBOSE(3, "running ucc allreduce");
76-
COLL_UCC_CHECK(
77-
mca_coll_ucc_allreduce_iniz(sbuf, rbuf, count, dtype, op, false, ucc_module, &req, NULL));
75+
COLL_UCC_CHECK(mca_coll_ucc_allreduce_init_common(sbuf, rbuf, count, dtype, op,
76+
false, ucc_module, &req, NULL));
7877
COLL_UCC_POST_AND_CHECK(req);
7978
COLL_UCC_CHECK(coll_ucc_req_wait(req));
8079
return OMPI_SUCCESS;
@@ -96,8 +95,8 @@ int mca_coll_ucc_iallreduce(const void *sbuf, void *rbuf, size_t count,
9695

9796
UCC_VERBOSE(3, "running ucc iallreduce");
9897
COLL_UCC_GET_REQ(coll_req);
99-
COLL_UCC_CHECK(mca_coll_ucc_allreduce_iniz(sbuf, rbuf, count, dtype, op, false, ucc_module,
100-
&req, coll_req));
98+
COLL_UCC_CHECK(mca_coll_ucc_allreduce_init_common(sbuf, rbuf, count, dtype, op,
99+
false, ucc_module, &req, coll_req));
101100
COLL_UCC_POST_AND_CHECK(req);
102101
*request = &coll_req->super;
103102
return OMPI_SUCCESS;
@@ -119,10 +118,10 @@ int mca_coll_ucc_allreduce_init(const void *sbuf, void *rbuf, size_t count,
119118
ucc_coll_req_h req;
120119
mca_coll_ucc_req_t *coll_req = NULL;
121120

122-
COLL_UCC_GET_REQ_PC(coll_req);
121+
COLL_UCC_GET_REQ_PERSISTENT(coll_req);
123122
UCC_VERBOSE(3, "allreduce_init init %p", coll_req);
124-
COLL_UCC_CHECK(mca_coll_ucc_allreduce_iniz(sbuf, rbuf, count, dtype, op, true, ucc_module, &req,
125-
coll_req));
123+
COLL_UCC_CHECK(mca_coll_ucc_allreduce_init_common(sbuf, rbuf, count, dtype, op,
124+
true, ucc_module, &req, coll_req));
126125
*request = &coll_req->super;
127126
return OMPI_SUCCESS;
128127
fallback:

ompi/mca/coll/ucc/coll_ucc_alltoall.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
#include "coll_ucc_common.h"
1212

1313
static inline ucc_status_t
14-
mca_coll_ucc_alltoall_iniz(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype,
15-
void *rbuf, size_t rcount, struct ompi_datatype_t *rdtype,
16-
bool persistent, mca_coll_ucc_module_t *ucc_module, ucc_coll_req_h *req,
17-
mca_coll_ucc_req_t *coll_req)
14+
mca_coll_ucc_alltoall_init_common(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype,
15+
void* rbuf, size_t rcount, struct ompi_datatype_t *rdtype,
16+
bool persistent, mca_coll_ucc_module_t *ucc_module,
17+
ucc_coll_req_h *req,
18+
mca_coll_ucc_req_t *coll_req)
1819
{
1920
ucc_datatype_t ucc_sdt = UCC_DT_INT8, ucc_rdt = UCC_DT_INT8;
2021
bool is_inplace = (MPI_IN_PLACE == sbuf);
@@ -79,15 +80,16 @@ int mca_coll_ucc_alltoall(const void *sbuf, size_t scount, struct ompi_datatype_
7980
ucc_coll_req_h req;
8081

8182
UCC_VERBOSE(3, "running ucc alltoall");
82-
COLL_UCC_CHECK(mca_coll_ucc_alltoall_iniz(sbuf, scount, sdtype, rbuf, rcount, rdtype, false,
83-
ucc_module, &req, NULL));
83+
COLL_UCC_CHECK(mca_coll_ucc_alltoall_init_common(sbuf, scount, sdtype,
84+
rbuf, rcount, rdtype,
85+
false, ucc_module, &req, NULL));
8486
COLL_UCC_POST_AND_CHECK(req);
8587
COLL_UCC_CHECK(coll_ucc_req_wait(req));
8688
return OMPI_SUCCESS;
8789
fallback:
8890
UCC_VERBOSE(3, "running fallback alltoall");
8991
return ucc_module->previous_alltoall(sbuf, scount, sdtype, rbuf, rcount, rdtype,
90-
comm, ucc_module->previous_alltoall_module);
92+
comm, ucc_module->previous_alltoall_module);
9193
}
9294

9395
int mca_coll_ucc_ialltoall(const void *sbuf, size_t scount, struct ompi_datatype_t *sdtype,
@@ -102,8 +104,9 @@ int mca_coll_ucc_ialltoall(const void *sbuf, size_t scount, struct ompi_datatype
102104

103105
UCC_VERBOSE(3, "running ucc ialltoall");
104106
COLL_UCC_GET_REQ(coll_req);
105-
COLL_UCC_CHECK(mca_coll_ucc_alltoall_iniz(sbuf, scount, sdtype, rbuf, rcount, rdtype, false,
106-
ucc_module, &req, coll_req));
107+
COLL_UCC_CHECK(mca_coll_ucc_alltoall_init_common(sbuf, scount, sdtype,
108+
rbuf, rcount, rdtype,
109+
false, ucc_module, &req, coll_req));
107110
COLL_UCC_POST_AND_CHECK(req);
108111
*request = &coll_req->super;
109112
return OMPI_SUCCESS;
@@ -125,10 +128,11 @@ int mca_coll_ucc_alltoall_init(const void *sbuf, size_t scount, struct ompi_data
125128
ucc_coll_req_h req;
126129
mca_coll_ucc_req_t *coll_req = NULL;
127130

128-
COLL_UCC_GET_REQ_PC(coll_req);
131+
COLL_UCC_GET_REQ_PERSISTENT(coll_req);
129132
UCC_VERBOSE(3, "alltoall_init init %p", coll_req);
130-
COLL_UCC_CHECK(mca_coll_ucc_alltoall_iniz(sbuf, scount, sdtype, rbuf, rcount, rdtype, true,
131-
ucc_module, &req, coll_req));
133+
COLL_UCC_CHECK(mca_coll_ucc_alltoall_init_common(sbuf, scount, sdtype,
134+
rbuf, rcount, rdtype,
135+
true, ucc_module, &req, coll_req));
132136
*request = &coll_req->super;
133137
return OMPI_SUCCESS;
134138
fallback:

0 commit comments

Comments
 (0)