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