Skip to content

Commit 4366da1

Browse files
authored
Merge pull request #2563 from yosefe/topic/pml-spml-ucx-api-v2.x
v2.x: PML/SPML/UCX: Adapt to the API changes in the UCX lib.
2 parents 2bcb994 + 1273d61 commit 4366da1

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

ompi/mca/pml/ucx/pml_ucx.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,17 @@ int mca_pml_ucx_close(void)
175175

176176
int mca_pml_ucx_init(void)
177177
{
178+
ucp_worker_params_t params;
178179
ucs_status_t status;
179180
int rc;
180181

181182
PML_UCX_VERBOSE(1, "mca_pml_ucx_init");
182183

183184
/* TODO check MPI thread mode */
184-
status = ucp_worker_create(ompi_pml_ucx.ucp_context, UCS_THREAD_MODE_SINGLE,
185+
params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE;
186+
params.thread_mode = UCS_THREAD_MODE_SINGLE;
187+
188+
status = ucp_worker_create(ompi_pml_ucx.ucp_context, &params,
185189
&ompi_pml_ucx.ucp_worker);
186190
if (UCS_OK != status) {
187191
return OMPI_ERROR;
@@ -231,6 +235,7 @@ int mca_pml_ucx_cleanup(void)
231235

232236
ucp_ep_h mca_pml_ucx_add_proc(ompi_communicator_t *comm, int dst)
233237
{
238+
ucp_ep_params_t ep_params;
234239
ucp_address_t *address;
235240
ucs_status_t status;
236241
size_t addrlen;
@@ -254,7 +259,11 @@ ucp_ep_h mca_pml_ucx_add_proc(ompi_communicator_t *comm, int dst)
254259
}
255260

256261
PML_UCX_VERBOSE(2, "connecting to proc. %d", proc_peer->super.proc_name.vpid);
257-
status = ucp_ep_create(ompi_pml_ucx.ucp_worker, address, &ep);
262+
263+
ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS;
264+
ep_params.address = address;
265+
266+
status = ucp_ep_create(ompi_pml_ucx.ucp_worker, &ep_params, &ep);
258267
free(address);
259268
if (UCS_OK != status) {
260269
PML_UCX_ERROR("Failed to connect to proc: %d, %s", proc_peer->super.proc_name.vpid,
@@ -269,6 +278,7 @@ ucp_ep_h mca_pml_ucx_add_proc(ompi_communicator_t *comm, int dst)
269278

270279
int mca_pml_ucx_add_procs(struct ompi_proc_t **procs, size_t nprocs)
271280
{
281+
ucp_ep_params_t ep_params;
272282
ucp_address_t *address;
273283
ucs_status_t status;
274284
ompi_proc_t *proc;
@@ -299,7 +309,11 @@ int mca_pml_ucx_add_procs(struct ompi_proc_t **procs, size_t nprocs)
299309
}
300310

301311
PML_UCX_VERBOSE(2, "connecting to proc. %d", proc->super.proc_name.vpid);
302-
status = ucp_ep_create(ompi_pml_ucx.ucp_worker, address, &ep);
312+
313+
ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS;
314+
ep_params.address = address;
315+
316+
status = ucp_ep_create(ompi_pml_ucx.ucp_worker, &ep_params, &ep);
303317
free(address);
304318

305319
if (UCS_OK != status) {

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ int mca_spml_ucx_add_procs(ompi_proc_t **procs, size_t nprocs)
254254
size_t wk_addr_len;
255255
int *wk_roffs, *wk_rsizes;
256256
char *wk_raddrs;
257+
ucp_ep_params_t ep_params;
257258

258259

259260
mca_spml_ucx.ucp_peers = (ucp_peer_t *) calloc(nprocs, sizeof(*(mca_spml_ucx.ucp_peers)));
@@ -279,9 +280,13 @@ int mca_spml_ucx_add_procs(ompi_proc_t **procs, size_t nprocs)
279280
for (n = 0; n < nprocs; ++n) {
280281
i = (my_rank + n) % nprocs;
281282
dump_address(i, (char *)(wk_raddrs + wk_roffs[i]), wk_rsizes[i]);
283+
284+
ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS;
285+
ep_params.address = (ucp_address_t *)(wk_raddrs + wk_roffs[i]);
286+
282287
err = ucp_ep_create(mca_spml_ucx.ucp_worker,
283-
(ucp_address_t *)(wk_raddrs + wk_roffs[i]),
284-
&mca_spml_ucx.ucp_peers[i].ucp_conn);
288+
&ep_params,
289+
&mca_spml_ucx.ucp_peers[i].ucp_conn);
285290
if (UCS_OK != err) {
286291
SPML_ERROR("ucp_ep_create failed!!!\n");
287292
goto error2;
@@ -389,6 +394,7 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
389394
spml_ucx_mkey_t *ucx_mkey;
390395
size_t len;
391396
int my_pe = oshmem_my_proc_id();
397+
ucp_mem_map_params_t mem_map_params;
392398
int seg;
393399
unsigned flags;
394400

@@ -407,7 +413,15 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
407413
if (mca_spml_ucx.heap_reg_nb && memheap_is_va_in_segment(addr, HEAP_SEG_INDEX)) {
408414
flags = UCP_MEM_MAP_NONBLOCK;
409415
}
410-
err = ucp_mem_map(mca_spml_ucx.ucp_context, &addr, size, flags, &ucx_mkey->mem_h);
416+
417+
mem_map_params.field_mask = UCP_MEM_MAP_PARAM_FIELD_ADDRESS |
418+
UCP_MEM_MAP_PARAM_FIELD_LENGTH |
419+
UCP_MEM_MAP_PARAM_FIELD_FLAGS;
420+
mem_map_params.address = addr;
421+
mem_map_params.length = size;
422+
mem_map_params.flags = flags;
423+
424+
err = ucp_mem_map(mca_spml_ucx.ucp_context, &mem_map_params, &ucx_mkey->mem_h);
411425
if (UCS_OK != err) {
412426
goto error_out;
413427
}
@@ -433,7 +447,7 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
433447
}
434448

435449
mkeys[0].len = len;
436-
mkeys[0].va_base = addr;
450+
mkeys[0].va_base = mem_map_params.address;
437451
*count = 1;
438452
mca_spml_ucx_cache_mkey(&mkeys[0], seg, my_pe);
439453
return mkeys;

oshmem/mca/spml/ucx/spml_ucx_component.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,13 @@ static int mca_spml_ucx_component_close(void)
149149

150150
static int spml_ucx_init(void)
151151
{
152+
ucp_worker_params_t params;
152153
ucs_status_t err;
153154

154-
err = ucp_worker_create(mca_spml_ucx.ucp_context, UCS_THREAD_MODE_SINGLE,
155+
params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE;
156+
params.thread_mode = UCS_THREAD_MODE_SINGLE;
157+
158+
err = ucp_worker_create(mca_spml_ucx.ucp_context, &params,
155159
&mca_spml_ucx.ucp_worker);
156160
if (UCS_OK != err) {
157161
return OSHMEM_ERROR;

0 commit comments

Comments
 (0)