Skip to content

Commit b6d07da

Browse files
author
Tomislav Janjusic
committed
minor revisions, renaming, indents, macros, adding flush to ctx_destroy
Signed-off-by: Tomislav Janjusic <[email protected]>
1 parent 280f330 commit b6d07da

File tree

5 files changed

+18
-24
lines changed

5 files changed

+18
-24
lines changed

opal/mca/common/ucx/common_ucx.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,7 @@ void opal_common_ucx_mca_proc_added(void)
155155

156156
OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence_nb(int *fenced)
157157
{
158-
int ret = OPAL_SUCCESS;
159-
160-
if (OPAL_SUCCESS != (ret = opal_pmix.fence_nb(NULL, 0,
161-
opal_common_ucx_mca_fence_complete_cb, (void*)fenced))){
162-
return ret;
163-
}
164-
165-
return ret;
158+
return opal_pmix.fence_nb(NULL, 0, opal_common_ucx_mca_fence_complete_cb, (void *) fenced);
166159
}
167160

168161
OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker)
@@ -194,7 +187,7 @@ static void opal_common_ucx_wait_all_requests(void **reqs, int count, ucp_worker
194187
}
195188
}
196189

197-
OPAL_DECLSPEC int opal_common_ucx_del_procs_nb(opal_common_ucx_del_proc_t *procs, size_t count,
190+
OPAL_DECLSPEC int opal_common_ucx_del_procs_nofence(opal_common_ucx_del_proc_t *procs, size_t count,
198191
size_t my_rank, size_t max_disconnect, ucp_worker_h worker) {
199192
size_t num_reqs;
200193
size_t max_reqs;
@@ -249,12 +242,8 @@ OPAL_DECLSPEC int opal_common_ucx_del_procs_nb(opal_common_ucx_del_proc_t *procs
249242
OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, size_t count,
250243
size_t my_rank, size_t max_disconnect, ucp_worker_h worker)
251244
{
252-
int ret = OPAL_SUCCESS;
253-
opal_common_ucx_del_procs_nb(procs, count, my_rank, max_disconnect, worker);
254-
if (OPAL_SUCCESS != (ret = opal_common_ucx_mca_pmix_fence(worker))) {
255-
return ret;
256-
}
245+
opal_common_ucx_del_procs_nofence(procs, count, my_rank, max_disconnect, worker);
257246

258-
return OPAL_SUCCESS;
247+
return opal_common_ucx_mca_pmix_fence(worker);
259248
}
260249

opal/mca/common/ucx/common_ucx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker);
108108
OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence_nb(int *fenced);
109109
OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, size_t count,
110110
size_t my_rank, size_t max_disconnect, ucp_worker_h worker);
111-
OPAL_DECLSPEC int opal_common_ucx_del_procs_nb(opal_common_ucx_del_proc_t *procs, size_t count,
111+
OPAL_DECLSPEC int opal_common_ucx_del_procs_nofence(opal_common_ucx_del_proc_t *procs, size_t count,
112112
size_t my_rank, size_t max_disconnect, ucp_worker_h worker);
113113
OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *component);
114114

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,15 +515,14 @@ static inline void _ctx_add(mca_spml_ucx_ctx_array_t *array, mca_spml_ucx_ctx_t
515515

516516
if (array->ctxs_count < array->ctxs_num) {
517517
array->ctxs[array->ctxs_count] = ctx;
518-
}
519-
else {
520-
array->ctxs = realloc(array->ctxs, (array->ctxs_num + 8) * sizeof(mca_spml_ucx_ctx_t *));
518+
} else {
519+
array->ctxs = realloc(array->ctxs, (array->ctxs_num + MCA_SPML_UCX_CTXS_ARRAY_INC) * sizeof(mca_spml_ucx_ctx_t *));
521520
opal_atomic_wmb ();
522-
for (i = array->ctxs_num; i < array->ctxs_num + 8; i++) {
521+
for (i = array->ctxs_num; i < array->ctxs_num + MCA_SPML_UCX_CTXS_ARRAY_INC; i++) {
523522
array->ctxs[i] = NULL;
524523
}
525524
array->ctxs[array->ctxs_num] = ctx;
526-
array->ctxs_num += 8;
525+
array->ctxs_num += MCA_SPML_UCX_CTXS_ARRAY_INC;
527526
}
528527

529528
opal_atomic_wmb ();
@@ -637,13 +636,16 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx)
637636

638637
void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx)
639638
{
639+
mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx;
640640
MCA_SPML_CALL(quiet(ctx));
641641

642642
SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex);
643643
_ctx_remove(&mca_spml_ucx.active_array, (mca_spml_ucx_ctx_t *)ctx);
644644
_ctx_add(&mca_spml_ucx.idle_array, (mca_spml_ucx_ctx_t *)ctx);
645645
SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex);
646646

647+
ucp_worker_flush(ucx_ctx->ucp_worker);
648+
647649
if (!mca_spml_ucx.active_array.ctxs_count) {
648650
opal_progress_unregister(spml_ucx_ctx_progress);
649651
}

oshmem/mca/spml/ucx/spml_ucx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ static inline int ucx_status_to_oshmem_nb(ucs_status_t status)
193193
#endif
194194
}
195195

196+
#define MCA_SPML_UCX_CTXS_ARRAY_SIZE 64
197+
#define MCA_SPML_UCX_CTXS_ARRAY_INC 64
198+
196199
END_C_DECLS
197200

198201
#endif

oshmem/mca/spml/ucx/spml_ucx_component.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ static int spml_ucx_init(void)
178178
}
179179

180180
mca_spml_ucx.active_array.ctxs_count = mca_spml_ucx.idle_array.ctxs_count = 0;
181-
mca_spml_ucx.active_array.ctxs_num = mca_spml_ucx.idle_array.ctxs_num = 8;
181+
mca_spml_ucx.active_array.ctxs_num = mca_spml_ucx.idle_array.ctxs_num = MCA_SPML_UCX_CTXS_ARRAY_SIZE;
182182
mca_spml_ucx.active_array.ctxs = calloc(mca_spml_ucx.active_array.ctxs_num,
183183
sizeof(mca_spml_ucx_ctx_t *));
184184
mca_spml_ucx.idle_array.ctxs = calloc(mca_spml_ucx.idle_array.ctxs_num,
185-
sizeof(mca_spml_ucx_ctx_t *));
185+
sizeof(mca_spml_ucx_ctx_t *));
186186

187187
SHMEM_MUTEX_INIT(mca_spml_ucx.internal_mutex);
188188

@@ -251,7 +251,7 @@ static void _ctx_cleanup(mca_spml_ucx_ctx_t *ctx)
251251
ctx->ucp_peers[i].ucp_conn = NULL;
252252
}
253253

254-
opal_common_ucx_del_procs_nb(del_procs, nprocs, oshmem_my_proc_id(),
254+
opal_common_ucx_del_procs_nofence(del_procs, nprocs, oshmem_my_proc_id(),
255255
mca_spml_ucx.num_disconnect,
256256
ctx->ucp_worker);
257257
free(del_procs);

0 commit comments

Comments
 (0)