1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 
  25 
  26 
  27 
  28 #ifndef MCA_ODLS_PRIVATE_H
  29 #define MCA_ODLS_PRIVATE_H
  30 
  31 
  32 
  33 
  34 #include "orte_config.h"
  35 #include "orte/types.h"
  36 
  37 #include "opal/class/opal_list.h"
  38 #include "opal/class/opal_pointer_array.h"
  39 #include "opal/class/opal_bitmap.h"
  40 #include "opal/dss/dss_types.h"
  41 
  42 #include "orte/mca/iof/base/iof_base_setup.h"
  43 #include "orte/mca/rml/rml_types.h"
  44 #include "orte/runtime/orte_globals.h"
  45 #include "orte/util/threads.h"
  46 #include "orte/mca/odls/odls_types.h"
  47 
  48 BEGIN_C_DECLS
  49 
  50 
  51 
  52 
  53 
  54 typedef struct {
  55     
  56     int output;
  57     
  58     int timeout_before_sigkill;
  59     
  60     opal_list_t xterm_ranks;
  61     
  62     char **xtermcmd;
  63     
  64     int max_threads;
  65     int num_threads;
  66     int cutoff;
  67     opal_event_base_t **ev_bases;   
  68     char** ev_threads;              
  69     int next_base;                  
  70     bool signal_direct_children_only;
  71     orte_lock_t lock;
  72 } orte_odls_globals_t;
  73 
  74 ORTE_DECLSPEC extern orte_odls_globals_t orte_odls_globals;
  75 
  76 
  77 
  78 
  79 
  80 
  81 ORTE_DECLSPEC int
  82 orte_odls_base_default_get_add_procs_data(opal_buffer_t *data,
  83                                           orte_jobid_t job);
  84 
  85 ORTE_DECLSPEC int
  86 orte_odls_base_default_construct_child_list(opal_buffer_t *data,
  87                                             orte_jobid_t *job);
  88 
  89 ORTE_DECLSPEC void orte_odls_base_spawn_proc(int fd, short sd, void *cbdata);
  90 
  91 
  92 typedef int (*orte_odls_base_fork_local_proc_fn_t)(void *cd);
  93 
  94 
  95 typedef struct {
  96     opal_object_t super;
  97     opal_event_t ev;
  98     char *cmd;
  99     char *wdir;
 100     char **argv;
 101     char **env;
 102     orte_job_t *jdata;
 103     orte_app_context_t *app;
 104     orte_proc_t *child;
 105     bool index_argv;
 106     orte_iof_base_io_conf_t opts;
 107     orte_odls_base_fork_local_proc_fn_t fork_local;
 108 } orte_odls_spawn_caddy_t;
 109 OBJ_CLASS_DECLARATION(orte_odls_spawn_caddy_t);
 110 
 111 
 112 typedef struct {
 113     opal_object_t object;
 114     opal_event_t *ev;
 115     orte_jobid_t job;
 116     orte_odls_base_fork_local_proc_fn_t fork_local;
 117     int retries;
 118 } orte_odls_launch_local_t;
 119 OBJ_CLASS_DECLARATION(orte_odls_launch_local_t);
 120 
 121 #define ORTE_ACTIVATE_LOCAL_LAUNCH(j, f)                                \
 122     do {                                                                \
 123         orte_odls_launch_local_t *ll;                                   \
 124         ll = OBJ_NEW(orte_odls_launch_local_t);                         \
 125         ll->job = (j);                                                  \
 126         ll->fork_local = (f);                                           \
 127         opal_event_set(orte_event_base, ll->ev, -1, OPAL_EV_WRITE,      \
 128                        orte_odls_base_default_launch_local, ll);        \
 129         opal_event_set_priority(ll->ev, ORTE_SYS_PRI);                  \
 130         opal_event_active(ll->ev, OPAL_EV_WRITE, 1);                    \
 131     } while(0);
 132 
 133 ORTE_DECLSPEC void orte_odls_base_default_launch_local(int fd, short sd, void *cbdata);
 134 
 135 ORTE_DECLSPEC void orte_odls_base_default_wait_local_proc(int fd, short sd, void *cbdata);
 136 
 137 
 138 typedef int (*orte_odls_base_signal_local_fn_t)(pid_t pid, int signum);
 139 
 140 ORTE_DECLSPEC int
 141 orte_odls_base_default_signal_local_procs(const orte_process_name_t *proc, int32_t signal,
 142                                           orte_odls_base_signal_local_fn_t signal_local);
 143 
 144 
 145 typedef int (*orte_odls_base_kill_local_fn_t)(pid_t pid, int signum);
 146 
 147 
 148 typedef bool (*orte_odls_base_child_died_fn_t)(orte_proc_t *child);
 149 
 150 ORTE_DECLSPEC int
 151 orte_odls_base_default_kill_local_procs(opal_pointer_array_t *procs,
 152                                         orte_odls_base_kill_local_fn_t kill_local);
 153 
 154 ORTE_DECLSPEC int orte_odls_base_default_restart_proc(orte_proc_t *child,
 155                                                       orte_odls_base_fork_local_proc_fn_t fork_local);
 156 
 157 
 158 
 159 
 160 ORTE_DECLSPEC int orte_odls_base_preload_files_app_context(orte_app_context_t* context);
 161 
 162 
 163 
 164 
 165 ORTE_DECLSPEC int orte_odls_base_get_proc_stats(opal_buffer_t *answer, orte_process_name_t *proc);
 166 
 167 END_C_DECLS
 168 
 169 #endif