root/orte/mca/odls/base/odls_private.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2006 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2011      Cisco Systems, Inc.  All rights reserved.
  13  * Copyright (c) 2011      Los Alamos National Security, LLC.  All rights
  14  *                         reserved.
  15  * Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
  16  * Copyright (c) 2017      IBM Corporation. All rights reserved.
  17  * Copyright (c) 2017      Research Organization for Information Science
  18  *                         and Technology (RIST). All rights reserved.
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  */
  25 /** @file:
  26  */
  27 
  28 #ifndef MCA_ODLS_PRIVATE_H
  29 #define MCA_ODLS_PRIVATE_H
  30 
  31 /*
  32  * includes
  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  * General ODLS types
  52  */
  53 
  54 typedef struct {
  55     /** Verbose/debug output stream */
  56     int output;
  57     /** Time to allow process to forcibly die */
  58     int timeout_before_sigkill;
  59     /* list of ranks to be displayed on separate xterms */
  60     opal_list_t xterm_ranks;
  61     /* the xterm cmd to be used */
  62     char **xtermcmd;
  63     /* thread pool */
  64     int max_threads;
  65     int num_threads;
  66     int cutoff;
  67     opal_event_base_t **ev_bases;   // event base array for progress threads
  68     char** ev_threads;              // event progress thread names
  69     int next_base;                  // counter to load-level thread use
  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  * Default functions that are common to most environments - can
  78  * be overridden by specific environments if they need something
  79  * different (e.g., bproc)
  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 /* define a function that will fork a local proc */
  92 typedef int (*orte_odls_base_fork_local_proc_fn_t)(void *cd);
  93 
  94 /* define an object for fork/exec the local proc */
  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 /* define an object for starting local launch */
 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 /* define a function type to signal a local proc */
 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 /* define a function type for killing a local proc */
 145 typedef int (*orte_odls_base_kill_local_fn_t)(pid_t pid, int signum);
 146 
 147 /* define a function type to detect that a child died */
 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  * Preload binary/files functions
 159  */
 160 ORTE_DECLSPEC int orte_odls_base_preload_files_app_context(orte_app_context_t* context);
 161 
 162 /*
 163  * Obtain process stats on a child proc
 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

/* [<][>][^][v][top][bottom][index][help] */