Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions orte/tools/orte-ps/orte-ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ static int pretty_print_vpids(orte_job_t *job) {
char *snap_ref = NULL;
char *snap_loc = NULL;
#endif
char *nodename;
char **nodename;

/*
* Caculate segment lengths
Expand All @@ -672,6 +672,7 @@ static int pretty_print_vpids(orte_job_t *job) {
len_ckpt_l = -3;
#endif

nodename = (char **) malloc(job->num_procs * sizeof(char *));
for(v=0; v < job->num_procs; v++) {
char *rankstr;
vpid = (orte_proc_t*)job->procs->addr[v];
Expand Down Expand Up @@ -707,10 +708,10 @@ static int pretty_print_vpids(orte_job_t *job) {
len_rank = strlen(rankstr);
free(rankstr);

nodename = NULL;
if( orte_get_attribute(&vpid->attributes, ORTE_PROC_NODENAME, (void**)&nodename, OPAL_STRING) &&
(int)strlen(nodename) > len_node) {
len_node = strlen(nodename);
nodename[v] = NULL;
if( orte_get_attribute(&vpid->attributes, ORTE_PROC_NODENAME, (void**)&nodename[v], OPAL_STRING) &&
(int)strlen(nodename[v]) > len_node) {
len_node = strlen(nodename[v]);
} else if ((int)strlen("Unknown") > len_node) {
len_node = strlen("Unknown");
}
Expand Down Expand Up @@ -793,12 +794,12 @@ static int pretty_print_vpids(orte_job_t *job) {
printf("%*s | ", len_o_proc_name, o_proc_name);
printf("%*u | ", len_rank , (uint)vpid->local_rank);
printf("%*d | ", len_pid , vpid->pid);
printf("%*s | ", len_node , (NULL == nodename) ? "Unknown" : nodename);
if (NULL != nodename) {
free(nodename);
}
printf("%*s | ", len_node , (NULL == nodename[v]) ? "Unknown" : nodename[v]);
printf("%*s | ", len_state , orte_proc_state_to_str(vpid->state));

if (NULL != nodename[v]) {
free(nodename[v]);
}
#if OPAL_ENABLE_FT_CR == 1
printf("%*s | ", len_ckpt_s, state_str);
printf("%*s | ", len_ckpt_r, (NULL == snap_ref ? "" : snap_ref));
Expand Down