OpenMPI 0.1.1

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

- File List
- Globals

dss_types.h
Go to the documentation of this file.
1 /* -*- C -*-
2 *
3 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4 * University Research and Technology
5 * Corporation. All rights reserved.
6 * Copyright (c) 2004-2006 The University of Tennessee and The University
7 * of Tennessee Research Foundation. All rights
8 * reserved.
9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 * University of Stuttgart. All rights reserved.
11 * Copyright (c) 2004-2005 The Regents of the University of California.
12 * All rights reserved.
13 * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved.
14 * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 */
21 /**
22 * @file
23 *
24 * Buffer management types.
25 */
26
27 #ifndef OPAL_DSS_TYPES_H_
28 #define OPAL_DSS_TYPES_H_
29
30 #include "opal_config.h"
31
32 #ifdef OPAL_HAVE_SYS_TIME_H
33 #include <sys/time.h> /* for struct timeval */
34 #endif
35
36 #include "opal/class/opal_object.h"
37 #include "opal/class/opal_list.h"
38
39 BEGIN_C_DECLS
40
41 typedef uint8_t opal_data_type_t; /** data type indicators */
42 #define OPAL_DATA_TYPE_T OPAL_UINT8
43 #define OPAL_DSS_ID_MAX UINT8_MAX
44 #define OPAL_DSS_ID_INVALID OPAL_DSS_ID_MAX
45
46 /* define a structure to hold generic byte objects */
47 typedef struct {
48 int32_t size;
49 uint8_t *bytes;
50 } opal_byte_object_t;
51
52 /* Type defines for packing and unpacking */
53 #define OPAL_UNDEF (opal_data_type_t) 0 /**< type hasn't been defined yet */
54 #define OPAL_BYTE (opal_data_type_t) 1 /**< a byte of data */
55 #define OPAL_BOOL (opal_data_type_t) 2 /**< boolean */
56 #define OPAL_STRING (opal_data_type_t) 3 /**< a NULL terminated string */
57 #define OPAL_SIZE (opal_data_type_t) 4 /**< the generic size_t */
58 #define OPAL_PID (opal_data_type_t) 5 /**< process pid */
59 /* all the integer flavors */
60 #define OPAL_INT (opal_data_type_t) 6 /**< generic integer */
61 #define OPAL_INT8 (opal_data_type_t) 7 /**< an 8-bit integer */
62 #define OPAL_INT16 (opal_data_type_t) 8 /**< a 16-bit integer */
63 #define OPAL_INT32 (opal_data_type_t) 9 /**< a 32-bit integer */
64 #define OPAL_INT64 (opal_data_type_t) 10 /**< a 64-bit integer */
65 /* all the unsigned integer flavors */
66 #define OPAL_UINT (opal_data_type_t) 11 /**< generic unsigned integer */
67 #define OPAL_UINT8 (opal_data_type_t) 12 /**< an 8-bit unsigned integer */
68 #define OPAL_UINT16 (opal_data_type_t) 13 /**< a 16-bit unsigned integer */
69 #define OPAL_UINT32 (opal_data_type_t) 14 /**< a 32-bit unsigned integer */
70 #define OPAL_UINT64 (opal_data_type_t) 15 /**< a 64-bit unsigned integer */
71 /* we don't support floating point types */
72 /* General types */
73 #define OPAL_BYTE_OBJECT (opal_data_type_t) 16 /**< byte object structure */
74 #define OPAL_DATA_TYPE (opal_data_type_t) 17 /**< data type */
75 #define OPAL_NULL (opal_data_type_t) 18 /**< don't interpret data type */
76 #define OPAL_DATA_VALUE (opal_data_type_t) 19 /**< data value */
77 #define OPAL_PSTAT (opal_data_type_t) 20 /**< process statistics */
78 #define OPAL_NODE_STAT (opal_data_type_t) 21 /**< node statistics */
79 #define OPAL_HWLOC_TOPO (opal_data_type_t) 22 /**< hwloc topology */
80
81 #define OPAL_DSS_ID_DYNAMIC (opal_data_type_t) 30
82
83 /* define the results values for comparisons so we can change them in only one place */
84 #define OPAL_VALUE1_GREATER +1
85 #define OPAL_VALUE2_GREATER -1
86 #define OPAL_EQUAL 0
87
88 /* Data value object */
89 typedef struct {
90 opal_object_t super; /* required for this to be an object */
91 opal_data_type_t type; /* the type of value stored */
92 void *data;
93 } opal_dss_value_t;
94 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_dss_value_t);
95
96 #define OPAL_DATA_VALUE_EMPTY { OPAL_OBJ_STATIC_INIT(opal_dss_value_t), OPAL_UNDEF, NULL}
97
98 /* Process statistics object */
99 #define OPAL_PSTAT_MAX_STRING_LEN 32
100 typedef struct {
101 opal_list_item_t super; /* required for this to be on a list */
102 /* process ident info */
103 char node[OPAL_PSTAT_MAX_STRING_LEN];
104 int32_t rank;
105 pid_t pid;
106 char cmd[OPAL_PSTAT_MAX_STRING_LEN];
107 /* process stats */
108 char state[2];
109 struct timeval time;
110 float percent_cpu;
111 int32_t priority;
112 int16_t num_threads;
113 float vsize; /* in MBytes */
114 float rss; /* in MBytes */
115 float peak_vsize; /* in MBytes */
116 int16_t processor;
117 /* time at which sample was taken */
118 struct timeval sample_time;
119 } opal_pstats_t;
120 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_pstats_t);
121 typedef struct {
122 opal_object_t super;
123 /* node-level load averages */
124 float la;
125 float la5;
126 float la15;
127 /* memory usage */
128 float total_mem; /* in MBytes */
129 float free_mem; /* in MBytes */
130 float buffers; /* in MBytes */
131 float cached; /* in MBytes */
132 float swap_cached; /* in MBytes */
133 float swap_total; /* in MBytes */
134 float swap_free; /* in MBytes */
135 float mapped; /* in MBytes */
136 /* time at which sample was taken */
137 struct timeval sample_time;
138 } opal_node_stats_t;
139 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_node_stats_t);
140
141 /* structured-unstructured data flags */
142 #define OPAL_DSS_STRUCTURED true
143 #define OPAL_DSS_UNSTRUCTURED false
144
145 /**
146 * buffer type
147 */
148 typedef uint8_t opal_dss_buffer_type_t;
149 #define OPAL_DSS_BUFFER_NON_DESC 0x00
150 #define OPAL_DSS_BUFFER_FULLY_DESC 0x01
151
152 #define OPAL_DSS_BUFFER_TYPE_HTON(h);
153 #define OPAL_DSS_BUFFER_TYPE_NTOH(h);
154
155 /**
156 * Structure for holding a buffer to be used with the RML or OOB
157 * subsystems.
158 */
159 struct opal_buffer_t {
160 /** First member must be the object's parent */
161 opal_object_t parent;
162 /** type of buffer */
163 opal_dss_buffer_type_t type;
164 /** Start of my memory */
165 char *base_ptr;
166 /** Where the next data will be packed to (within the allocated
167 memory starting at base_ptr) */
168 char *pack_ptr;
169 /** Where the next data will be unpacked from (within the
170 allocated memory starting as base_ptr) */
171 char *unpack_ptr;
172
173 /** Number of bytes allocated (starting at base_ptr) */
174 size_t bytes_allocated;
175 /** Number of bytes used by the buffer (i.e., amount of data --
176 including overhead -- packed in the buffer) */
177 size_t bytes_used;
178 };
179 /**
180 * Convenience typedef
181 */
182 typedef struct opal_buffer_t opal_buffer_t;
183
184 /** formalize the declaration */
185 OPAL_DECLSPEC OBJ_CLASS_DECLARATION (opal_buffer_t);
186
187 END_C_DECLS
188
189 #endif /* OPAL_DSS_TYPES_H */
opal_buffer_t::base_ptr
char * base_ptr
Start of my memory.
Definition: dss_types.h:165
opal_list.h
The opal_list_t interface is used to provide a generic doubly-linked list container for Open MPI...
opal_list_item_t
Definition: opal_list.h:98
opal_node_stats_t
Definition: dss_types.h:121
opal_buffer_t::bytes_allocated
size_t bytes_allocated
Number of bytes allocated (starting at base_ptr)
Definition: dss_types.h:174
opal_buffer_t::bytes_used
size_t bytes_used
Number of bytes used by the buffer (i.e., amount of data – including overhead – packed in the buffe...
Definition: dss_types.h:177
opal_buffer_t::parent
opal_object_t parent
First member must be the object's parent.
Definition: dss_types.h:161
opal_dss_value_t
Definition: dss_types.h:89
opal_object_t
Base object.
Definition: opal_object.h:182
opal_buffer_t::unpack_ptr
char * unpack_ptr
Where the next data will be unpacked from (within the allocated memory starting as base_ptr) ...
Definition: dss_types.h:171
opal_buffer_t::type
opal_dss_buffer_type_t type
type of buffer
Definition: dss_types.h:163
opal_pstats_t
Definition: dss_types.h:100
opal_dss_buffer_type_t
uint8_t opal_dss_buffer_type_t
buffer type
Definition: dss_types.h:148
opal_buffer_t
Structure for holding a buffer to be used with the RML or OOB subsystems.
Definition: dss_types.h:159
opal_byte_object_t
Definition: dss_types.h:47
opal_object.h
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
opal_buffer_t::pack_ptr
char * pack_ptr
Where the next data will be packed to (within the allocated memory starting at base_ptr) ...
Definition: dss_types.h:168
OBJ_CLASS_DECLARATION
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_buffer_t)
formalize the declaration