|
10 | 10 | #include "assert.h" |
11 | 11 | #include "comm.h" |
12 | 12 |
|
13 | | -flagcxResult_t flagcxGroupErrCheck(flagcxResult_t ret); |
14 | | -void flagcxGroupCommJoin(struct flagcxHeteroComm *comm); |
15 | | -void flagcxGroupCommPreconnect(struct flagcxHeteroComm *comm); |
16 | | -flagcxResult_t flagcxGroupCommLeave(struct flagcxHeteroComm *comm); |
17 | | -flagcxResult_t flagcxGroupJobAbort(struct flagcxGroupJob *groupJob); |
18 | | -flagcxResult_t flagcxGroupJobComplete(struct flagcxGroupJob *groupJob); |
19 | | - |
20 | 13 | typedef flagcxResult_t (*flagcxInitFunc_t)(flagcxHeteroComm_t *newcomm, |
21 | 14 | int ndev, flagcxUniqueId commId, |
22 | 15 | int myrank, int cudaDev); |
@@ -79,69 +72,17 @@ extern __thread struct flagcxIntruQueue<struct flagcxAsyncJob, |
79 | 72 | &flagcxAsyncJob::next> |
80 | 73 | flagcxAsyncJobs; |
81 | 74 |
|
82 | | -static flagcxResult_t groupLaunch(struct flagcxAsyncJob *job_); |
| 75 | +flagcxResult_t flagcxGroupErrCheck(flagcxResult_t ret); |
| 76 | +void flagcxGroupCommJoin(struct flagcxHeteroComm *comm); |
| 77 | +void flagcxGroupCommPreconnect(struct flagcxHeteroComm *comm); |
| 78 | +flagcxResult_t flagcxGroupCommLeave(struct flagcxHeteroComm *comm); |
| 79 | +// Not implemented |
| 80 | +flagcxResult_t flagcxGroupJobAbort(struct flagcxGroupJob *groupJob); |
| 81 | +// Not implemented |
| 82 | +flagcxResult_t flagcxGroupJobComplete(struct flagcxGroupJob *groupJob); |
83 | 83 | flagcxResult_t flagcxHeteroGroupStart(); |
84 | 84 | flagcxResult_t flagcxHeteroGroupEnd(); |
85 | 85 |
|
86 | | -static inline void groupResetJobState() { |
87 | | - flagcxGroupBlocking = 0; |
88 | | - flagcxGroupJobMainPtr = NULL; |
89 | | - flagcxGroupCommPreconnectHead = nullptr; |
90 | | - flagcxGroupCommHead = nullptr; |
91 | | - memset(&flagcxGroupJobMain, 0, sizeof(struct flagcxGroupJob)); |
92 | | - return; |
93 | | -} |
94 | | - |
95 | | -static inline flagcxResult_t groupJobComplete(struct flagcxGroupJob *job) { |
96 | | - flagcxResult_t ret = flagcxSuccess; |
97 | | - if (job) { |
98 | | - ret = flagcxAsyncJobComplete(&job->base); |
99 | | - groupResetJobState(); |
100 | | - } |
101 | | - return ret; |
102 | | -} |
103 | | - |
104 | | -inline flagcxResult_t flagcxGroupStartInternal() { |
105 | | - flagcxGroupDepth++; |
106 | | - return flagcxSuccess; |
107 | | -} |
108 | | - |
109 | | -inline flagcxResult_t flagcxGroupEndInternal() { |
110 | | - flagcxResult_t ret = flagcxSuccess; |
111 | | - flagcxGroupDepth--; |
112 | | - if (flagcxGroupDepth < 0) |
113 | | - return flagcxSystemError; |
114 | | - if (flagcxGroupDepth == 0) { |
115 | | - |
116 | | - /** |
117 | | - * TODO: do all jobs at Groups |
118 | | - **/ |
119 | | - if (flagcxGroupCommPreconnectHead || flagcxGroupCommHead) { |
120 | | - |
121 | | - flagcxGroupJobMain.groupCommHeadPtr = &flagcxGroupCommHead; |
122 | | - flagcxGroupJobMain.groupCommPreconnectHeadPtr = |
123 | | - &flagcxGroupCommPreconnectHead; |
124 | | - flagcxGroupJobMain.asyncJobsPtr = &flagcxAsyncJobs; |
125 | | - flagcxGroupJobMain.initialized = true; |
126 | | - flagcxGroupJobMainPtr = &flagcxGroupJobMain; |
127 | | - |
128 | | - FLAGCXCHECKGOTO(groupLaunch(&flagcxGroupJobMainPtr->base), ret, fail); |
129 | | - groupResetJobState(); |
130 | | - } |
131 | | - } |
132 | | - |
133 | | -exit: |
134 | | - return ret; |
135 | | -fail: |
136 | | - /** |
137 | | - * TODO: add groupCleanup() |
138 | | - **/ |
139 | | - // groupCleanup(&flagcxGroupCommHead, &flagcxGroupCommPreconnectHead, |
140 | | - // &flagcxAsyncJobs, &flagcxGroupError, &flagcxGroupBlocking, |
141 | | - // &flagcxGroupJobAbortFlag, ret); |
142 | | - goto exit; |
143 | | -} |
144 | | - |
145 | 86 | inline flagcxResult_t flagcxGroupErrCheck(flagcxResult_t ret) { |
146 | 87 | if (flagcxGroupDepth > 0) { |
147 | 88 | if (ret != flagcxSuccess && ret != flagcxInProgress) |
@@ -173,4 +114,9 @@ inline flagcxResult_t flagcxGroupCommLeave(struct flagcxHeteroComm *comm) { |
173 | 114 | return flagcxSuccess; |
174 | 115 | } |
175 | 116 |
|
| 117 | +inline flagcxResult_t flagcxGroupStartInternal() { |
| 118 | + flagcxGroupDepth++; |
| 119 | + return flagcxSuccess; |
| 120 | +} |
| 121 | + |
176 | 122 | #endif |
0 commit comments