OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

proc_info.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2011 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$
13 *
14 * Additional copyrights may follow
15 *
16 * $HEADER$
17 */
18
19 /** @file:
20 *
21 * Populates global structure with process-specific information.
22 *
23 *
24 */
25
26 #ifndef _ORTE_PROC_INFO_H_
27 #define _ORTE_PROC_INFO_H_
28
29 #include "orte_config.h"
30
31 #ifdef HAVE_STDINT_H
32 #include <stdint.h>
33 #endif
34
35 #ifdef HAVE_SYS_TYPES_H
36 #include <sys/types.h>
37 #endif
38
39 #include "orte/types.h"
40
41 #include "opal/dss/dss_types.h"
42 #include "opal/mca/hwloc/hwloc.h"
43
44 BEGIN_C_DECLS
45
46 #define ORTE_MAX_HOSTNAME_SIZE 512
47
48 typedef uint32_t orte_proc_type_t;
49 #define ORTE_PROC_TYPE_NONE 0x0000
50 #define ORTE_PROC_SINGLETON 0x0001
51 #define ORTE_PROC_DAEMON 0x0002
52 #define ORTE_PROC_HNP 0x0004
53 #define ORTE_PROC_TOOL 0x0008
54 #define ORTE_PROC_NON_MPI 0x0010
55 #define ORTE_PROC_MPI 0x0020
56 #define ORTE_PROC_APP 0x0030
57 #define ORTE_PROC_CM 0x0040
58 #define ORTE_PROC_IOF_ENDPT 0x1000
59 #define ORTE_PROC_SCHEDULER 0x2000
60
61 #define ORTE_PROC_IS_SINGLETON (ORTE_PROC_SINGLETON & orte_process_info.proc_type)
62 #define ORTE_PROC_IS_DAEMON (ORTE_PROC_DAEMON & orte_process_info.proc_type)
63 #define ORTE_PROC_IS_HNP (ORTE_PROC_HNP & orte_process_info.proc_type)
64 #define ORTE_PROC_IS_TOOL (ORTE_PROC_TOOL & orte_process_info.proc_type)
65 #define ORTE_PROC_IS_NON_MPI (ORTE_PROC_NON_MPI & orte_process_info.proc_type)
66 #define ORTE_PROC_IS_MPI (ORTE_PROC_MPI & orte_process_info.proc_type)
67 #define ORTE_PROC_IS_APP (ORTE_PROC_APP & orte_process_info.proc_type)
68 #define ORTE_PROC_IS_CM (ORTE_PROC_CM & orte_process_info.proc_type)
69 #define ORTE_PROC_IS_IOF_ENDPT (ORTE_PROC_IOF_ENDPT & orte_process_info.proc_type)
70 #define ORTE_PROC_IS_SCHEDULER (ORTE_PROC_SCHEDULER & orte_process_info.proc_type)
71
72
73 /**
74 * Process information structure
75 *
76 * The orte_proc_info() function fills the pid field and obtains the
77 * process name, storing that information in the global structure. The
78 * structure also holds path names to the universe, job, and process
79 * session directories, and to the stdin, stdout, and stderr temp
80 * files - however, these are all initialized elsewhere.
81 */
82 struct orte_proc_info_t {
83 orte_process_name_t my_name; /**< My official process name */
84 orte_process_name_t my_daemon; /**< Name of my local daemon */
85 char *my_daemon_uri; /**< Contact info to local daemon */
86 orte_process_name_t my_hnp; /**< Name of my hnp */
87 char *my_hnp_uri; /**< Contact info for my hnp */
88 orte_process_name_t my_parent; /**< Name of my parent (or my HNP if no parent was specified) */
89 pid_t hnp_pid; /**< hnp pid - used if singleton */
90 orte_app_idx_t app_num; /**< our index into the app_context array */
91 orte_vpid_t num_procs; /**< number of processes in this job */
92 orte_vpid_t max_procs; /**< Maximum number of processes ever in the job */
93 orte_vpid_t num_daemons; /**< number of daemons in system */
94 int num_nodes; /**< number of nodes in the job */
95 char *nodename; /**< string name for this node */
96 pid_t pid; /**< Local process ID for this process */
97 orte_proc_type_t proc_type; /**< Type of process */
98 opal_buffer_t *sync_buf; /**< buffer to store sync response */
99 uint16_t my_port; /**< TCP port for out-of-band comm */
100 int32_t num_restarts; /**< number of times this proc has restarted */
101 orte_node_rank_t my_node_rank; /**< node rank */
102 /* The session directory has the form
103 * <prefix>/<openmpi-sessions-user>/<jobid>/<procid>, where the prefix
104 * can either be provided by the user via the
105 * --tmpdir command-line flag, the use of one of several
106 * environmental variables, or else a default location.
107 */
108 char *tmpdir_base; /**< Base directory of the session dir tree */
109 char *top_session_dir; /**< Top-most directory of the session tree */
110 char *job_session_dir; /**< Session directory for job */
111 char *proc_session_dir; /**< Session directory for the process */
112
113 char *sock_stdin; /**< Path name to temp file for stdin. */
114 char *sock_stdout; /**< Path name to temp file for stdout. */
115 char *sock_stderr; /**< Path name to temp file for stderr. */
116 #if OPAL_HAVE_HWLOC
117 opal_hwloc_level_t bind_level;
118 unsigned int bind_idx;
119 #endif
120 /* name/instance info for debug support */
121 char *job_name;
122 char *job_instance;
123 char *executable;
124 int32_t app_rank;
125 };
126 typedef struct orte_proc_info_t orte_proc_info_t;
127
128
129 /**
130 *
131 * Global process info descriptor. Initialized to almost no
132 * meaningful information - data is provided by calling \c
133 * orte_rte_init() (which calls \c orte_proc_info() to fill in the
134 * structure).
135 *
136 * The exception to this rule is the \c orte_process_info.seed field,
137 * which will be initialized to \c false, but should be set to \c true
138 * before calling \c orte_rte_info() if the caller is a seed daemon.
139 */
140 ORTE_DECLSPEC extern orte_proc_info_t orte_process_info;
141
142
143 /**
144 * \internal
145 *
146 * Global structure to store a wide range of information about the
147 * process. orte_proc_info populates a global variable with
148 * information about the process being executing. This function should
149 * be called only once, from orte_rte_init().
150 *
151 * @param None.
152 *
153 * @retval ORTE_SUCCESS Successfully initialized the various fields.
154 * @retval OMPI_ERROR Failed to initialize one or more fields.
155 */
156
157 ORTE_DECLSPEC int orte_proc_info(void);
158
159 ORTE_DECLSPEC int orte_proc_info_finalize(void);
160
161 END_C_DECLS
162
163 #endif
orte_proc_info_t::job_session_dir
char * job_session_dir
Session directory for job.
Definition: proc_info.h:110
orte_proc_info_t::proc_session_dir
char * proc_session_dir
Session directory for the process.
Definition: proc_info.h:111
orte_proc_info_t::hnp_pid
pid_t hnp_pid
hnp pid - used if singleton
Definition: proc_info.h:89
orte_process_name_t
Definition: types.h:146
orte_proc_info_t::max_procs
orte_vpid_t max_procs
Maximum number of processes ever in the job.
Definition: proc_info.h:92
orte_proc_info_t::sync_buf
opal_buffer_t * sync_buf
buffer to store sync response
Definition: proc_info.h:98
orte_proc_info_t::num_nodes
int num_nodes
number of nodes in the job
Definition: proc_info.h:94
orte_proc_info_t::my_port
uint16_t my_port
TCP port for out-of-band comm.
Definition: proc_info.h:99
orte_proc_info_t
Process information structure.
Definition: proc_info.h:82
orte_proc_info_t::sock_stderr
char * sock_stderr
Path name to temp file for stderr.
Definition: proc_info.h:115
orte_proc_info_t::my_name
orte_process_name_t my_name
My official process name.
Definition: proc_info.h:83
orte_proc_info_t::my_daemon_uri
char * my_daemon_uri
Contact info to local daemon.
Definition: proc_info.h:85
orte_proc_info_t::my_hnp_uri
char * my_hnp_uri
Contact info for my hnp.
Definition: proc_info.h:87
types.h
orte_proc_info_t::proc_type
orte_proc_type_t proc_type
Type of process.
Definition: proc_info.h:97
orte_proc_info_t::my_node_rank
orte_node_rank_t my_node_rank
node rank
Definition: proc_info.h:101
orte_proc_info_t::num_daemons
orte_vpid_t num_daemons
number of daemons in system
Definition: proc_info.h:93
orte_proc_info_t::num_restarts
int32_t num_restarts
number of times this proc has restarted
Definition: proc_info.h:100
orte_proc_info_t::my_parent
orte_process_name_t my_parent
Name of my parent (or my HNP if no parent was specified)
Definition: proc_info.h:88
orte_proc_info_t::my_daemon
orte_process_name_t my_daemon
Name of my local daemon.
Definition: proc_info.h:84
orte_proc_info_t::pid
pid_t pid
Local process ID for this process.
Definition: proc_info.h:96
orte_proc_info_t::sock_stdout
char * sock_stdout
Path name to temp file for stdout.
Definition: proc_info.h:114
dss_types.h
Buffer management types.
orte_process_info
ORTE_DECLSPEC orte_proc_info_t orte_process_info
Global process info descriptor.
Definition: proc_info.c:45
orte_proc_info_t::tmpdir_base
char * tmpdir_base
Base directory of the session dir tree.
Definition: proc_info.h:108
orte_proc_info_t::top_session_dir
char * top_session_dir
Top-most directory of the session tree.
Definition: proc_info.h:109
orte_proc_info_t::my_hnp
orte_process_name_t my_hnp
Name of my hnp.
Definition: proc_info.h:86
orte_proc_info_t::nodename
char * nodename
string name for this node
Definition: proc_info.h:95
orte_proc_info_t::app_num
orte_app_idx_t app_num
our index into the app_context array
Definition: proc_info.h:90
opal_buffer_t
Structure for holding a buffer to be used with the RML or OOB subsystems.
Definition: dss_types.h:159
orte_proc_info_t::num_procs
orte_vpid_t num_procs
number of processes in this job
Definition: proc_info.h:91
orte_proc_info_t::sock_stdin
char * sock_stdin
Path name to temp file for stdin.
Definition: proc_info.h:113