int main(int argc, char *argv[]) { int ret, exit_status = ORTE_SUCCESS; orte_ps_mpirun_info_t hnpinfo; /*************** * Initialize ***************/ if (ORTE_SUCCESS != (ret = orte_ps_init(argc, argv))) { exit_status = ret; goto cleanup; } /* gather info from the scheduler */ opal_output_verbose(10, orte_ps_globals.output, "orte_ps: Gathering Information"); OBJ_CONSTRUCT(&hnpinfo, orte_ps_mpirun_info_t); if (ORTE_SUCCESS == (ret = gather_information(&hnpinfo))) { /* Print the information */ if (orte_ps_globals.parseable) { if (ORTE_SUCCESS != (ret = parseable_print(&hnpinfo))) { exit_status = ret; } } else { if(ORTE_SUCCESS != (ret = pretty_print(&hnpinfo)) ) { exit_status = ret; } } } else { /* this could be due to a stale session directory - if so, * just skip this entry, but don't abort */ if (ORTE_ERR_SILENT != ret) { orte_show_help("help-orte-ps.txt", "stale-hnp", true); } } cleanup: /*************** * Cleanup ***************/ orcm_finalize(); return exit_status; }
int main(int argc, char *argv[]) { int ret, exit_status = ORTE_SUCCESS; opal_list_t hnp_list; opal_list_item_t* item = NULL; orte_ps_mpirun_info_t hnpinfo; bool reported = false; /*************** * Initialize ***************/ OBJ_CONSTRUCT(&hnp_list, opal_list_t); if (ORTE_SUCCESS != (ret = orte_ps_init(argc, argv))) { exit_status = ret; goto cleanup; } /* * Get the directory listing */ opal_output_verbose(10, orte_ps_globals.output, "orte_ps: Acquiring list of HNPs and setting contact info into RML...\n"); if (ORTE_SUCCESS != (ret = orte_list_local_hnps(&hnp_list, true) ) ) { exit_status = ret; goto cleanup; } opal_output_verbose(10, orte_ps_globals.output, "orte_ps: Found %d HNPs\n", (int)opal_list_get_size(&hnp_list)); /* * For each hnp in the listing */ while (NULL != (item = opal_list_remove_first(&hnp_list))) { orte_hnp_contact_t *hnp = (orte_hnp_contact_t*)item; hnpinfo.hnp = hnp; opal_output_verbose(10, orte_ps_globals.output, "orte_ps: Processing HNP %lu\n", (unsigned long)hnpinfo.hnp->pid); if (0 < orte_ps_globals.pid && hnpinfo.hnp->pid != orte_ps_globals.pid) { continue; } /* * Gather the information */ opal_output_verbose(10, orte_ps_globals.output, "orte_ps: Gathering Information for HNP: %s:%d\n", ORTE_NAME_PRINT(&(hnpinfo.hnp->name)), hnpinfo.hnp->pid); if( ORTE_SUCCESS != (ret = gather_information(&hnpinfo)) ) { /* this could be due to a stale session directory - if so, * just skip this entry, but don't abort */ if (!reported && ORTE_ERR_SILENT == ret) { orte_show_help("help-orte-ps.txt", "stale-hnp", true, ORTE_NAME_PRINT(&(hnpinfo.hnp->name))); reported = true; continue; } goto cleanup; } /* Print the information */ if (orte_ps_globals.parseable) { if (ORTE_SUCCESS != (ret = parseable_print(&hnpinfo))) { exit_status = ret; goto cleanup; } } else { if(ORTE_SUCCESS != (ret = pretty_print(&hnpinfo)) ) { exit_status = ret; goto cleanup; } } } /*************** * Cleanup ***************/ cleanup: orte_finalize(); return exit_status; }