|
12 | 12 | * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. |
13 | 13 | * Copyright (c) 2011-2012 Los Alamos National Security, LLC. |
14 | 14 | * All rights reserved. |
15 | | - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. |
| 15 | + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. |
16 | 16 | * Copyright (c) 2016 IBM Corporation. All rights reserved. |
17 | 17 | * $COPYRIGHT$ |
18 | 18 | * |
@@ -210,18 +210,17 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr |
210 | 210 | return ORTE_ERR_SILENT; |
211 | 211 | } |
212 | 212 | /* find the nodes in our node array and assemble them |
213 | | - * in daemon order if the vm was launched |
| 213 | + * in list order as that is what the user specified |
214 | 214 | */ |
215 | | - for (i=0; i < orte_node_pool->size; i++) { |
216 | | - nd = NULL; |
217 | | - if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(orte_node_pool, i))) { |
218 | | - continue; |
219 | | - } |
220 | | - /* ignore nodes that are non-usable */ |
221 | | - if (ORTE_FLAG_TEST(node, ORTE_NODE_NON_USABLE)) { |
222 | | - continue; |
223 | | - } |
224 | | - OPAL_LIST_FOREACH_SAFE(nptr, next, &nodes, orte_node_t) { |
| 215 | + OPAL_LIST_FOREACH_SAFE(nptr, next, &nodes, orte_node_t) { |
| 216 | + for (i=0; i < orte_node_pool->size; i++) { |
| 217 | + if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(orte_node_pool, i))) { |
| 218 | + continue; |
| 219 | + } |
| 220 | + /* ignore nodes that are non-usable */ |
| 221 | + if (ORTE_FLAG_TEST(node, ORTE_NODE_NON_USABLE)) { |
| 222 | + continue; |
| 223 | + } |
225 | 224 | if (0 != strcmp(node->name, nptr->name)) { |
226 | 225 | OPAL_OUTPUT_VERBOSE((10, orte_rmaps_base_framework.framework_output, |
227 | 226 | "NODE %s DOESNT MATCH NODE %s", |
@@ -266,37 +265,14 @@ int orte_rmaps_base_get_target_nodes(opal_list_t *allocated_nodes, orte_std_cntr |
266 | 265 | */ |
267 | 266 | ORTE_FLAG_UNSET(node, ORTE_NODE_FLAG_MAPPED); |
268 | 267 | } |
269 | | - if (NULL == nd || NULL == nd->daemon || |
270 | | - NULL == node->daemon || |
271 | | - nd->daemon->name.vpid < node->daemon->name.vpid) { |
272 | | - /* just append to end */ |
273 | | - opal_list_append(allocated_nodes, &node->super); |
274 | | - nd = node; |
275 | | - } else { |
276 | | - /* starting from end, put this node in daemon-vpid order */ |
277 | | - while (node->daemon->name.vpid < nd->daemon->name.vpid) { |
278 | | - if (opal_list_get_begin(allocated_nodes) == opal_list_get_prev(&nd->super)) { |
279 | | - /* insert at beginning */ |
280 | | - opal_list_prepend(allocated_nodes, &node->super); |
281 | | - goto moveon1; |
282 | | - } |
283 | | - nd = (orte_node_t*)opal_list_get_prev(&nd->super); |
284 | | - } |
285 | | - item = opal_list_get_next(&nd->super); |
286 | | - if (item == opal_list_get_end(allocated_nodes)) { |
287 | | - /* we are at the end - just append */ |
288 | | - opal_list_append(allocated_nodes, &node->super); |
289 | | - } else { |
290 | | - nd = (orte_node_t*)item; |
291 | | - opal_list_insert_pos(allocated_nodes, item, &node->super); |
292 | | - } |
293 | | - moveon1: |
294 | | - /* reset us back to the end for the next node */ |
295 | | - nd = (orte_node_t*)opal_list_get_last(allocated_nodes); |
296 | | - } |
297 | | - opal_list_remove_item(&nodes, (opal_list_item_t*)nptr); |
298 | | - OBJ_RELEASE(nptr); |
| 268 | + /* the list is ordered as per user direction using -host |
| 269 | + * or the listing in -hostfile - preserve that ordering */ |
| 270 | + opal_list_append(allocated_nodes, &node->super); |
| 271 | + break; |
299 | 272 | } |
| 273 | + /* remove the item from the list as we have allocated it */ |
| 274 | + opal_list_remove_item(&nodes, (opal_list_item_t*)nptr); |
| 275 | + OBJ_RELEASE(nptr); |
300 | 276 | } |
301 | 277 | OBJ_DESTRUCT(&nodes); |
302 | 278 | /* now prune for usage and compute total slots */ |
|
0 commit comments