@@ -71,11 +71,8 @@ qvi_pthread_group::call_first_from_pthread_create(
71
71
const pid_t tidi = group->m_tids [i];
72
72
group->m_tid2rank .insert ({tidi, i});
73
73
}
74
- pthread_barrier_wait (&group->m_barrier );
75
- }
76
- else {
77
- pthread_barrier_wait (&group->m_barrier );
78
74
}
75
+ pthread_barrier_wait (&group->m_barrier );
79
76
// Everyone can now create their task and populate the mapping table.
80
77
{
81
78
std::lock_guard<std::mutex> guard (group->m_mutex );
@@ -216,7 +213,7 @@ qvi_pthread_group::split(
216
213
if (qvi_likely (rc == QV_SUCCESS)) {
217
214
rc = qvi_new (&ichild, sginfo.size , sginfo.rank );
218
215
}
219
- if (rc != QV_SUCCESS) {
216
+ if (qvi_unlikely ( rc != QV_SUCCESS) ) {
220
217
qvi_delete (&ichild);
221
218
}
222
219
*child = ichild;
@@ -230,9 +227,7 @@ qvi_pthread_group::gather(
230
227
qvi_alloc_type_t *shared_alloc,
231
228
qvi_bbuff ***rxbuffs
232
229
) {
233
- int rank = qvi_pthread_group::rank ();
234
-
235
- const int rc = qvi_bbuff_copy (*txbuff, m_data_g[rank]);
230
+ const int rc = qvi_bbuff_copy (*txbuff, m_data_g[rank ()]);
236
231
// Need to ensure that all threads have contributed to m_data_g
237
232
pthread_barrier_wait (&m_barrier);
238
233
*shared_alloc = ALLOC_SHARED_GLOBAL;
@@ -252,15 +247,15 @@ qvi_pthread_group::scatter(
252
247
int rootid,
253
248
qvi_bbuff **rxbuff
254
249
) {
255
- int rank = qvi_pthread_group:: rank ();
250
+ const int myrank = rank ();
256
251
257
- if (rootid == rank) {
252
+ if (rootid == myrank) {
258
253
*m_data_s = txbuffs;
259
254
}
260
255
pthread_barrier_wait (&m_barrier);
261
256
262
257
qvi_bbuff *mybbuff = nullptr ;
263
- const int rc = qvi_bbuff_dup ( *((*m_data_s)[rank ]), &mybbuff);
258
+ const int rc = qvi_bbuff_dup ( *((*m_data_s)[myrank ]), &mybbuff);
264
259
pthread_barrier_wait (&m_barrier);
265
260
266
261
if (qvi_unlikely (rc != QV_SUCCESS)) {
0 commit comments