@@ -106,8 +106,7 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
106
106
pmix_proc_t * procs , pxproc ;
107
107
size_t nprocs , n ;
108
108
pmix_status_t pret ;
109
- opal_namelist_t * nm ;
110
- opal_jobid_t jobid ;
109
+ opal_proclist_t * plt ;
111
110
112
111
ompi_communicator_t * newcomp = MPI_COMM_NULL ;
113
112
ompi_proc_t * proc ;
@@ -131,24 +130,14 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
131
130
* procs is used to complete construction of the intercommunicator. */
132
131
133
132
/* everyone constructs the list of members from their communicator */
133
+ pname .jobid = OMPI_PROC_MY_NAME -> jobid ;
134
+ pname .vpid = OPAL_VPID_WILDCARD ;
134
135
if (MPI_COMM_WORLD == comm ) {
135
- pname .jobid = OMPI_PROC_MY_NAME -> jobid ;
136
- pname .vpid = OPAL_VPID_WILDCARD ;
137
- rc = opal_convert_process_name_to_string (& nstring , & pname );
138
- if (OPAL_SUCCESS != rc ) {
139
- return OMPI_ERROR ;
140
- }
136
+ PMIX_LOAD_PROCID (& pxproc , ompi_process_info .myprocid .nspace , PMIX_RANK_WILDCARD );
137
+ OPAL_PMIX_CONVERT_PROCT_TO_STRING (& nstring , & pxproc );
141
138
opal_argv_append_nosize (& members , nstring );
142
139
free (nstring );
143
- /* have to add the number of procs in the job so the remote side
144
- * can correctly add the procs by computing their names, and our nspace
145
- * so they can update their records */
146
- nstring = opal_jobid_print (pname .jobid );
147
- if (NULL == nstring ) {
148
- opal_argv_free (members );
149
- return OMPI_ERROR ;
150
- }
151
- opal_argv_append_nosize (& members , nstring );
140
+ /* add the number of procs in this job */
152
141
(void )opal_asprintf (& nstring , "%d" , size );
153
142
opal_argv_append_nosize (& members , nstring );
154
143
free (nstring );
@@ -176,22 +165,10 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
176
165
} else {
177
166
proc_name = proc_list [i ]-> super .proc_name ;
178
167
}
179
- rc = opal_convert_process_name_to_string (& nstring , & proc_name );
180
- if (OPAL_SUCCESS != rc ) {
181
- if (!dense ) {
182
- free (proc_list );
183
- proc_list = NULL ;
184
- }
185
- return OMPI_ERROR ;
186
- }
168
+ OPAL_PMIX_CONVERT_NAME (& pxproc , & proc_name );
169
+ OPAL_PMIX_CONVERT_PROCT_TO_STRING (& nstring , & pxproc );
187
170
opal_argv_append_nosize (& members , nstring );
188
171
free (nstring );
189
- nstring = opal_jobid_print (pname .jobid );
190
- if (OPAL_SUCCESS != rc ) {
191
- opal_argv_free (members );
192
- return OMPI_ERROR ;
193
- }
194
- opal_argv_append_nosize (& members , nstring );
195
172
}
196
173
if (!dense ) {
197
174
free (proc_list );
@@ -260,64 +237,18 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
260
237
* starting with our own members */
261
238
OBJ_CONSTRUCT (& mlist , opal_list_t );
262
239
for (i = 0 ; NULL != members [i ]; i ++ ) {
263
- nm = OBJ_NEW (opal_namelist_t );
264
- if (OPAL_SUCCESS != (rc = opal_convert_string_to_process_name (& nm -> name , members [i ]))) {
265
- OMPI_ERROR_LOG (rc );
266
- opal_argv_free (members );
267
- free (rport );
268
- OPAL_LIST_DESTRUCT (& mlist );
269
- goto exit ;
270
- }
271
- /* step over the nspace */
272
- ++ i ;
273
- if (NULL == members [i ]) {
274
- /* this shouldn't happen and is an error */
275
- OMPI_ERROR_LOG (OMPI_ERR_BAD_PARAM );
276
- OPAL_LIST_DESTRUCT (& mlist );
277
- opal_argv_free (members );
278
- free (rport );
279
- rc = OMPI_ERR_BAD_PARAM ;
280
- goto exit ;
281
- }
282
- /* if the rank is wildcard, then we need to add all procs
283
- * in that job to the list */
284
- if (OPAL_VPID_WILDCARD == nm -> name .vpid ) {
285
- jobid = nm -> name .jobid ;
286
- OBJ_RELEASE (nm );
287
- for (k = 0 ; k < size ; k ++ ) {
288
- nm = OBJ_NEW (opal_namelist_t );
289
- nm -> name .jobid = jobid ;
290
- nm -> name .vpid = k ;
291
- opal_list_append (& mlist , & nm -> super );
292
- }
293
- /* now step over the size */
294
- if (NULL == members [i + 1 ]) {
295
- /* this shouldn't happen and is an error */
296
- OMPI_ERROR_LOG (OMPI_ERR_BAD_PARAM );
297
- OPAL_LIST_DESTRUCT (& mlist );
298
- opal_argv_free (members );
299
- free (rport );
300
- rc = OMPI_ERR_BAD_PARAM ;
301
- goto exit ;
302
- }
240
+ OPAL_PMIX_CONVERT_STRING_TO_PROCT (& pxproc , members [i ]);
241
+ plt = OBJ_NEW (opal_proclist_t );
242
+ memcpy (& plt -> procid , & pxproc , sizeof (pmix_proc_t ));
243
+ opal_list_append (& mlist , & plt -> super );
244
+ /* if the rank is wildcard, then we need to skip
245
+ * the next position */
246
+ if (PMIX_RANK_WILDCARD == pxproc .rank ) {
303
247
++ i ;
304
- } else {
305
- opal_list_append (& mlist , & nm -> super );
306
248
}
307
249
}
308
250
opal_argv_free (members );
309
251
members = NULL ;
310
-
311
- /* convert the list of members to a pmix_proc_t array */
312
- nprocs = opal_list_get_size (& mlist );
313
- PMIX_PROC_CREATE (procs , nprocs );
314
- n = 0 ;
315
- OPAL_LIST_FOREACH (nm , & mlist , opal_namelist_t ) {
316
- OPAL_PMIX_CONVERT_NAME (& procs [n ], & nm -> name );
317
- ++ n ;
318
- }
319
- OPAL_LIST_DESTRUCT (& mlist );
320
-
321
252
/* rport contains a colon-delimited list
322
253
* of process names for the remote procs - convert it
323
254
* into an argv array */
@@ -330,29 +261,13 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
330
261
OBJ_CONSTRUCT (& rlist , opal_list_t );
331
262
332
263
for (i = 0 ; NULL != members [i ]; i ++ ) {
333
- nm = OBJ_NEW (opal_namelist_t );
334
- if (OPAL_SUCCESS != (rc = opal_convert_string_to_process_name (& nm -> name , members [i ]))) {
335
- OMPI_ERROR_LOG (rc );
336
- opal_argv_free (members );
337
- OPAL_LIST_DESTRUCT (& ilist );
338
- OPAL_LIST_DESTRUCT (& rlist );
339
- PMIX_PROC_FREE (procs , nprocs );
340
- goto exit ;
341
- }
342
- /* next entry is the nspace - register it */
343
- ++ i ;
344
- if (NULL == members [i ]) {
345
- OMPI_ERROR_LOG (OMPI_ERR_NOT_SUPPORTED );
346
- opal_argv_free (members );
347
- OPAL_LIST_DESTRUCT (& ilist );
348
- OPAL_LIST_DESTRUCT (& rlist );
349
- PMIX_PROC_FREE (procs , nprocs );
350
- goto exit ;
351
- }
352
- if (OPAL_VPID_WILDCARD == nm -> name .vpid ) {
353
- jobid = nm -> name .jobid ;
354
- OBJ_RELEASE (nm );
355
- /* if the vpid is wildcard, then we are including all ranks
264
+ OPAL_PMIX_CONVERT_STRING_TO_PROCT (& pxproc , members [i ]);
265
+ plt = OBJ_NEW (opal_proclist_t );
266
+ memcpy (& plt -> procid , & pxproc , sizeof (pmix_proc_t ));
267
+ opal_list_append (& mlist , & plt -> super );
268
+
269
+ if (PMIX_RANK_WILDCARD == pxproc .rank ) {
270
+ /* if the rank is wildcard, then we are including all ranks
356
271
* of that job, and the next entry in members should be the
357
272
* number of procs in the job */
358
273
if (NULL == members [i + 1 ]) {
@@ -361,19 +276,25 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
361
276
opal_argv_free (members );
362
277
OPAL_LIST_DESTRUCT (& ilist );
363
278
OPAL_LIST_DESTRUCT (& rlist );
279
+ OPAL_LIST_DESTRUCT (& mlist );
364
280
rc = OMPI_ERR_BAD_PARAM ;
365
- PMIX_PROC_FREE (procs , nprocs );
366
281
goto exit ;
367
282
}
368
283
rsize = strtoul (members [i + 1 ], NULL , 10 );
369
284
++ i ;
370
285
for (k = 0 ; k < rsize ; k ++ ) {
371
- nm = OBJ_NEW (opal_namelist_t );
372
- nm -> name .jobid = jobid ;
373
- nm -> name .vpid = k ;
374
- opal_list_append (& mlist , & nm -> super );
286
+ pxproc .rank = k ;
287
+ OPAL_PMIX_CONVERT_PROCT (rc , & pname , & pxproc );
288
+ if (OPAL_SUCCESS != rc ) {
289
+ OMPI_ERROR_LOG (rc );
290
+ opal_argv_free (members );
291
+ OPAL_LIST_DESTRUCT (& ilist );
292
+ OPAL_LIST_DESTRUCT (& rlist );
293
+ OPAL_LIST_DESTRUCT (& mlist );
294
+ goto exit ;
295
+ }
375
296
/* see if this needs to be added to our ompi_proc_t array */
376
- proc = ompi_proc_find_and_add (& nm -> name , & isnew );
297
+ proc = ompi_proc_find_and_add (& pname , & isnew );
377
298
if (isnew ) {
378
299
cd = OBJ_NEW (ompi_dpm_proct_caddy_t );
379
300
cd -> p = proc ;
@@ -385,9 +306,17 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
385
306
opal_list_append (& rlist , & cd -> super );
386
307
}
387
308
} else {
388
- opal_list_append (& mlist , & nm -> super );
309
+ OPAL_PMIX_CONVERT_PROCT (rc , & pname , & pxproc );
310
+ if (OPAL_SUCCESS != rc ) {
311
+ OMPI_ERROR_LOG (rc );
312
+ opal_argv_free (members );
313
+ OPAL_LIST_DESTRUCT (& ilist );
314
+ OPAL_LIST_DESTRUCT (& rlist );
315
+ OPAL_LIST_DESTRUCT (& mlist );
316
+ goto exit ;
317
+ }
389
318
/* see if this needs to be added to our ompi_proc_t array */
390
- proc = ompi_proc_find_and_add (& nm -> name , & isnew );
319
+ proc = ompi_proc_find_and_add (& pname , & isnew );
391
320
if (isnew ) {
392
321
cd = OBJ_NEW (ompi_dpm_proct_caddy_t );
393
322
cd -> p = proc ;
@@ -401,6 +330,16 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
401
330
}
402
331
opal_argv_free (members );
403
332
333
+ /* convert the list of members to a pmix_proc_t array */
334
+ nprocs = opal_list_get_size (& mlist );
335
+ PMIX_PROC_CREATE (procs , nprocs );
336
+ n = 0 ;
337
+ OPAL_LIST_FOREACH (plt , & mlist , opal_proclist_t ) {
338
+ memcpy (& procs [n ], & plt -> procid , sizeof (pmix_proc_t ));
339
+ ++ n ;
340
+ }
341
+ OPAL_LIST_DESTRUCT (& mlist );
342
+
404
343
/* tell the host RTE to connect us - this will download
405
344
* all known data for the nspace's of participating procs
406
345
* so that add_procs will not result in a slew of lookups */
0 commit comments