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 
  29 
  30 
  31 
  32 #ifndef ORTE_RUNTIME_ORTE_GLOBALS_H
  33 #define ORTE_RUNTIME_ORTE_GLOBALS_H
  34 
  35 #include "orte_config.h"
  36 #include "orte/types.h"
  37 
  38 #include <sys/types.h>
  39 #ifdef HAVE_SYS_TIME_H
  40 #include <sys/time.h>
  41 #endif
  42 
  43 #include "opal/class/opal_hash_table.h"
  44 #include "opal/class/opal_pointer_array.h"
  45 #include "opal/class/opal_value_array.h"
  46 #include "opal/class/opal_ring_buffer.h"
  47 #include "opal/threads/threads.h"
  48 #include "opal/mca/event/event.h"
  49 #include "opal/mca/hwloc/hwloc-internal.h"
  50 #include "opal/mca/hwloc/base/base.h"
  51 
  52 #include "orte/mca/plm/plm_types.h"
  53 #include "orte/mca/rml/rml_types.h"
  54 #include "orte/util/attr.h"
  55 #include "orte/util/proc_info.h"
  56 #include "orte/util/name_fns.h"
  57 #include "orte/util/error_strings.h"
  58 #include "orte/runtime/runtime.h"
  59 
  60 
  61 BEGIN_C_DECLS
  62 
  63 ORTE_DECLSPEC extern int orte_debug_verbosity;  
  64 ORTE_DECLSPEC extern char *orte_prohibited_session_dirs;  
  65 ORTE_DECLSPEC extern bool orte_xml_output;  
  66 ORTE_DECLSPEC extern FILE *orte_xml_fp;   
  67 ORTE_DECLSPEC extern bool orte_help_want_aggregate;  
  68 ORTE_DECLSPEC extern char *orte_job_ident;  
  69 ORTE_DECLSPEC extern bool orte_create_session_dirs;  
  70 ORTE_DECLSPEC extern bool orte_execute_quiet;  
  71 ORTE_DECLSPEC extern bool orte_report_silent_errors;  
  72 ORTE_DECLSPEC extern opal_event_base_t *orte_event_base;  
  73 ORTE_DECLSPEC extern bool orte_event_base_active; 
  74 ORTE_DECLSPEC extern bool orte_proc_is_bound;  
  75 ORTE_DECLSPEC extern int orte_progress_thread_debug;  
  76 
  77 
  78 
  79 
  80 
  81 OPAL_DECLSPEC extern hwloc_cpuset_t orte_proc_applied_binding;  
  82 
  83 
  84 
  85 #define ORTE_NAME_WILDCARD      (&orte_name_wildcard)
  86 ORTE_DECLSPEC extern orte_process_name_t orte_name_wildcard;  
  87 #define ORTE_NAME_INVALID       (&orte_name_invalid)
  88 ORTE_DECLSPEC extern orte_process_name_t orte_name_invalid;  
  89 
  90 #define ORTE_PROC_MY_NAME       (&orte_process_info.my_name)
  91 
  92 
  93 #define ORTE_PROC_MY_PARENT     (&orte_process_info.my_parent)
  94 
  95 
  96 #define ORTE_PROC_MY_HNP        (&orte_process_info.my_hnp)
  97 
  98 
  99 #define ORTE_PROC_MY_DAEMON     (&orte_process_info.my_daemon)
 100 
 101 ORTE_DECLSPEC extern bool orte_in_parallel_debugger;
 102 
 103 
 104 typedef void (*orte_err_cb_fn_t)(orte_process_name_t *proc, orte_proc_state_t state, void *cbdata);
 105 
 106 
 107 typedef struct {
 108     opal_object_t super;
 109     struct timeval tv;
 110     opal_event_t *ev;
 111     void *payload;
 112 } orte_timer_t;
 113 OBJ_CLASS_DECLARATION(orte_timer_t);
 114 
 115 ORTE_DECLSPEC extern int orte_exit_status;
 116 
 117 
 118 
 119 
 120 
 121 
 122 
 123 
 124 #define ORTE_ERROR_PRI  OPAL_EV_ERROR_PRI
 125 #define ORTE_MSG_PRI    OPAL_EV_MSG_LO_PRI
 126 #define ORTE_SYS_PRI    OPAL_EV_SYS_LO_PRI
 127 #define ORTE_INFO_PRI   OPAL_EV_INFO_LO_PRI
 128 
 129 
 130 #define ORTE_DB_DAEMON_VPID  "orte.daemon.vpid"
 131 
 132 
 133 ORTE_DECLSPEC extern opal_list_t orte_job_states;
 134 ORTE_DECLSPEC extern opal_list_t orte_proc_states;
 135 
 136 
 137 ORTE_DECLSPEC extern int orte_clean_output;
 138 
 139 #define ORTE_GLOBAL_ARRAY_BLOCK_SIZE    64
 140 #define ORTE_GLOBAL_ARRAY_MAX_SIZE      INT_MAX
 141 
 142 
 143 #define ORTE_ERROR_DEFAULT_EXIT_CODE    1
 144 
 145 
 146 
 147 
 148 
 149 
 150 
 151 
 152 
 153 
 154 
 155 
 156 
 157 
 158 
 159 
 160 
 161 
 162 
 163 #define ORTE_UPDATE_EXIT_STATUS(newstatus)                                  \
 164     do {                                                                    \
 165         if (0 == orte_exit_status && 0 != newstatus) {                      \
 166             OPAL_OUTPUT_VERBOSE((1, orte_debug_output,                      \
 167                                  "%s:%s(%d) updating exit status to %d",    \
 168                                  ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),        \
 169                                  __FILE__, __LINE__, newstatus));           \
 170             orte_exit_status = newstatus;                                   \
 171         }                                                                   \
 172     } while(0);
 173 
 174 
 175 
 176 
 177 #define ORTE_RESET_EXIT_STATUS()                                \
 178     do {                                                        \
 179         OPAL_OUTPUT_VERBOSE((1, orte_debug_output,              \
 180                             "%s:%s(%d) reseting exit status",   \
 181                             ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), \
 182                             __FILE__, __LINE__));               \
 183         orte_exit_status = 0;                                   \
 184     } while(0);
 185 
 186 
 187 
 188 
 189 
 190 #define ORTE_COMPUTE_TIME_DIFF(r, ur, s1, us1, s2, us2)     \
 191     do {                                                    \
 192         (r) = (s2) - (s1);                                  \
 193         if ((us2) >= (us1)) {                               \
 194             (ur) = (us2) - (us1);                           \
 195         } else {                                            \
 196             (r)--;                                          \
 197             (ur) = 1000000 - (us1) + (us2);                 \
 198         }                                                   \
 199     } while(0);
 200 
 201 
 202 typedef uint16_t orte_job_controls_t;
 203 #define ORTE_JOB_CONTROL    OPAL_UINT16
 204 
 205 
 206 
 207 
 208 
 209 
 210 
 211 
 212 struct orte_proc_t;
 213 struct orte_job_map_t;
 214 
 215 
 216 
 217 typedef struct {
 218     opal_object_t super;
 219     int index;
 220     hwloc_topology_t topo;
 221     char *sig;
 222 } orte_topology_t;
 223 ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_topology_t);
 224 
 225 
 226 
 227 
 228 
 229 typedef struct {
 230     
 231     opal_object_t super;
 232     
 233     orte_app_idx_t idx;
 234     
 235     char   *app;
 236     
 237     orte_std_cntr_t num_procs;
 238     
 239 
 240 
 241     opal_pointer_array_t procs;
 242     
 243     orte_app_state_t state;
 244     
 245     orte_vpid_t first_rank;
 246     
 247     char  **argv;
 248     
 249     char  **env;
 250     
 251     char   *cwd;
 252     
 253     orte_app_context_flags_t flags;
 254     
 255 
 256 
 257 
 258 
 259 
 260     opal_list_t attributes;
 261 } orte_app_context_t;
 262 
 263 ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_app_context_t);
 264 
 265 
 266 typedef struct {
 267     
 268     opal_list_item_t super;
 269     
 270     orte_std_cntr_t index;
 271     
 272     char *name;
 273     
 274     struct orte_proc_t *daemon;
 275     
 276     orte_vpid_t num_procs;
 277     
 278     opal_pointer_array_t *procs;
 279     
 280     orte_node_rank_t next_node_rank;
 281     
 282     orte_node_state_t state;
 283     
 284 
 285 
 286 
 287     orte_std_cntr_t slots;
 288     
 289 
 290     orte_std_cntr_t slots_inuse;
 291     
 292 
 293 
 294 
 295 
 296 
 297 
 298 
 299 
 300 
 301     orte_std_cntr_t slots_max;
 302     
 303     orte_topology_t *topology;
 304     
 305     orte_node_flags_t flags;
 306     
 307     opal_list_t attributes;
 308 } orte_node_t;
 309 ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_node_t);
 310 
 311 typedef struct {
 312     
 313     opal_list_item_t super;
 314     
 315     char **personality;
 316     
 317     orte_jobid_t jobid;
 318     
 319 
 320     orte_vpid_t offset;
 321     
 322     opal_pointer_array_t *apps;
 323     
 324     orte_app_idx_t num_apps;
 325     
 326 
 327 
 328     orte_vpid_t stdin_target;
 329     
 330     orte_std_cntr_t total_slots_alloc;
 331     
 332     orte_vpid_t num_procs;
 333     
 334     opal_pointer_array_t *procs;
 335     
 336     struct orte_job_map_t *map;
 337     
 338 
 339 
 340     orte_node_t *bookmark;
 341     
 342 
 343     unsigned int bkmark_obj;
 344     
 345     orte_job_state_t state;
 346     
 347     orte_vpid_t num_mapped;
 348     
 349     orte_vpid_t num_launched;
 350     
 351     orte_vpid_t num_reported;
 352     
 353     orte_vpid_t num_terminated;
 354     
 355     orte_vpid_t num_daemons_reported;
 356     
 357     orte_process_name_t originator;
 358     
 359     orte_vpid_t num_local_procs;
 360     
 361     orte_job_flags_t flags;
 362     
 363     opal_list_t attributes;
 364     
 365     opal_buffer_t launch_msg;
 366 } orte_job_t;
 367 ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_job_t);
 368 
 369 struct orte_proc_t {
 370     
 371     opal_list_item_t super;
 372     
 373     orte_process_name_t name;
 374     
 375 
 376 
 377     orte_vpid_t parent;
 378     
 379     pid_t pid;
 380     
 381 
 382 
 383 
 384 
 385 
 386     orte_local_rank_t local_rank;
 387     
 388 
 389 
 390 
 391 
 392     orte_node_rank_t node_rank;
 393     
 394 
 395 
 396 
 397     int32_t app_rank;
 398     
 399     orte_proc_state_t last_errmgr_state;
 400     
 401     orte_proc_state_t state;
 402     
 403     orte_exit_code_t exit_code;
 404     
 405     orte_app_idx_t app_idx;
 406     
 407     orte_node_t *node;
 408     
 409     char *rml_uri;
 410     
 411     orte_proc_flags_t flags;
 412     
 413     opal_list_t attributes;
 414 };
 415 typedef struct orte_proc_t orte_proc_t;
 416 ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_proc_t);
 417 
 418 
 419 
 420 
 421 
 422 
 423 
 424 
 425 
 426 ORTE_DECLSPEC   orte_job_t* orte_get_job_data_object(orte_jobid_t job);
 427 
 428 
 429 
 430 
 431 ORTE_DECLSPEC orte_proc_t* orte_get_proc_object(orte_process_name_t *proc);
 432 
 433 
 434 
 435 
 436 ORTE_DECLSPEC orte_vpid_t orte_get_proc_daemon_vpid(orte_process_name_t *proc);
 437 
 438 
 439 ORTE_DECLSPEC char* orte_get_proc_hostname(orte_process_name_t *proc);
 440 
 441 
 442 ORTE_DECLSPEC orte_node_rank_t orte_get_proc_node_rank(orte_process_name_t *proc);
 443 
 444 
 445 ORTE_DECLSPEC orte_vpid_t orte_get_lowest_vpid_alive(orte_jobid_t job);
 446 
 447 
 448 ORTE_DECLSPEC extern bool orte_debug_daemons_flag;
 449 ORTE_DECLSPEC extern bool orte_debug_daemons_file_flag;
 450 ORTE_DECLSPEC extern bool orte_leave_session_attached;
 451 ORTE_DECLSPEC extern bool orte_do_not_launch;
 452 ORTE_DECLSPEC extern bool orted_spin_flag;
 453 ORTE_DECLSPEC extern char *orte_local_cpu_type;
 454 ORTE_DECLSPEC extern char *orte_local_cpu_model;
 455 ORTE_DECLSPEC extern char *orte_basename;
 456 ORTE_DECLSPEC extern bool orte_coprocessors_detected;
 457 ORTE_DECLSPEC extern opal_hash_table_t *orte_coprocessors;
 458 ORTE_DECLSPEC extern char *orte_topo_signature;
 459 ORTE_DECLSPEC extern bool orte_no_vm;
 460 ORTE_DECLSPEC extern char *orte_data_server_uri;
 461 
 462 
 463 ORTE_DECLSPEC extern bool orte_static_ports;
 464 ORTE_DECLSPEC extern bool orte_standalone_operation;
 465 
 466 
 467 ORTE_DECLSPEC extern bool orte_keep_fqdn_hostnames;
 468 ORTE_DECLSPEC extern bool orte_have_fqdn_allocation;
 469 ORTE_DECLSPEC extern bool orte_show_resolved_nodenames;
 470 ORTE_DECLSPEC extern bool orte_retain_aliases;
 471 ORTE_DECLSPEC extern int orte_use_hostname_alias;
 472 ORTE_DECLSPEC extern int orte_hostname_cutoff;
 473 
 474 
 475 ORTE_DECLSPEC extern int orted_debug_failure;
 476 ORTE_DECLSPEC extern int orted_debug_failure_delay;
 477 
 478 ORTE_DECLSPEC extern bool orte_never_launched;
 479 ORTE_DECLSPEC extern bool orte_devel_level_output;
 480 ORTE_DECLSPEC extern bool orte_display_topo_with_map;
 481 ORTE_DECLSPEC extern bool orte_display_diffable_output;
 482 
 483 ORTE_DECLSPEC extern char **orte_launch_environ;
 484 
 485 ORTE_DECLSPEC extern bool orte_hnp_is_allocated;
 486 ORTE_DECLSPEC extern bool orte_allocation_required;
 487 ORTE_DECLSPEC extern bool orte_managed_allocation;
 488 ORTE_DECLSPEC extern char *orte_set_slots;
 489 ORTE_DECLSPEC extern bool orte_display_allocation;
 490 ORTE_DECLSPEC extern bool orte_display_devel_allocation;
 491 ORTE_DECLSPEC extern bool orte_soft_locations;
 492 ORTE_DECLSPEC extern bool orte_hnp_connected;
 493 ORTE_DECLSPEC extern bool orte_nidmap_communicated;
 494 ORTE_DECLSPEC extern bool orte_node_info_communicated;
 495 
 496 
 497 ORTE_DECLSPEC extern char *orte_launch_agent;
 498 ORTE_DECLSPEC extern char **orted_cmd_line;
 499 ORTE_DECLSPEC extern char **orte_fork_agent;
 500 
 501 
 502 ORTE_DECLSPEC extern bool orte_debugger_dump_proctable;
 503 ORTE_DECLSPEC extern char *orte_debugger_test_daemon;
 504 ORTE_DECLSPEC extern bool orte_debugger_test_attach;
 505 ORTE_DECLSPEC extern int orte_debugger_check_rate;
 506 
 507 
 508 ORTE_DECLSPEC extern bool orte_abnormal_term_ordered;
 509 ORTE_DECLSPEC extern bool orte_routing_is_enabled;
 510 ORTE_DECLSPEC extern bool orte_job_term_ordered;
 511 ORTE_DECLSPEC extern bool orte_orteds_term_ordered;
 512 ORTE_DECLSPEC extern bool orte_allowed_exit_without_sync;
 513 ORTE_DECLSPEC extern int orte_startup_timeout;
 514 
 515 ORTE_DECLSPEC extern int orte_timeout_usec_per_proc;
 516 ORTE_DECLSPEC extern float orte_max_timeout;
 517 ORTE_DECLSPEC extern orte_timer_t *orte_mpiexec_timeout;
 518 
 519 
 520 ORTE_DECLSPEC extern opal_hash_table_t *orte_job_data;
 521 ORTE_DECLSPEC extern opal_pointer_array_t *orte_node_pool;
 522 ORTE_DECLSPEC extern opal_pointer_array_t *orte_node_topologies;
 523 ORTE_DECLSPEC extern opal_pointer_array_t *orte_local_children;
 524 ORTE_DECLSPEC extern orte_vpid_t orte_total_procs;
 525 
 526 
 527 ORTE_DECLSPEC extern bool orte_tag_output;
 528 ORTE_DECLSPEC extern bool orte_timestamp_output;
 529 
 530 ORTE_DECLSPEC extern char *orte_xterm;
 531 
 532 
 533 ORTE_DECLSPEC extern bool orte_report_launch_progress;
 534 
 535 
 536 ORTE_DECLSPEC extern char *orte_default_hostfile;
 537 ORTE_DECLSPEC extern bool orte_default_hostfile_given;
 538 ORTE_DECLSPEC extern char *orte_rankfile;
 539 ORTE_DECLSPEC extern int orte_num_allocated_nodes;
 540 ORTE_DECLSPEC extern char *orte_default_dash_host;
 541 
 542 
 543 ORTE_DECLSPEC extern int orted_pmi_version;
 544 
 545 
 546 ORTE_DECLSPEC extern bool orte_report_events;
 547 ORTE_DECLSPEC extern char *orte_report_events_uri;
 548 
 549 
 550 ORTE_DECLSPEC extern bool orte_enable_recovery;
 551 ORTE_DECLSPEC extern int32_t orte_max_restarts;
 552 
 553 ORTE_DECLSPEC extern bool orte_do_not_barrier;
 554 
 555 
 556 ORTE_DECLSPEC extern bool orte_report_child_jobs_separately;
 557 ORTE_DECLSPEC extern struct timeval orte_child_time_to_exit;
 558 ORTE_DECLSPEC extern bool orte_abort_non_zero_exit;
 559 
 560 
 561 ORTE_DECLSPEC extern int orte_stat_history_size;
 562 
 563 
 564 ORTE_DECLSPEC extern char **orte_forwarded_envars;
 565 
 566 
 567 ORTE_DECLSPEC extern bool orte_map_stddiag_to_stderr;
 568 ORTE_DECLSPEC extern bool orte_map_stddiag_to_stdout;
 569 
 570 
 571 ORTE_DECLSPEC extern int orte_max_vm_size;
 572 
 573 
 574 ORTE_DECLSPEC extern char *orte_base_user_debugger;
 575 
 576 
 577 
 578 
 579 ORTE_DECLSPEC extern char *orte_daemon_cores;
 580 
 581 
 582 ORTE_DECLSPEC extern int orte_stack_trace_wait_timeout;
 583 
 584 END_C_DECLS
 585 
 586 #endif