ROSS
io.h
Go to the documentation of this file.
1 #ifndef INC_io_h
2 #define INC_io_h
3 
4 //Elsa Gonsiorowski
5 //Rensselaer Polytechnic Institute
6 //Decemeber 13, 2013
7 
8 // ** Global IO System variables ** //
9 
10 // Set with command line --io-files
11 // should be consistent across the system
12 extern int g_io_number_of_files;
13 
14 // Register opts with ROSS
15 extern const tw_optdef io_opts[3];
16 
17 enum io_load_e {
18  NONE, // default value
19  PRE_INIT, // load LPs then lp->init
20  INIT, // load LPs instead lp->init
21  POST_INIT, // load LPs after lp->init
22 };
23 typedef enum io_load_e io_load_type;
25 extern char g_io_checkpoint_name[1024];
26 
27 // Should be set in main, before call to io_init
28 // Maximum number of events that will be scheduled past end time
30 
31 // ** API Functions, Types, and Variables ** //
32 
33 void io_register_model_version(char *sha1);
34 void io_init();
35 
36 void io_load_checkpoint(char * master_filename, io_load_type load_at);
37 void io_store_checkpoint(char * master_filename, int data_file_number);
38 void io_appending_job();
39 
40 // LP type map and function struct
41 typedef void (*serialize_f)(void * state, void * buffer, tw_lp *lp);
42 typedef void (*deserialize_f)(void * state, void * buffer, tw_lp *lp);
43 typedef size_t (*model_size_f)(void * state, tw_lp *lp);
44 
45 typedef struct {
49 } io_lptype;
50 
51 extern io_lptype * g_io_lp_types;
52 
53 // ** Internal IO types, variables, and functions ** //
54 
55 typedef struct {
56  int part;
57  int file;
58  int offset;
59  int size;
60  int lp_count;
61  int ev_count;
62 } io_partition;
63 static int io_partition_field_count = 6;
64 
65 typedef struct {
67  int32_t rng[12];
68 #ifdef RAND_NORMAL
69  double tw_normal_u1;
70  double tw_normal_u2;
72 #endif
73  unsigned int critical_path;
74 } io_lp_store;
75 
76 typedef struct {
78  unsigned int critical_path;
82  // NOTE: not storing tw_memory or tw_out
84 
86 
87 // Functions Called Directly from ROSS
88 void io_load_events(tw_pe * me);
89 void io_event_cancel(tw_event *e);
90 void io_read_checkpoint();
91 
92 // SERIALIZE FUNCTIONS for LP and EVENT structs
93 // found in io-serialize.c
94 size_t io_lp_serialize (tw_lp * lp, void * buffer);
95 size_t io_lp_deserialize (tw_lp * lp, void * buffer);
96 size_t io_event_serialize (tw_event * e, void * buffer);
97 size_t io_event_deserialize (tw_event * e, void * buffer);
98 
99 // INLINE function for buffering events past end time
102 extern tw_event * io_event_grab(tw_pe *pe);
103 #endif
size_t io_lp_serialize(tw_lp *lp, void *buffer)
Definition: io-serialize.c:3
io_load_type g_io_load_at
Definition: io-mpi.c:21
Definition: io.h:21
tw_eventq g_io_free_events
Definition: io-mpi.c:25
void io_load_events(tw_pe *me)
Definition: io-mpi.c:227
void(* serialize_f)(void *state, void *buffer, tw_lp *lp)
Definition: io.h:41
void io_event_cancel(tw_event *e)
Definition: io-mpi.c:70
double tw_stime
Definition: ross.h:150
size_t io_lp_deserialize(tw_lp *lp, void *buffer)
Definition: io-serialize.c:27
int lp_count
Definition: io.h:60
Definition: io.h:20
Holds the entire PE state.
Definition: ross-types.h:375
int size
Definition: io.h:59
static int io_partition_field_count
Definition: io.h:63
tw_bf cv
Definition: io.h:77
double tw_normal_u1
Definition: io.h:69
void io_load_checkpoint(char *master_filename, io_load_type load_at)
Definition: io-mpi.c:107
static tw_rng * rng
Definition: rand-clcg4.c:23
uint64_t tw_lpid
Definition: ross.h:160
Event Stucture.
Definition: ross-types.h:250
tw_eventq g_io_buffered_events
Definition: io-mpi.c:24
tw_lpid src_lp
Definition: io.h:80
size_t(* model_size_f)(void *state, tw_lp *lp)
Definition: io.h:43
size_t io_event_deserialize(tw_event *e, void *buffer)
Definition: io-serialize.c:68
int g_io_number_of_files
Definition: io-mpi.c:11
const tw_optdef io_opts[3]
Definition: io-mpi.c:12
void io_store_checkpoint(char *master_filename, int data_file_number)
Definition: io-mpi.c:255
tw_stime recv_ts
Definition: io.h:81
double tw_normal_u2
Definition: io.h:70
model_size_f model_size
Definition: io.h:48
Definition: io.h:18
Reverse Computation Bitfield.
Definition: ross-types.h:178
int ev_count
Definition: io.h:61
void(* deserialize_f)(void *state, void *buffer, tw_lp *lp)
Definition: io.h:42
deserialize_f deserialize
Definition: io.h:47
void io_init()
Definition: io-mpi.c:75
void io_read_checkpoint()
Definition: io-mpi.c:112
io_partition * g_io_partitions
Definition: io-mpi.c:19
void io_register_model_version(char *sha1)
Definition: io-mpi.c:38
tw_event * io_event_grab(tw_pe *pe)
Definition: io-mpi.c:42
tw_lpid gid
Definition: io.h:66
int part
Definition: io.h:56
unsigned int critical_path
Definition: io.h:78
Definition: io.h:19
size_t io_event_serialize(tw_event *e, void *buffer)
Definition: io-serialize.c:52
tw_pe * pe
Definition: avl_tree.c:11
io_lptype * g_io_lp_types
Definition: io-mpi.c:20
int g_io_events_buffered_per_rank
Definition: io-mpi.c:23
int offset
Definition: io.h:58
Definition: io.h:65
tw_lpid dest_lp
Definition: io.h:79
enum io_load_e io_load_type
Definition: io.h:23
serialize_f serialize
Definition: io.h:46
char g_io_checkpoint_name[1024]
Definition: io-mpi.c:22
unsigned int critical_path
Definition: io.h:73
int file
Definition: io.h:57
Definition: io.h:45
void io_appending_job()
Definition: io-mpi.c:101
int tw_normal_flipflop
Definition: io.h:71
io_load_e
Definition: io.h:17
LP State Structure.
Definition: ross-types.h:304