Skip to content

Commit 53d1b4d

Browse files
committed
btl/uct: move the async context from the module to the tl
There is no real benefit from sharing the async context between tls. Given this and some other changes that will be made it makes sense to move it from the module to the tl.
1 parent 5a4f8a0 commit 53d1b4d

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

opal/mca/btl/uct/btl_uct.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ struct mca_btl_uct_module_t {
7979
/** mutex to protect the module */
8080
opal_recursive_mutex_t lock;
8181

82-
/** async context */
83-
ucs_async_context_t *ucs_async;
84-
8582
/** transport for active messaging */
8683
mca_btl_uct_tl_t *am_tl;
8784

opal/mca/btl/uct/btl_uct_component.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,6 @@ static mca_btl_uct_module_t *mca_btl_uct_alloc_module(const char *md_name, mca_b
393393
module->md_name = strdup(md_name);
394394
module->super.btl_registration_handle_size = registration_size;
395395

396-
ucs_status = ucs_async_context_create(UCS_ASYNC_MODE_THREAD, &module->ucs_async);
397-
if (UCS_OK != ucs_status) {
398-
BTL_VERBOSE(("Could not create a UCT async context"));
399-
mca_btl_uct_finalize(&module->super);
400-
return NULL;
401-
}
402-
403396
return module;
404397
}
405398

opal/mca/btl/uct/btl_uct_module.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ int mca_btl_uct_finalize(mca_btl_base_module_t *btl)
302302
OBJ_RELEASE(uct_module->rdma_tl);
303303
}
304304

305-
ucs_async_context_destroy(uct_module->ucs_async);
306-
307305
OBJ_DESTRUCT(&uct_module->endpoint_lock);
308306

309307
free(uct_module->md_name);

opal/mca/btl/uct/btl_uct_tl.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ static void mca_btl_uct_tl_destructor(mca_btl_uct_tl_t *tl)
156156
}
157157
}
158158

159+
if (tl->ucs_async) {
160+
ucs_async_context_destroy(tl->ucs_async);
161+
}
162+
159163
if (tl->uct_md) {
160164
OBJ_RELEASE(tl->uct_md);
161165
}
@@ -291,7 +295,7 @@ static int mca_btl_uct_populate_tl_attr(mca_btl_uct_module_t *module, mca_btl_uc
291295

292296
/* do the bare minimum to get tl attributes */
293297
uct_worker_h uct_worker;
294-
ucs_status = uct_worker_create(module->ucs_async, UCS_THREAD_MODE_SINGLE, &uct_worker);
298+
ucs_status = uct_worker_create(tl->ucs_async, UCS_THREAD_MODE_SINGLE, &uct_worker);
295299
if (OPAL_UNLIKELY(UCS_OK != ucs_status)) {
296300
BTL_VERBOSE(("could not create a UCT worker"));
297301
return OPAL_ERROR;
@@ -364,7 +368,7 @@ mca_btl_uct_device_context_t *mca_btl_uct_context_create(mca_btl_uct_module_t *m
364368
* use our own locks just go ahead and use UCS_THREAD_MODE_SINGLE. if they ever fix their
365369
* api then change this back to UCS_THREAD_MODE_MULTI and remove the locks around the
366370
* various UCT calls. */
367-
ucs_status = uct_worker_create(module->ucs_async, UCS_THREAD_MODE_SINGLE, &context->uct_worker);
371+
ucs_status = uct_worker_create(tl->ucs_async, UCS_THREAD_MODE_SINGLE, &context->uct_worker);
368372
if (OPAL_UNLIKELY(UCS_OK != ucs_status)) {
369373
BTL_VERBOSE(("could not create a UCT worker"));
370374
mca_btl_uct_context_destroy(context);
@@ -437,6 +441,13 @@ static mca_btl_uct_tl_t *mca_btl_uct_create_tl(mca_btl_uct_module_t *module, mca
437441

438442
(void) uct_md_iface_config_read(md->uct_md, tl_desc->tl_name, NULL, NULL, &tl->uct_tl_config);
439443

444+
ucs_status_t ucs_status = ucs_async_context_create(UCS_ASYNC_MODE_THREAD, &tl->ucs_async);
445+
if (UCS_OK != ucs_status) {
446+
BTL_VERBOSE(("Could not create a UCT async context"));
447+
OBJ_RELEASE(tl);
448+
return NULL;
449+
}
450+
440451
int rc = mca_btl_uct_populate_tl_attr(module, tl);
441452
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
442453
OBJ_RELEASE(tl);

opal/mca/btl/uct/btl_uct_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ struct mca_btl_uct_tl_t {
338338

339339
/** interface attributes */
340340
uct_iface_attr_t uct_iface_attr;
341+
342+
/** async context */
343+
ucs_async_context_t *ucs_async;
341344
};
342345

343346
typedef struct mca_btl_uct_tl_t mca_btl_uct_tl_t;

0 commit comments

Comments
 (0)