ROSS
st-instrumentation.h
Go to the documentation of this file.
1 #ifndef INC_st_instrumentation_h
2 #define INC_st_instrumentation_h
3 
4 /*
5  * Header file for all of the ROSS instrumentation
6  */
7 
8 #include <ross.h>
9 #include <inttypes.h>
10 
11 #define INST_MAX_LENGTH 4096
12 
13 /* st-stats-buffer.c */
14 #define st_buffer_free_space(buf) (buf->size - buf->count)
15 #define st_buffer_write_ptr(buf) (buf->buffer + buf->write_pos)
16 #define st_buffer_read_ptr(buf) (buf->buffer + buf->read_pos)
17 
18 typedef struct{
19  char *buffer;
20  int size;
21  int write_pos;
22  int read_pos;
23  int count;
25 
26 extern char stats_directory[INST_MAX_LENGTH];
27 extern int g_st_buffer_size;
28 extern int g_st_buffer_free_percent;
29 extern FILE *seq_ev_trace, *seq_model, *seq_analysis;
30 
31 void st_buffer_allocate();
32 void st_buffer_init(int type);
33 void st_buffer_push(int type, char *data, int size);
34 void st_buffer_write(int end_of_sim, int type);
35 void st_buffer_finalize(int type);
36 
37 /* st-instrumentation.c */
39 
40 typedef enum{
48 
49 typedef enum{
55 
56 typedef enum {
62 
64 {
65  int flag;
66  int sample_sz;
68  double real_time;
69 };
70 
71 extern char g_st_stats_out[INST_MAX_LENGTH];
72 extern char g_st_stats_path[INST_MAX_LENGTH];
73 extern int g_st_pe_data;
74 extern int g_st_kp_data;
75 extern int g_st_lp_data;
76 extern int g_st_disable_out;
77 
78 extern int g_st_model_stats;
79 extern int g_st_engine_stats;
80 
81 extern int g_st_gvt_sampling;
82 extern int g_st_num_gvt;
83 
84 extern int g_st_rt_sampling;
87 
88 extern const tw_optdef *st_inst_opts();
89 extern void st_inst_init(void);
90 extern void st_inst_dump();
91 extern void st_inst_finalize(tw_pe *me);
92 
93 /*
94  * st-sim-engine.c
95  * Simulation Engine related instrumentation
96  */
97 typedef struct st_pe_stats st_pe_stats;
98 typedef struct st_kp_stats st_kp_stats;
99 typedef struct st_lp_stats st_lp_stats;
100 
101 struct st_pe_stats{
102  unsigned int peid;
103 
104  unsigned int s_nevent_processed;
105  unsigned int s_nevent_abort;
106  unsigned int s_e_rbs;
107  unsigned int s_rb_total;
108  unsigned int s_rb_secondary;
109  unsigned int s_fc_attempts;
110  unsigned int s_pq_qsize;
111  unsigned int s_nsend_network;
112  unsigned int s_nread_network;
113  //unsigned int s_nsend_remote_rb;
114  //unsigned int s_nsend_loc_remote;
115  //unsigned int s_nsend_net_remote;
116  unsigned int s_ngvts;
117  unsigned int s_pe_event_ties;
118  unsigned int all_reduce_count;
119  float efficiency;
120 
121  float s_net_read;
122  float s_net_other;
123  float s_gvt;
127  float s_pq;
128  float s_rollback;
129  float s_cancel_q;
130  float s_avl;
131  float s_buddy;
132  float s_lz4;
133 };
134 
135 struct st_kp_stats{
136  unsigned int peid;
137  unsigned int kpid;
138 
139  unsigned int s_nevent_processed;
140  unsigned int s_nevent_abort;
141  unsigned int s_e_rbs;
142  unsigned int s_rb_total;
143  unsigned int s_rb_secondary;
144  unsigned int s_nsend_network;
145  unsigned int s_nread_network;
147  float efficiency;
148 };
149 
150 struct st_lp_stats{
151  unsigned int peid;
152  unsigned int kpid;
153  unsigned int lpid;
154 
155  unsigned int s_nevent_processed;
156  unsigned int s_nevent_abort;
157  unsigned int s_e_rbs;
158  unsigned int s_nsend_network;
159  unsigned int s_nread_network;
160  float efficiency;
161 };
162 
163 void st_collect_engine_data(tw_pe *me, int col_type);
164 void st_collect_engine_data_pes(tw_pe *pe, sample_metadata *sample_md, tw_statistics *s, int col_type);
165 void st_collect_engine_data_kps(tw_pe *me, tw_kp *kp, sample_metadata *sample_md, int col_type);
166 void st_collect_engine_data_lps(tw_lp *lp, sample_metadata *sample_md, int col_type);
167 
168 /*
169  * st-event-trace.c
170  */
171 typedef enum{
176 } traces_enum;
177 
178 typedef struct {
179  unsigned int src_lp;
180  unsigned int dest_lp;
181  float send_vts;
182  float recv_vts;
183  float real_ts;
184  unsigned int model_data_sz;
185 } st_event_data;
186 
187 // collect_flag allows for specific events to be turned on/off in tracing
188 typedef void (*ev_trace_f) (void *msg, tw_lp *lp, char *buffer, int *collect_flag);
189 
190 extern int g_st_ev_trace;
191 
192 void st_collect_event_data(tw_event *cev, double recv_rt);
193 
194 /*
195  * ross-lps/analysis-lp.c
196  */
197 typedef void (*sample_event_f)(void *state, tw_bf *b, tw_lp *lp, void *sample);
198 typedef void (*sample_revent_f)(void *state, tw_bf *b, tw_lp *lp, void *sample);
199 extern void specialized_lp_setup();
200 extern void specialized_lp_init_mapping();
201 extern void specialized_lp_run();
202 extern const tw_optdef *st_special_lp_opts(void);
203 extern int g_st_use_analysis_lps;
205 extern double g_st_vt_interval;
206 extern double g_st_sampling_end;
208 extern int g_st_sample_count;
209 
210 /*
211  * st-model-data.c
212  */
213 // function to be implemented in LP for collection of model level stats
214 typedef void (*model_stat_f) (void *sv, tw_lp *lp, char *buffer);
216 
217 /*
218  * Struct to help ROSS collect model-level data
219  * */
221  ev_trace_f ev_trace; /**< @brief function pointer to collect data about all events for given LP */
222  size_t ev_sz; /**< @brief size of data collected from model for each event */
223  model_stat_f model_stat_fn; /**< @brief function pointer to collect model level data for RT and GVT-based instrumentation */
224  size_t mstat_sz; /**< @brief size of data collected from model at sampling points */
228 };
229 
230 typedef enum{
237 
238 typedef struct {
239  unsigned int peid;
240  unsigned int kpid;
241  unsigned int lpid;
242  float gvt;
244  unsigned int model_sz;
246 
248 
249 void st_model_setup_types(tw_lp *lp);
251 void st_collect_model_data(tw_pe *pe, double current_rt, int stats_type);
252 
253 #endif
unsigned int kpid
int g_st_disable_out
unsigned int s_e_rbs
model_stat_f model_stat_fn
function pointer to collect model level data for RT and GVT-based instrumentation ...
char g_st_stats_path[4096]
unsigned int s_nsend_network
unsigned int s_ngvts
stats_types_enum
unsigned int peid
int g_st_lp_data
void specialized_lp_init_mapping()
size_t ev_sz
size of data collected from model for each event
double g_st_sampling_end
double tw_stime
Definition: ross.h:150
unsigned int peid
unsigned int s_rb_secondary
unsigned int lpid
char g_st_stats_out[4096]
unsigned int peid
unsigned int s_e_rbs
tw_lpid g_st_analysis_nlp
unsigned int s_nevent_abort
FILE * seq_model
unsigned int src_lp
int g_st_pe_data
void st_buffer_push(int type, char *data, int size)
unsigned int s_pq_qsize
size_t mstat_sz
size of data collected from model at sampling points
tw_clock g_st_rt_samp_start_cycles
void st_collect_engine_data_lps(tw_lp *lp, sample_metadata *sample_md, int col_type)
unsigned int all_reduce_count
void st_collect_model_data(tw_pe *pe, double current_rt, int stats_type)
Definition: st-model-data.c:45
Holds the entire PE state.
Definition: ross-types.h:375
void st_collect_engine_data_pes(tw_pe *pe, sample_metadata *sample_md, tw_statistics *s, int col_type)
Definition: st-sim-engine.c:45
unsigned int s_nevent_processed
unsigned int s_pe_event_ties
int g_st_ev_trace
Definition: st-event-trace.c:3
unsigned int s_nsend_network
void(* ev_trace_f)(void *msg, tw_lp *lp, char *buffer, int *collect_flag)
int g_st_buffer_free_percent
void st_collect_event_data(tw_event *cev, double recv_rt)
Definition: st-event-trace.c:9
#define INST_MAX_LENGTH
int g_st_buffer_size
tw_clock g_st_rt_interval
uint64_t tw_lpid
Definition: ross.h:160
void(* sample_revent_f)(void *state, tw_bf *b, tw_lp *lp, void *sample)
granularity_types
unsigned int kpid
int g_st_num_gvt
Statistics tallied over the duration of the simulation.
Definition: ross-types.h:107
Event Stucture.
Definition: ross-types.h:250
collection_types
int g_st_gvt_sampling
unsigned int s_nread_network
const tw_optdef * st_inst_opts()
void specialized_lp_setup()
void st_inst_dump()
unsigned int s_rb_total
int g_st_use_analysis_lps
int g_st_kp_data
void st_inst_init(void)
tw_lpid g_st_total_model_lps
inst_data_types
void st_buffer_write(int end_of_sim, int type)
void st_collect_engine_data_kps(tw_pe *me, tw_kp *kp, sample_metadata *sample_md, int col_type)
unsigned int s_rb_secondary
int g_st_sample_count
unsigned int s_nevent_processed
unsigned int s_e_rbs
Reverse Computation Bitfield.
Definition: ross-types.h:178
unsigned int s_nread_network
unsigned int model_sz
unsigned int s_nevent_processed
void specialized_lp_run()
void st_model_settype(tw_lpid i, st_model_types *model_types)
Definition: st-model-data.c:25
void st_collect_engine_data(tw_pe *me, int col_type)
Definition: st-sim-engine.c:10
unsigned int s_nread_network
void st_model_setup_types(tw_lp *lp)
Definition: st-model-data.c:10
sample_revent_f sample_revent_fn
FILE * seq_ev_trace
FILE * seq_analysis
sample_event_f sample_event_fn
void st_inst_finalize(tw_pe *me)
void(* sample_event_f)(void *state, tw_bf *b, tw_lp *lp, void *sample)
unsigned int s_nevent_abort
tw_pe * pe
Definition: avl_tree.c:11
unsigned int s_rb_total
uint64_t tw_clock
Definition: aarch64.h:4
const tw_optdef * st_special_lp_opts(void)
char stats_directory[4096]
ev_trace_f ev_trace
function pointer to collect data about all events for given LP
unsigned int s_nsend_network
int g_st_model_stats
void(* model_stat_f)(void *sv, tw_lp *lp, char *buffer)
int g_st_rt_sampling
double g_st_vt_interval
void st_buffer_allocate()
st_model_types model_types[]
Definition: phold.c:142
void st_buffer_init(int type)
unsigned int dest_lp
unsigned int s_fc_attempts
void st_buffer_finalize(int type)
unsigned int s_nevent_abort
int g_st_engine_stats
st_model_types * g_st_model_types
Definition: st-model-data.c:3
LP State Structure.
Definition: ross-types.h:304
unsigned int model_data_sz