Skip to content

Commit 92babff

Browse files
author
Tomislav Janjusic
committed
minor revisions, renaming, indents, macros, adding flush to ctx_destroy
Signed-off-by: Tomislav Janjusic <[email protected]> (cherry picked from commit e294277)
1 parent 4c28732 commit 92babff

File tree

5 files changed

+16
-24
lines changed

5 files changed

+16
-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)
@@ -193,7 +186,7 @@ static void opal_common_ucx_wait_all_requests(void **reqs, int count, ucp_worker
193186
}
194187
}
195188

196-
OPAL_DECLSPEC int opal_common_ucx_del_procs_nb(opal_common_ucx_del_proc_t *procs, size_t count,
189+
OPAL_DECLSPEC int opal_common_ucx_del_procs_nofence(opal_common_ucx_del_proc_t *procs, size_t count,
197190
size_t my_rank, size_t max_disconnect, ucp_worker_h worker) {
198191
size_t num_reqs;
199192
size_t max_reqs;
@@ -247,11 +240,7 @@ OPAL_DECLSPEC int opal_common_ucx_del_procs_nb(opal_common_ucx_del_proc_t *procs
247240
OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, size_t count,
248241
size_t my_rank, size_t max_disconnect, ucp_worker_h worker)
249242
{
250-
int ret = OPAL_SUCCESS;
251-
opal_common_ucx_del_procs_nb(procs, count, my_rank, max_disconnect, worker);
252-
if (OPAL_SUCCESS != (ret = opal_common_ucx_mca_pmix_fence(worker))) {
253-
return ret;
254-
}
243+
opal_common_ucx_del_procs_nofence(procs, count, my_rank, max_disconnect, worker);
255244

256-
return OPAL_SUCCESS;
245+
return opal_common_ucx_mca_pmix_fence(worker);
257246
}

opal/mca/common/ucx/common_ucx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker);
103103
OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence_nb(int *fenced);
104104
OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, size_t count,
105105
size_t my_rank, size_t max_disconnect, ucp_worker_h worker);
106-
OPAL_DECLSPEC int opal_common_ucx_del_procs_nb(opal_common_ucx_del_proc_t *procs, size_t count,
106+
OPAL_DECLSPEC int opal_common_ucx_del_procs_nofence(opal_common_ucx_del_proc_t *procs, size_t count,
107107
size_t my_rank, size_t max_disconnect, ucp_worker_h worker);
108108
OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *component);
109109

oshmem/mca/spml/ucx/spml_ucx.c

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

519519
if (array->ctxs_count < array->ctxs_num) {
520520
array->ctxs[array->ctxs_count] = ctx;
521-
}
522-
else {
523-
array->ctxs = realloc(array->ctxs, (array->ctxs_num + 8) * sizeof(mca_spml_ucx_ctx_t *));
521+
} else {
522+
array->ctxs = realloc(array->ctxs, (array->ctxs_num + MCA_SPML_UCX_CTXS_ARRAY_INC) * sizeof(mca_spml_ucx_ctx_t *));
524523
opal_atomic_wmb ();
525-
for (i = array->ctxs_num; i < array->ctxs_num + 8; i++) {
524+
for (i = array->ctxs_num; i < array->ctxs_num + MCA_SPML_UCX_CTXS_ARRAY_INC; i++) {
526525
array->ctxs[i] = NULL;
527526
}
528527
array->ctxs[array->ctxs_num] = ctx;
529-
array->ctxs_num += 8;
528+
array->ctxs_num += MCA_SPML_UCX_CTXS_ARRAY_INC;
530529
}
531530

532531
opal_atomic_wmb ();
@@ -640,6 +639,7 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx)
640639

641640
void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx)
642641
{
642+
mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx;
643643
MCA_SPML_CALL(quiet(ctx));
644644

645645
SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex);

oshmem/mca/spml/ucx/spml_ucx.h

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

197+
#define MCA_SPML_UCX_CTXS_ARRAY_SIZE 64
198+
#define MCA_SPML_UCX_CTXS_ARRAY_INC 64
199+
197200
END_C_DECLS
198201

199202
#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)