Skip to content

Commit be42d81

Browse files
author
valentin petrov
authored
TOPO: compute all socket subgroups (openucx#338)
* CORE: ucc_team_subset_t -> ucc_subset_t Subset is a generic struct, not directly related to team * CORE: refactor team_topo It is now subset topo, as it can be initialized for any subset of processes from the origin ctx group (world) * CORE: create all sockets * TOPO: move topo to framework * TOPO: 2nd refactor * TOPO: test fixes * TOPO: documentation * REVIEW: address comments * CODESTYLE: adjust .clang-format * CODESTYLE: apply clang format * TOPO: asan fix
1 parent 40ad191 commit be42d81

23 files changed

+615
-376
lines changed

.clang-format

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ AccessModifierOffset: -2
55
AlignAfterOpenBracket: Align
66
AlignConsecutiveAssignments: true
77
AlignConsecutiveDeclarations: true
8+
AlignConsecutiveMacros: true
89
AlignEscapedNewlines: Right
910
AlignOperands: true
1011
AlignTrailingComments: true
@@ -17,18 +18,20 @@ AllowShortFunctionsOnASingleLine: false
1718
AllowShortLambdasOnASingleLine: All
1819
AllowShortIfStatementsOnASingleLine: Never
1920
AllowShortLoopsOnASingleLine: false
21+
AllowShortEnumsOnASingleLine: false
2022
AlwaysBreakAfterDefinitionReturnType: None
2123
AlwaysBreakAfterReturnType: None
2224
AlwaysBreakBeforeMultilineStrings: false
2325
AlwaysBreakTemplateDeclarations: MultiLine
2426
BinPackArguments: true
2527
BinPackParameters: true
28+
BreakBeforeBraces: Custom
2629
BraceWrapping:
27-
AfterCaseLabel: false
30+
AfterCaseLabel: true
2831
AfterClass: false
2932
AfterControlStatement: false
3033
AfterEnum: false
31-
AfterFunction: false
34+
AfterFunction: true
3235
AfterNamespace: false
3336
AfterObjCDeclaration: false
3437
AfterStruct: false
@@ -40,10 +43,6 @@ BraceWrapping:
4043
SplitEmptyFunction: true
4144
SplitEmptyRecord: true
4245
SplitEmptyNamespace: true
43-
BreakBeforeBinaryOperators: None
44-
BreakBeforeBraces: Stroustrup
45-
BreakBeforeInheritanceComma: false
46-
BreakInheritanceList: BeforeColon
4746
BreakBeforeTernaryOperators: true
4847
BreakConstructorInitializersBeforeComma: false
4948
BreakConstructorInitializers: BeforeColon
@@ -90,9 +89,9 @@ ObjCSpaceAfterProperty: false
9089
ObjCSpaceBeforeProtocolList: true
9190
PenaltyBreakAssignment: 2
9291
PenaltyBreakBeforeFirstCallParameter: 19
93-
PenaltyBreakComment: 300
92+
PenaltyBreakComment: 150
9493
PenaltyBreakFirstLessLess: 120
95-
PenaltyBreakString: 1000
94+
PenaltyBreakString: 250
9695
PenaltyBreakTemplateDeclaration: 10
9796
PenaltyExcessCharacter: 1000000
9897
PenaltyReturnTypeOnItsOwnLine: 60

.github/workflows/codestyle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
return 1
3737
fi
3838
fi
39-
if ! echo $msg | grep -qP '^Merge |^((CODESTYLE|REVIEW|CORE|UTIL|TEST|API|DOCS|TOOLS|BUILD|MC|SCHEDULE)|(CL/|TL/|MC/|UCP|UCG|NCCL|SHARP|BASIC|HIER|CUDA|CPU|EE))+: \w'
39+
if ! echo $msg | grep -qP '^Merge |^((CODESTYLE|REVIEW|CORE|UTIL|TEST|API|DOCS|TOOLS|BUILD|MC|SCHEDULE|TOPO)|(CL/|TL/|MC/|UCP|UCG|NCCL|SHARP|BASIC|HIER|CUDA|CPU|EE))+: \w'
4040
then
4141
echo "Wrong header"
4242
return 1

src/Makefile.am

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ noinst_HEADERS = \
4545
core/ucc_team.h \
4646
core/ucc_ee.h \
4747
core/ucc_progress_queue.h \
48-
core/ucc_topo.h \
49-
core/ucc_sbgp.h \
5048
core/ucc_service_coll.h \
5149
schedule/ucc_schedule.h \
5250
schedule/ucc_schedule_pipelined.h \
@@ -79,7 +77,9 @@ noinst_HEADERS = \
7977
components/mc/base/ucc_mc_base.h \
8078
components/mc/ucc_mc_log.h \
8179
coll_patterns/recursive_knomial.h \
82-
coll_patterns/sra_knomial.h
80+
coll_patterns/sra_knomial.h \
81+
components/topo/ucc_topo.h \
82+
components/topo/ucc_sbgp.h
8383

8484
libucc_la_SOURCES = \
8585
core/ucc_lib.c \
@@ -94,8 +94,6 @@ libucc_la_SOURCES = \
9494
core/ucc_progress_queue.c \
9595
core/ucc_progress_queue_st.c \
9696
core/ucc_progress_queue_mt.c \
97-
core/ucc_topo.c \
98-
core/ucc_sbgp.c \
9997
core/ucc_service_coll.c \
10098
schedule/ucc_schedule.c \
10199
schedule/ucc_schedule_pipelined.c \
@@ -113,6 +111,8 @@ libucc_la_SOURCES = \
113111
components/base/ucc_base_iface.c \
114112
components/cl/ucc_cl.c \
115113
components/tl/ucc_tl.c \
116-
components/mc/base/ucc_mc_base.c
114+
components/mc/base/ucc_mc_base.c \
115+
components/topo/ucc_topo.c \
116+
components/topo/ucc_sbgp.c
117117

118118
libucc_ladir = $(includedir)

src/components/cl/hier/cl_hier_team.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ UCC_CLASS_INIT_FUNC(ucc_cl_hier_team_t, ucc_base_context_t *cl_context,
3535
ucc_status_t status;
3636
ucc_hier_sbgp_t *hs;
3737
ucc_config_names_array_t *tls;
38-
ucc_team_subset_t subset;
38+
ucc_subset_t subset;
3939
struct ucc_team_team_desc *d;
4040

4141
if (!params->team->topo) {
@@ -58,8 +58,7 @@ UCC_CLASS_INIT_FUNC(ucc_cl_hier_team_t, ucc_base_context_t *cl_context,
5858
hs->score = NULL;
5959
hs->sbgp = NULL;
6060
if (hs->state == UCC_HIER_SBGP_ENABLED) {
61-
hs->sbgp =
62-
ucc_team_topo_get_sbgp(params->team->topo, hs->sbgp_type);
61+
hs->sbgp = ucc_topo_get_sbgp(params->team->topo, hs->sbgp_type);
6362
if (hs->sbgp->status != UCC_SBGP_ENABLED) {
6463
/* SBGP of that type either not exists or the calling process
6564
is not part of subgroup */

src/components/tl/ucc_tl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ ucc_status_t ucc_tl_lib_config_read(ucc_tl_iface_t *iface,
4949
typedef struct ucc_tl_service_coll {
5050
ucc_status_t (*allreduce)(ucc_base_team_t *team, void *sbuf, void *rbuf,
5151
ucc_datatype_t dt, size_t count,
52-
ucc_reduction_op_t op,
53-
ucc_team_subset_t subset, ucc_coll_task_t **task);
52+
ucc_reduction_op_t op, ucc_subset_t subset,
53+
ucc_coll_task_t **task);
5454
ucc_status_t (*allgather)(ucc_base_team_t *team, void *sbuf, void *rbuf,
55-
size_t msgsize, ucc_team_subset_t subset,
55+
size_t msgsize, ucc_subset_t subset,
5656
ucc_coll_task_t **task);
5757
void (*update_id)(ucc_base_team_t *team, uint16_t id);
5858
} ucc_tl_service_coll_t;

src/components/tl/ucp/tl_ucp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ ucc_status_t ucc_tl_ucp_populate_rcache(void *addr, size_t length,
172172
ucc_status_t ucc_tl_ucp_service_allreduce(ucc_base_team_t *team, void *sbuf,
173173
void *rbuf, ucc_datatype_t dt,
174174
size_t count, ucc_reduction_op_t op,
175-
ucc_team_subset_t subset,
175+
ucc_subset_t subset,
176176
ucc_coll_task_t **task);
177177

178178
ucc_status_t ucc_tl_ucp_service_allgather(ucc_base_team_t *team, void *sbuf,
179179
void *rbuf, size_t msgsize,
180-
ucc_team_subset_t subset,
180+
ucc_subset_t subset,
181181
ucc_coll_task_t **task_p);
182182

183183
ucc_status_t ucc_tl_ucp_service_test(ucc_coll_task_t *task);

src/components/tl/ucp/tl_ucp_coll.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ extern const char
3232
(((_rank) + (_root)) % (_team_size))
3333

3434
typedef struct ucc_tl_ucp_task {
35-
ucc_coll_task_t super;
36-
uint32_t send_posted;
37-
uint32_t send_completed;
38-
uint32_t recv_posted;
39-
uint32_t recv_completed;
40-
uint32_t tag;
41-
uint32_t n_polls;
42-
ucc_team_subset_t subset;
35+
ucc_coll_task_t super;
36+
uint32_t send_posted;
37+
uint32_t send_completed;
38+
uint32_t recv_posted;
39+
uint32_t recv_completed;
40+
uint32_t tag;
41+
uint32_t n_polls;
42+
ucc_subset_t subset;
4343
union {
4444
struct {
4545
int phase;

src/components/tl/ucp/tl_ucp_service_coll.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
ucc_status_t ucc_tl_ucp_service_allreduce(ucc_base_team_t *team, void *sbuf,
1414
void *rbuf, ucc_datatype_t dt,
1515
size_t count, ucc_reduction_op_t op,
16-
ucc_team_subset_t subset,
16+
ucc_subset_t subset,
1717
ucc_coll_task_t **task_p)
1818
{
1919
ucc_tl_ucp_team_t *tl_team = ucc_derived_of(team, ucc_tl_ucp_team_t);
@@ -69,7 +69,7 @@ ucc_status_t ucc_tl_ucp_service_allreduce(ucc_base_team_t *team, void *sbuf,
6969

7070
ucc_status_t ucc_tl_ucp_service_allgather(ucc_base_team_t *team, void *sbuf,
7171
void *rbuf, size_t msgsize,
72-
ucc_team_subset_t subset,
72+
ucc_subset_t subset,
7373
ucc_coll_task_t **task_p)
7474
{
7575
ucc_tl_ucp_team_t *tl_team = ucc_derived_of(team, ucc_tl_ucp_team_t);

0 commit comments

Comments
 (0)