From 4513440df9cb5bd852cbee639ba9e4878ab8f2f3 Mon Sep 17 00:00:00 2001 From: Josh Hursey Date: Tue, 9 Feb 2010 00:31:24 +0000 Subject: [PATCH] The ordering of the appfile matters. The ranks must be in increasing rank order, so that they get assigned the same ORTE name on restart. cmr:v1.4.2 cmr:v1.5 This commit was SVN r22586. --- orte/tools/orte-restart/orte-restart.c | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/orte/tools/orte-restart/orte-restart.c b/orte/tools/orte-restart/orte-restart.c index fd286d532e..c33f711aeb 100644 --- a/orte/tools/orte-restart/orte-restart.c +++ b/orte/tools/orte-restart/orte-restart.c @@ -78,6 +78,8 @@ static int check_file(orte_snapc_base_global_snapshot_t *snapshot); static int create_appfile(orte_snapc_base_global_snapshot_t *snapshot); static int spawn_children(orte_snapc_base_global_snapshot_t *snapshot, pid_t *child_pid); static int snapshot_info(orte_snapc_base_global_snapshot_t *snapshot); +static int snapshot_sort_compare_fn(opal_list_item_t **a, + opal_list_item_t **b); /***************************************** * Global Vars for Command line Arguments @@ -495,6 +497,14 @@ static int create_appfile(orte_snapc_base_global_snapshot_t *snapshot) goto cleanup; } + /* + * Sort the snapshots so that they are in order + */ + opal_list_sort(&snapshot->local_snapshots, snapshot_sort_compare_fn); + + /* + * Construct the appfile + */ for(item = opal_list_get_first(&snapshot->local_snapshots); item != opal_list_get_end(&snapshot->local_snapshots); item = opal_list_get_next(item) ) { @@ -732,3 +742,22 @@ int snapshot_info(orte_snapc_base_global_snapshot_t *snapshot) cleanup: return exit_status; } + +static int snapshot_sort_compare_fn(opal_list_item_t **a, + opal_list_item_t **b) +{ + orte_snapc_base_local_snapshot_t *snap_a, *snap_b; + + snap_a = (orte_snapc_base_local_snapshot_t*)(*a); + snap_b = (orte_snapc_base_local_snapshot_t*)(*b); + + if( snap_a->process_name.vpid > snap_b->process_name.vpid ) { + return 1; + } + else if( snap_a->process_name.vpid == snap_b->process_name.vpid ) { + return 0; + } + else { + return -1; + } +}