Skip to content

Commit 749f75b

Browse files
authored
Merge pull request #2564 from yosefe/topic/pml-spml-ucx-api-v2.0.x
v2.0.x: PML/SPML/UCX: Adapt to the API changes in the UCX lib.
2 parents a51f249 + fb3f98b commit 749f75b

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

ompi/mca/pml/ucx/pml_ucx.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,18 @@ int mca_pml_ucx_close(void)
156156

157157
int mca_pml_ucx_init(void)
158158
{
159+
ucp_worker_params_t params;
159160
ucs_status_t status;
160161
int rc;
161162

162163
PML_UCX_VERBOSE(1, "mca_pml_ucx_init");
163164

164165
/* TODO check MPI thread mode */
165-
status = ucp_worker_create(ompi_pml_ucx.ucp_context, UCS_THREAD_MODE_SINGLE,
166-
&ompi_pml_ucx.ucp_worker);
166+
params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE;
167+
params.thread_mode = UCS_THREAD_MODE_SINGLE;
168+
169+
status = ucp_worker_create(ompi_pml_ucx.ucp_context, &params,
170+
&ompi_pml_ucx.ucp_worker);
167171
if (UCS_OK != status) {
168172
return OMPI_ERROR;
169173
}
@@ -212,6 +216,7 @@ int mca_pml_ucx_cleanup(void)
212216

213217
ucp_ep_h mca_pml_ucx_add_proc(ompi_communicator_t *comm, int dst)
214218
{
219+
ucp_ep_params_t ep_params;
215220
ucp_address_t *address;
216221
ucs_status_t status;
217222
size_t addrlen;
@@ -235,7 +240,11 @@ ucp_ep_h mca_pml_ucx_add_proc(ompi_communicator_t *comm, int dst)
235240
}
236241

237242
PML_UCX_VERBOSE(2, "connecting to proc. %d", proc_peer->super.proc_name.vpid);
238-
status = ucp_ep_create(ompi_pml_ucx.ucp_worker, address, &ep);
243+
244+
ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS;
245+
ep_params.address = address;
246+
247+
status = ucp_ep_create(ompi_pml_ucx.ucp_worker, &ep_params, &ep);
239248
free(address);
240249
if (UCS_OK != status) {
241250
PML_UCX_ERROR("Failed to connect to proc: %d, %s", proc_peer->super.proc_name.vpid,
@@ -250,6 +259,7 @@ ucp_ep_h mca_pml_ucx_add_proc(ompi_communicator_t *comm, int dst)
250259

251260
int mca_pml_ucx_add_procs(struct ompi_proc_t **procs, size_t nprocs)
252261
{
262+
ucp_ep_params_t ep_params;
253263
ucp_address_t *address;
254264
ucs_status_t status;
255265
size_t addrlen;
@@ -276,7 +286,11 @@ int mca_pml_ucx_add_procs(struct ompi_proc_t **procs, size_t nprocs)
276286
}
277287

278288
PML_UCX_VERBOSE(2, "connecting to proc. %d", procs[i]->super.proc_name.vpid);
279-
status = ucp_ep_create(ompi_pml_ucx.ucp_worker, address, &ep);
289+
290+
ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS;
291+
ep_params.address = address;
292+
293+
status = ucp_ep_create(ompi_pml_ucx.ucp_worker, &ep_params, &ep);
280294
free(address);
281295

282296
if (UCS_OK != status) {

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs)
184184
size_t wk_addr_len;
185185
int *wk_roffs, *wk_rsizes;
186186
char *wk_raddrs;
187+
ucp_ep_params_t ep_params;
187188

188189

189190
mca_spml_ucx.ucp_peers = (ucp_peer_t *) calloc(nprocs, sizeof(*(mca_spml_ucx.ucp_peers)));
@@ -210,9 +211,13 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs)
210211
i = (my_rank + n) % nprocs;
211212
//if (i == my_rank) continue;
212213
dump_address(i, (char *)(wk_raddrs + wk_roffs[i]), wk_rsizes[i]);
214+
215+
ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS;
216+
ep_params.address = (ucp_address_t *)(wk_raddrs + wk_roffs[i]);
217+
213218
err = ucp_ep_create(mca_spml_ucx.ucp_worker,
214-
(ucp_address_t *)(wk_raddrs + wk_roffs[i]),
215-
&mca_spml_ucx.ucp_peers[i].ucp_conn);
219+
&ep_params,
220+
&mca_spml_ucx.ucp_peers[i].ucp_conn);
216221
if (UCS_OK != err) {
217222
SPML_ERROR("ucp_ep_create failed!!!\n");
218223
goto error2;
@@ -298,6 +303,8 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
298303
ucs_status_t err;
299304
spml_ucx_mkey_t *ucx_mkey;
300305
size_t len;
306+
int my_pe = oshmem_my_proc_id();
307+
ucp_mem_map_params_t mem_map_params;
301308

302309
*count = 0;
303310
mkeys = (sshmem_mkey_t *) calloc(1, sizeof(*mkeys));
@@ -311,8 +318,13 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
311318
}
312319

313320
mkeys[0].spml_context = ucx_mkey;
314-
err = ucp_mem_map(mca_spml_ucx.ucp_context,
315-
&addr, size, 0, &ucx_mkey->mem_h);
321+
322+
mem_map_params.field_mask = UCP_MEM_MAP_PARAM_FIELD_ADDRESS |
323+
UCP_MEM_MAP_PARAM_FIELD_LENGTH;
324+
mem_map_params.address = addr;
325+
mem_map_params.length = size;
326+
327+
err = ucp_mem_map(mca_spml_ucx.ucp_context, &mem_map_params, &ucx_mkey->mem_h);
316328
if (UCS_OK != err) {
317329
goto error_out1;
318330
}
@@ -338,7 +350,7 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
338350
}
339351

340352
mkeys[0].len = len;
341-
mkeys[0].va_base = addr;
353+
mkeys[0].va_base = mem_map_params.address;
342354
*count = 1;
343355
return mkeys;
344356

oshmem/mca/spml/ucx/spml_ucx_component.c

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

138138
static int spml_ucx_init(void)
139139
{
140+
ucp_worker_params_t params;
140141
ucs_status_t err;
141142

142-
err = ucp_worker_create(mca_spml_ucx.ucp_context, UCS_THREAD_MODE_SINGLE,
143+
params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE;
144+
params.thread_mode = UCS_THREAD_MODE_SINGLE;
145+
146+
err = ucp_worker_create(mca_spml_ucx.ucp_context, &params,
143147
&mca_spml_ucx.ucp_worker);
144148
if (UCS_OK != err) {
145149
return OSHMEM_ERROR;

0 commit comments

Comments
 (0)