This source file includes following definitions.
- rte_init
- rte_finalize
- rte_abort
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 #include "orte_config.h"
  22 #include "orte/constants.h"
  23 #include "opal/hash_string.h"
  24 
  25 #include <sys/types.h>
  26 #include <stdio.h>
  27 #ifdef HAVE_FCNTL_H
  28 #include <fcntl.h>
  29 #endif
  30 #ifdef HAVE_UNISTD_H
  31 #include <unistd.h>
  32 #endif
  33 
  34 #include "opal/runtime/opal_progress_threads.h"
  35 #include "opal/mca/pmix/pmix_types.h"
  36 
  37 #include "orte/util/show_help.h"
  38 #include "orte/mca/plm/base/base.h"
  39 #include "orte/mca/plm/base/plm_private.h"
  40 #include "orte/mca/plm/plm.h"
  41 #include "orte/mca/errmgr/errmgr.h"
  42 #include "orte/util/proc_info.h"
  43 
  44 #include "orte/mca/ess/ess.h"
  45 #include "orte/mca/ess/base/base.h"
  46 #include "orte/mca/ess/tool/ess_tool.h"
  47 
  48 static int rte_init(void);
  49 static void rte_abort(int status, bool report) __opal_attribute_noreturn__;
  50 static int rte_finalize(void);
  51 
  52 
  53 orte_ess_base_module_t orte_ess_tool_module = {
  54     rte_init,
  55     rte_finalize,
  56     rte_abort,
  57     NULL 
  58 };
  59 
  60 static bool progress_thread_running = false;
  61 
  62 static int rte_init(void)
  63 {
  64     int ret;
  65     char *error = NULL;
  66     opal_list_t flags;
  67     opal_value_t *val;
  68 
  69     
  70     if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
  71         error = "orte_ess_base_std_prolog";
  72         goto error;
  73     }
  74 
  75 
  76     
  77 
  78 
  79     if (mca_ess_tool_component.async) {
  80         orte_event_base = opal_progress_thread_init(NULL);
  81         progress_thread_running = true;
  82     }
  83 
  84     
  85     OBJ_CONSTRUCT(&flags, opal_list_t);
  86     if (mca_ess_tool_component.do_not_connect) {
  87         val = OBJ_NEW(opal_value_t);
  88         val->key = strdup(OPAL_PMIX_TOOL_DO_NOT_CONNECT);
  89         val->type = OPAL_BOOL;
  90         val->data.flag = true;
  91         opal_list_append(&flags, &val->super);
  92     } else if (mca_ess_tool_component.system_server_first) {
  93         val = OBJ_NEW(opal_value_t);
  94         val->key = strdup(OPAL_PMIX_CONNECT_SYSTEM_FIRST);
  95         val->type = OPAL_BOOL;
  96         val->data.flag = true;
  97         opal_list_append(&flags, &val->super);
  98     } else if (mca_ess_tool_component.system_server_only) {
  99         val = OBJ_NEW(opal_value_t);
 100         val->key = strdup(OPAL_PMIX_CONNECT_TO_SYSTEM);
 101         val->type = OPAL_BOOL;
 102         val->data.flag = true;
 103         opal_list_append(&flags, &val->super);
 104     }
 105     if (0 < mca_ess_tool_component.wait_to_connect) {
 106         val = OBJ_NEW(opal_value_t);
 107         val->key = strdup(OPAL_PMIX_CONNECT_RETRY_DELAY);
 108         val->type = OPAL_UINT32;
 109         val->data.uint32 = mca_ess_tool_component.wait_to_connect;
 110         opal_list_append(&flags, &val->super);
 111     }
 112     if (0 < mca_ess_tool_component.num_retries) {
 113         val = OBJ_NEW(opal_value_t);
 114         val->key = strdup(OPAL_PMIX_CONNECT_MAX_RETRIES);
 115         val->type = OPAL_UINT32;
 116         val->data.uint32 = mca_ess_tool_component.num_retries;
 117         opal_list_append(&flags, &val->super);
 118     }
 119     if (0 < mca_ess_tool_component.pid) {
 120         val = OBJ_NEW(opal_value_t);
 121         val->key = strdup(OPAL_PMIX_SERVER_PIDINFO);
 122         val->type = OPAL_PID;
 123         val->data.pid = mca_ess_tool_component.pid;
 124         opal_list_append(&flags, &val->super);
 125     }
 126 
 127     
 128     if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup(&flags))) {
 129         ORTE_ERROR_LOG(ret);
 130         OPAL_LIST_DESTRUCT(&flags);
 131         error = "orte_ess_base_tool_setup";
 132         goto error;
 133     }
 134     OPAL_LIST_DESTRUCT(&flags);
 135 
 136     return ORTE_SUCCESS;
 137 
 138   error:
 139     if (ORTE_ERR_SILENT != ret && !orte_report_silent_errors) {
 140         orte_show_help("help-orte-runtime.txt",
 141                        "orte_init:startup:internal-failure",
 142                        true, error, ORTE_ERROR_NAME(ret), ret);
 143     }
 144 
 145     return ret;
 146 }
 147 
 148 static int rte_finalize(void)
 149 {
 150     
 151     orte_ess_base_tool_finalize();
 152 
 153     
 154     if (progress_thread_running) {
 155         opal_progress_thread_finalize(NULL);
 156         progress_thread_running = false;
 157     }
 158     return ORTE_SUCCESS;
 159 }
 160 
 161 
 162 
 163 
 164 
 165 
 166 static void rte_abort(int status, bool report)
 167 {
 168     
 169 
 170 
 171 
 172 
 173 
 174 
 175 
 176 
 177     
 178 
 179 
 180     orte_proc_info_finalize();
 181 
 182     
 183     exit(status);
 184 }