Skip to content

Commit 1ed08ca

Browse files
author
Sergey Oblomov
committed
SPML/UCX: provide backward dependency compatibility
- due to changes in SPML there was dependency inconsistent with 4.x branches - unified dependency with 4.x branches Signed-off-by: Sergey Oblomov <sergeyo@nvidia.com> (cherry picked from commit dcf122d)
1 parent d50bc22 commit 1ed08ca

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ mca_spml_ucx_t mca_spml_ucx = {
7878
.num_disconnect = 1,
7979
.heap_reg_nb = 0,
8080
.enabled = 0,
81-
.get_mkey_slow = NULL,
82-
.synchronized_quiet = false,
83-
.strong_sync = SPML_UCX_STRONG_ORDERING_NONE
81+
.get_mkey_slow = NULL
8482
};
8583

8684
mca_spml_ucx_ctx_t mca_spml_ucx_ctx_default = {
8785
.ucp_worker = NULL,
8886
.ucp_peers = NULL,
89-
.options = 0
87+
.options = 0,
88+
.synchronized_quiet = false,
89+
.strong_sync = SPML_UCX_STRONG_ORDERING_NONE
9090
};
9191

9292
#if HAVE_DECL_UCP_ATOMIC_OP_NBX
@@ -405,7 +405,7 @@ int mca_spml_ucx_init_put_op_mask(mca_spml_ucx_ctx_t *ctx, size_t nprocs)
405405
{
406406
int res;
407407

408-
if (mca_spml_ucx_is_strong_ordering()) {
408+
if (mca_spml_ucx_is_strong_ordering(ctx)) {
409409
ctx->put_proc_indexes = malloc(nprocs * sizeof(*ctx->put_proc_indexes));
410410
if (NULL == ctx->put_proc_indexes) {
411411
return OSHMEM_ERR_OUT_OF_RESOURCE;
@@ -427,7 +427,7 @@ int mca_spml_ucx_init_put_op_mask(mca_spml_ucx_ctx_t *ctx, size_t nprocs)
427427

428428
int mca_spml_ucx_clear_put_op_mask(mca_spml_ucx_ctx_t *ctx)
429429
{
430-
if (mca_spml_ucx_is_strong_ordering() && ctx->put_proc_indexes) {
430+
if (mca_spml_ucx_is_strong_ordering(ctx) && ctx->put_proc_indexes) {
431431
OBJ_DESTRUCT(&ctx->put_op_bitmap);
432432
free(ctx->put_proc_indexes);
433433
}
@@ -844,6 +844,8 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx
844844
ucx_ctx->options = options;
845845
ucx_ctx->ucp_worker = calloc(1, sizeof(ucp_worker_h));
846846
ucx_ctx->ucp_workers = 1;
847+
ucx_ctx->synchronized_quiet = mca_spml_ucx_ctx_default.synchronized_quiet;
848+
ucx_ctx->strong_sync = mca_spml_ucx_ctx_default.strong_sync;
847849

848850
params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE;
849851
if (oshmem_mpi_thread_provided == SHMEM_THREAD_SINGLE || options & SHMEM_CTX_PRIVATE || options & SHMEM_CTX_SERIALIZED) {
@@ -1193,7 +1195,7 @@ static int mca_spml_ucx_strong_sync(shmem_ctx_t ctx)
11931195
for (i = 0; i < ucx_ctx->put_proc_count; i++) {
11941196
idx = ucx_ctx->put_proc_indexes[i];
11951197

1196-
switch (mca_spml_ucx.strong_sync) {
1198+
switch (ucx_ctx->strong_sync) {
11971199
case SPML_UCX_STRONG_ORDERING_NONE:
11981200
case SPML_UCX_STRONG_ORDERING_GETNB:
11991201
ret = mca_spml_ucx_get_nb(ctx,
@@ -1245,7 +1247,7 @@ int mca_spml_ucx_fence(shmem_ctx_t ctx)
12451247

12461248
opal_atomic_wmb();
12471249

1248-
if (mca_spml_ucx.strong_sync != SPML_UCX_STRONG_ORDERING_NONE) {
1250+
if (ucx_ctx->strong_sync != SPML_UCX_STRONG_ORDERING_NONE) {
12491251
ret = mca_spml_ucx_strong_sync(ctx);
12501252
if (ret != OSHMEM_SUCCESS) {
12511253
oshmem_shmem_abort(-1);
@@ -1272,7 +1274,7 @@ int mca_spml_ucx_quiet(shmem_ctx_t ctx)
12721274
unsigned i;
12731275
mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx;
12741276

1275-
if (mca_spml_ucx.synchronized_quiet) {
1277+
if (ucx_ctx->synchronized_quiet) {
12761278
ret = mca_spml_ucx_strong_sync(ctx);
12771279
if (ret != OSHMEM_SUCCESS) {
12781280
oshmem_shmem_abort(-1);

oshmem/mca/spml/ucx/spml_ucx.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ struct mca_spml_ucx_ctx {
8686
unsigned int ucp_workers;
8787
int *put_proc_indexes;
8888
unsigned put_proc_count;
89+
bool synchronized_quiet;
90+
int strong_sync;
8991
};
9092
typedef struct mca_spml_ucx_ctx mca_spml_ucx_ctx_t;
9193

@@ -120,8 +122,6 @@ struct mca_spml_ucx {
120122
mca_spml_ucx_ctx_t *aux_ctx;
121123
pthread_spinlock_t async_lock;
122124
int aux_refcnt;
123-
bool synchronized_quiet;
124-
int strong_sync;
125125
unsigned long nb_progress_thresh_global;
126126
unsigned long nb_put_progress_thresh;
127127
unsigned long nb_get_progress_thresh;
@@ -301,15 +301,15 @@ static inline int ucx_status_to_oshmem_nb(ucs_status_t status)
301301
#endif
302302
}
303303

304-
static inline int mca_spml_ucx_is_strong_ordering(void)
304+
static inline int mca_spml_ucx_is_strong_ordering(mca_spml_ucx_ctx_t *ctx)
305305
{
306-
return (mca_spml_ucx.strong_sync != SPML_UCX_STRONG_ORDERING_NONE) ||
307-
mca_spml_ucx.synchronized_quiet;
306+
return (ctx->strong_sync != SPML_UCX_STRONG_ORDERING_NONE) ||
307+
ctx->synchronized_quiet;
308308
}
309309

310310
static inline void mca_spml_ucx_remote_op_posted(mca_spml_ucx_ctx_t *ctx, int dst)
311311
{
312-
if (OPAL_UNLIKELY(mca_spml_ucx_is_strong_ordering())) {
312+
if (OPAL_UNLIKELY(mca_spml_ucx_is_strong_ordering(ctx))) {
313313
if (!opal_bitmap_is_set_bit(&ctx->put_op_bitmap, dst)) {
314314
ctx->put_proc_indexes[ctx->put_proc_count++] = dst;
315315
opal_bitmap_set_bit(&ctx->put_op_bitmap, dst);

oshmem/mca/spml/ucx/spml_ucx_component.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ static int mca_spml_ucx_component_register(void)
159159

160160
mca_spml_ucx_param_register_bool("synchronized_quiet", 0,
161161
"Use synchronized quiet on shmem_quiet or shmem_barrier_all operations",
162-
&mca_spml_ucx.synchronized_quiet);
162+
&mca_spml_ucx_ctx_default.synchronized_quiet);
163163

164164
mca_spml_ucx_param_register_int("strong_sync", 0,
165165
"Use strong synchronization on shmem_quiet, shmem_fence or shmem_barrier_all operations: "
166166
"0 - don't do strong synchronization, 1 - use non blocking get, 2 - use blocking get, 3 - use flush operation",
167-
&mca_spml_ucx.strong_sync);
167+
&mca_spml_ucx_ctx_default.strong_sync);
168168

169169
mca_spml_ucx_param_register_ulong("nb_progress_thresh_global", 0,
170170
"Number of nb_put or nb_get operations before ucx progress is triggered. Disabled by default (0). Setting this value will override nb_put/get_progress_thresh.",
@@ -388,14 +388,14 @@ mca_spml_ucx_component_init(int* priority,
388388
if (OSHMEM_SUCCESS != spml_ucx_init())
389389
return NULL ;
390390

391-
SPML_UCX_VERBOSE(50, "*** ucx initialized ****");
392-
393-
if ((mca_spml_ucx.strong_sync < SPML_UCX_STRONG_ORDERING_NONE) ||
394-
(mca_spml_ucx.strong_sync > SPML_UCX_STRONG_ORDERING_FLUSH)) {
391+
if ((mca_spml_ucx_ctx_default.strong_sync < SPML_UCX_STRONG_ORDERING_NONE) ||
392+
(mca_spml_ucx_ctx_default.strong_sync > SPML_UCX_STRONG_ORDERING_FLUSH)) {
395393
SPML_UCX_ERROR("incorrect value of strong_sync parameter: %d",
396-
mca_spml_ucx.strong_sync);
394+
mca_spml_ucx_ctx_default.strong_sync);
397395
}
398396

397+
SPML_UCX_VERBOSE(50, "*** ucx initialized ****");
398+
399399
return &mca_spml_ucx.super;
400400
}
401401

0 commit comments

Comments
 (0)