Commit 9ca7b3cc authored by Pavan Balaji's avatar Pavan Balaji
Browse files

[svn-r9002] The node_id should be assigned when the node list is being created for

consistency.

Reviewed by chan.
parent 53f6efa3
......@@ -409,9 +409,8 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
HYDU_ERR_POP(status, "error create node list\n");
}
else if (!strcmp(info_key, "hostfile")) {
status =
HYDU_parse_hostfile(info_val, &pg->user_node_list,
HYDU_process_mfile_token);
status = HYDU_parse_hostfile(info_val, &pg->user_node_list,
HYDU_process_mfile_token);
HYDU_ERR_POP(status, "error parsing hostfile\n");
}
else {
......@@ -512,10 +511,8 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
if (pg->user_node_list) {
pg->pg_core_count = 0;
for (i = 0, node = pg->user_node_list; node; node = node->next, i++) {
for (i = 0, node = pg->user_node_list; node; node = node->next, i++)
pg->pg_core_count += node->core_count;
node->node_id = i;
}
}
else {
pg->pg_core_count = 0;
......
......@@ -590,9 +590,8 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
HYDU_ERR_POP(status, "error create node list\n");
}
else if (!strcmp(info_key, "hostfile")) {
status =
HYDU_parse_hostfile(info_val, &pg->user_node_list,
HYDU_process_mfile_token);
status = HYDU_parse_hostfile(info_val, &pg->user_node_list,
HYDU_process_mfile_token);
HYDU_ERR_POP(status, "error parsing hostfile\n");
}
else {
......@@ -692,10 +691,8 @@ static HYD_status fn_spawn(int fd, int pid, int pgid, char *args[])
if (pg->user_node_list) {
pg->pg_core_count = 0;
for (i = 0, node = pg->user_node_list; node; node = node->next, i++) {
for (i = 0, node = pg->user_node_list; node; node = node->next, i++)
pg->pg_core_count += node->core_count;
node->node_id = i;
}
}
else {
pg->pg_core_count = 0;
......
......@@ -316,6 +316,10 @@ int main(int argc, char **argv)
}
if (reset_rmk) {
/* Reassign node IDs to each node */
for (node = HYD_server_info.node_list, i = 0; node; node = node->next, i++)
node->node_id = i;
/* Reinitialize the bootstrap server with the "user" RMK, so
* it knows that we are not using the node list provided by
* the RMK */
......@@ -327,10 +331,6 @@ int main(int argc, char **argv)
HYDU_ERR_POP(status, "unable to reinitialize the bootstrap server\n");
}
/* Assign a node ID to each node */
for (node = HYD_server_info.node_list, i = 0; node; node = node->next, i++)
node->node_id = i;
/* If the number of processes is not given, we allocate all the
* available nodes to each executable */
HYD_server_info.pg_list.pg_process_count = 0;
......
......@@ -32,6 +32,7 @@ HYD_status HYDU_add_to_node_list(const char *hostname, int num_procs,
(*node_list)->hostname = HYDU_strdup(hostname);
(*node_list)->core_count = num_procs;
(*node_list)->node_id = 0;
}
else {
for (node = *node_list; node->next; node = node->next);
......@@ -41,6 +42,8 @@ HYD_status HYDU_add_to_node_list(const char *hostname, int num_procs,
status = HYDU_alloc_node(&node->next);
HYDU_ERR_POP(status, "unable to allocate node\n");
node->next->node_id = node->node_id + 1;
node = node->next;
node->hostname = HYDU_strdup(hostname);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment