@@ -131,7 +131,7 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *buffer,
131131 /* if we couldn't provide the allocation regex on the orted
132132 * cmd line, then we need to provide all the info here */
133133 if (!orte_nidmap_communicated ) {
134- if (ORTE_SUCCESS != (rc = orte_util_nidmap_create (& nidmap ))) {
134+ if (ORTE_SUCCESS != (rc = orte_util_nidmap_create (orte_node_pool , & nidmap ))) {
135135 ORTE_ERROR_LOG (rc );
136136 return rc ;
137137 }
@@ -246,6 +246,22 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *buffer,
246246 return rc ;
247247 }
248248
249+ if (!orte_get_attribute (& jdata -> attributes , ORTE_JOB_FULLY_DESCRIBED , NULL , OPAL_BOOL )) {
250+ /* compute and pack the ppn regex */
251+ if (ORTE_SUCCESS != (rc = orte_util_nidmap_generate_ppn (jdata , & nidmap ))) {
252+ ORTE_ERROR_LOG (rc );
253+ return rc ;
254+ }
255+ if (ORTE_SUCCESS != (rc = opal_dss .pack (buffer , & nidmap , 1 , OPAL_STRING ))) {
256+ ORTE_ERROR_LOG (rc );
257+ free (nidmap );
258+ return rc ;
259+ }
260+ free (nidmap );
261+ }
262+
263+ /* compute and pack the regex of ppn */
264+
249265 return ORTE_SUCCESS ;
250266}
251267
@@ -262,13 +278,12 @@ int orte_odls_base_default_construct_child_list(opal_buffer_t *buffer,
262278 int rc ;
263279 orte_std_cntr_t cnt ;
264280 orte_job_t * jdata = NULL , * daemons ;
265- int32_t n , k , m ;
281+ int32_t n , k ;
266282 opal_buffer_t * bptr ;
267- orte_node_t * node ;
268283 orte_proc_t * pptr , * dmn ;
269284 orte_app_context_t * app ;
270- bool newmap = false;
271285 int8_t flag ;
286+ char * ppn ;
272287
273288 OPAL_OUTPUT_VERBOSE ((5 , orte_odls_base_framework .framework_output ,
274289 "%s odls:constructing child list" ,
@@ -356,33 +371,73 @@ int orte_odls_base_default_construct_child_list(opal_buffer_t *buffer,
356371 * the storage */
357372 jdata -> jobid = ORTE_JOBID_INVALID ;
358373 OBJ_RELEASE (jdata );
359- /* get the correct job object */
374+ /* get the correct job object - it will be completely filled out */
360375 if (NULL == (jdata = orte_get_job_data_object (* job ))) {
361376 ORTE_ERROR_LOG (ORTE_ERR_NOT_FOUND );
362377 rc = ORTE_ERR_NOT_FOUND ;
363378 goto REPORT_ERROR ;
364379 }
365380 } else {
366381 opal_hash_table_set_value_uint32 (orte_job_data , jdata -> jobid , jdata );
367- }
368382
369- /* ensure the map object is present */
370- if (NULL == jdata -> map ) {
371- jdata -> map = OBJ_NEW (orte_job_map_t );
372- newmap = true;
383+ /* ensure the map object is present */
384+ if (NULL == jdata -> map ) {
385+ jdata -> map = OBJ_NEW (orte_job_map_t );
386+ }
373387 }
374388
375- if (orte_no_vm ) {
376- /* if we are operating novm, then mpirun will have sent us
377- * the complete array of procs - process it */
378- for (n = 0 ; n < jdata -> procs -> size ; n ++ ) {
379- if (NULL == (pptr = (orte_proc_t * )opal_pointer_array_get_item (jdata -> procs , n ))) {
380- continue ;
389+ /* if the job is fully described, then mpirun will have computed
390+ * and sent us the complete array of procs in the orte_job_t, so we
391+ * don't need to do anything more here */
392+ if (!orte_get_attribute (& jdata -> attributes , ORTE_JOB_FULLY_DESCRIBED , NULL , OPAL_BOOL )) {
393+ if (!ORTE_PROC_IS_HNP ) {
394+ /* extract the ppn regex */
395+ cnt = 1 ;
396+ if (OPAL_SUCCESS != (rc = opal_dss .unpack (buffer , & ppn , & cnt , OPAL_STRING ))) {
397+ ORTE_ERROR_LOG (rc );
398+ goto REPORT_ERROR ;
381399 }
382- if (ORTE_PROC_STATE_UNDEF == pptr -> state ) {
383- /* not ready for use yet */
384- continue ;
400+ /* populate the node array of the job map and the proc array of
401+ * the job object so we know how many procs are on each node */
402+ if (ORTE_SUCCESS != (rc = orte_util_nidmap_parse_ppn (jdata , ppn ))) {
403+ ORTE_ERROR_LOG (rc );
404+ free (ppn );
405+ goto REPORT_ERROR ;
406+ }
407+ free (ppn );
408+ /* now assign locations to the procs */
409+ if (ORTE_SUCCESS != (rc = orte_rmaps_base_assign_locations (jdata ))) {
410+ ORTE_ERROR_LOG (rc );
411+ goto REPORT_ERROR ;
385412 }
413+ }
414+ /* compute the ranks and add the proc objects
415+ * to the jdata->procs array */
416+ if (ORTE_SUCCESS != (rc = orte_rmaps_base_compute_vpids (jdata ))) {
417+ ORTE_ERROR_LOG (rc );
418+ goto REPORT_ERROR ;
419+ }
420+ /* and finally, compute the local and node ranks */
421+ if (ORTE_SUCCESS != (rc = orte_rmaps_base_compute_local_ranks (jdata ))) {
422+ ORTE_ERROR_LOG (rc );
423+ goto REPORT_ERROR ;
424+ }
425+ }
426+
427+ /* now that the node array in the job map and jdata are completely filled out,.
428+ * we need to "wireup" the procs to their nodes so other utilities can
429+ * locate them */
430+ for (n = 0 ; n < jdata -> procs -> size ; n ++ ) {
431+ if (NULL == (pptr = (orte_proc_t * )opal_pointer_array_get_item (jdata -> procs , n ))) {
432+ continue ;
433+ }
434+ if (ORTE_PROC_STATE_UNDEF == pptr -> state ) {
435+ /* not ready for use yet */
436+ continue ;
437+ }
438+ if (!orte_get_attribute (& jdata -> attributes , ORTE_JOB_FULLY_DESCRIBED , NULL , OPAL_BOOL )) {
439+ /* the parser will have already made the connection, but the fully described
440+ * case won't have done it, so connect the proc to its node here */
386441 opal_output_verbose (5 , orte_odls_base_framework .framework_output ,
387442 "%s GETTING DAEMON FOR PROC %s WITH PARENT %s" ,
388443 ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ),
@@ -401,100 +456,44 @@ int orte_odls_base_default_construct_child_list(opal_buffer_t *buffer,
401456 }
402457 OBJ_RETAIN (dmn -> node );
403458 pptr -> node = dmn -> node ;
404- /* add proc to node - note that num_procs for the
405- * node was already correctly unpacked, so don't
406- * increment it here */
407- OBJ_RETAIN (pptr );
408- opal_pointer_array_add (dmn -> node -> procs , pptr );
409-
410- /* add the node to the map, if not already there */
411- if (!ORTE_FLAG_TEST (dmn -> node , ORTE_NODE_FLAG_MAPPED )) {
412- OBJ_RETAIN (dmn -> node );
413- ORTE_FLAG_SET (dmn -> node , ORTE_NODE_FLAG_MAPPED );
414- opal_pointer_array_add (jdata -> map -> nodes , dmn -> node );
415- if (newmap ) {
416- jdata -> map -> num_nodes ++ ;
417- }
418- }
419-
420- /* see if it belongs to us */
421- if (pptr -> parent == ORTE_PROC_MY_NAME -> vpid ) {
422- /* is this child on our current list of children */
423- if (!ORTE_FLAG_TEST (pptr , ORTE_PROC_FLAG_LOCAL )) {
424- /* not on the local list */
425- OPAL_OUTPUT_VERBOSE ((5 , orte_odls_base_framework .framework_output ,
426- "%s[%s:%d] adding proc %s to my local list" ,
427- ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ),
428- __FILE__ , __LINE__ ,
429- ORTE_NAME_PRINT (& pptr -> name )));
430- /* keep tabs of the number of local procs */
431- jdata -> num_local_procs ++ ;
432- /* add this proc to our child list */
433- OBJ_RETAIN (pptr );
434- ORTE_FLAG_SET (pptr , ORTE_PROC_FLAG_LOCAL );
435- opal_pointer_array_add (orte_local_children , pptr );
436- }
437-
438- /* if the job is in restart mode, the child must not barrier when launched */
439- if (ORTE_FLAG_TEST (jdata , ORTE_JOB_FLAG_RESTART )) {
440- orte_set_attribute (& pptr -> attributes , ORTE_PROC_NOBARRIER , ORTE_ATTR_LOCAL , NULL , OPAL_BOOL );
441- }
442- /* mark that this app_context is being used on this node */
443- app = (orte_app_context_t * )opal_pointer_array_get_item (jdata -> apps , pptr -> app_idx );
444- ORTE_FLAG_SET (app , ORTE_APP_FLAG_USED_ON_NODE );
445- }
446- }
447- } else {
448- /* create the map - will already have been done for the novm case */
449- if (ORTE_SUCCESS != (rc = orte_rmaps_base_map_job (jdata ))) {
450- ORTE_ERROR_LOG (rc );
451- goto REPORT_ERROR ;
452459 }
453- /* find our local procs */
454- for (n = 0 ; n < jdata -> map -> nodes -> size ; n ++ ) {
455- if (NULL == (node = (orte_node_t * )opal_pointer_array_get_item (jdata -> map -> nodes , n ))) {
456- continue ;
457- }
458- if (node -> index != (int )ORTE_PROC_MY_NAME -> vpid ) {
459- continue ;
460+ /* see if it belongs to us */
461+ if (pptr -> parent == ORTE_PROC_MY_NAME -> vpid ) {
462+ /* is this child on our current list of children */
463+ if (!ORTE_FLAG_TEST (pptr , ORTE_PROC_FLAG_LOCAL )) {
464+ /* not on the local list */
465+ OPAL_OUTPUT_VERBOSE ((5 , orte_odls_base_framework .framework_output ,
466+ "%s[%s:%d] adding proc %s to my local list" ,
467+ ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ),
468+ __FILE__ , __LINE__ ,
469+ ORTE_NAME_PRINT (& pptr -> name )));
470+ /* keep tabs of the number of local procs */
471+ jdata -> num_local_procs ++ ;
472+ /* add this proc to our child list */
473+ OBJ_RETAIN (pptr );
474+ ORTE_FLAG_SET (pptr , ORTE_PROC_FLAG_LOCAL );
475+ opal_pointer_array_add (orte_local_children , pptr );
460476 }
461- for (m = 0 ; m < node -> procs -> size ; m ++ ) {
462- if (NULL == (pptr = (orte_proc_t * )opal_pointer_array_get_item (node -> procs , m ))) {
463- continue ;
464- }
465- if (!ORTE_FLAG_TEST (pptr , ORTE_PROC_FLAG_LOCAL )) {
466- /* not on the local list */
467- OPAL_OUTPUT_VERBOSE ((5 , orte_odls_base_framework .framework_output ,
468- "%s[%s:%d] adding proc %s to my local list" ,
469- ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ),
470- __FILE__ , __LINE__ ,
471- ORTE_NAME_PRINT (& pptr -> name )));
472- /* keep tabs of the number of local procs */
473- jdata -> num_local_procs ++ ;
474- /* add this proc to our child list */
475- OBJ_RETAIN (pptr );
476- ORTE_FLAG_SET (pptr , ORTE_PROC_FLAG_LOCAL );
477- opal_pointer_array_add (orte_local_children , pptr );
478- /* mark that this app_context is being used on this node */
479- app = (orte_app_context_t * )opal_pointer_array_get_item (jdata -> apps , pptr -> app_idx );
480- ORTE_FLAG_SET (app , ORTE_APP_FLAG_USED_ON_NODE );
481- }
477+
478+ /* if the job is in restart mode, the child must not barrier when launched */
479+ if (ORTE_FLAG_TEST (jdata , ORTE_JOB_FLAG_RESTART )) {
480+ orte_set_attribute (& pptr -> attributes , ORTE_PROC_NOBARRIER , ORTE_ATTR_LOCAL , NULL , OPAL_BOOL );
482481 }
482+ /* mark that this app_context is being used on this node */
483+ app = (orte_app_context_t * )opal_pointer_array_get_item (jdata -> apps , pptr -> app_idx );
484+ ORTE_FLAG_SET (app , ORTE_APP_FLAG_USED_ON_NODE );
483485 }
486+ }
487+
488+ if (!ORTE_PROC_IS_HNP &&
489+ !orte_get_attribute (& jdata -> attributes , ORTE_JOB_FULLY_DESCRIBED , NULL , OPAL_BOOL )) {
484490 /* compute and save bindings of local children */
485491 if (ORTE_SUCCESS != (rc = orte_rmaps_base_compute_bindings (jdata ))) {
486492 ORTE_ERROR_LOG (rc );
487493 goto REPORT_ERROR ;
488494 }
489495 }
490496
491- /* reset any node map flags we used so the next job will start clean */
492- for (n = 0 ; n < jdata -> map -> nodes -> size ; n ++ ) {
493- if (NULL != (node = (orte_node_t * )opal_pointer_array_get_item (jdata -> map -> nodes , n ))) {
494- ORTE_FLAG_UNSET (node , ORTE_NODE_FLAG_MAPPED );
495- }
496- }
497-
498497 /* if we wanted to see the map, now is the time to display it */
499498 if (jdata -> map -> display_map ) {
500499 orte_rmaps_base_display_map (jdata );
0 commit comments