ROSS
tw-pe.c
Go to the documentation of this file.
1 #include <ross.h>
2 
3 static void dummy_pe_f (tw_pe *pe)
4 {
5  (void) pe;
6 }
7 
8 void
9 tw_pe_settype(const tw_petype * type)
10 {
11  if (!g_tw_pe)
12  tw_error(TW_LOC, "Undefined PE!");
13 
14 #define copy_pef(f, d) \
15  g_tw_pe->type.f = type->f ? type->f : d
16 
17  copy_pef(pre_lp_init, dummy_pe_f);
18  copy_pef(post_lp_init, dummy_pe_f);
19  copy_pef(gvt, dummy_pe_f);
20  copy_pef(final, dummy_pe_f);
21 
22 #undef copy_pef
23 }
24 
25 /**
26  * initialize individual PE structs
27  *
28  * must be called after tw_nnodes / MPI world size is set.
29  *
30  */
31 void
33 {
34  if (g_tw_pe) tw_error(TW_LOC, "PE %u already initialized", g_tw_mynode);
35 
36  g_tw_pe = (tw_pe*)tw_calloc(TW_LOC, "PE Struct", sizeof(*g_tw_pe), 1);
37 
39 
40  tw_petype no_type;
41  memset(&no_type, 0, sizeof(no_type));
42  tw_pe_settype(&no_type);
43 
44  g_tw_pe->trans_msg_ts = DBL_MAX;
45  g_tw_pe->gvt_status = 0;
46 
47  // TODO is the PE RNG ever actually used?
48  g_tw_pe->rng = tw_rand_init(31, 41);
49 
50  //If we're in (some variation of) optimistic mode, we need this hash
55  } else {
56  g_tw_pe->hash_t = NULL;
57  }
58 
59 }
60 
61 void
63 {
64  tw_kp *kp;
65 
66  unsigned int i;
67 
69 
70  for(i = 0; i < g_tw_nkp; i++)
71  {
72  kp = tw_getkp(i);
74  }
75 
76 }
tw_synch g_tw_synchronization_protocol
Definition: ross-global.c:18
#define TW_LOC
Definition: ross-extern.h:164
void * tw_hash_create()
tw_rng * tw_rand_init(uint32_t v, uint32_t w)
Definition: ross-random.c:7
void tw_pe_fossil_collect(void)
Definition: tw-pe.c:62
unsigned char gvt_status
Bits available for gvt computation.
Definition: ross-types.h:400
void tw_error(const char *file, int line, const char *fmt,...) NORETURN
Definition: tw-util.c:74
void tw_pe_settype(const tw_petype *type)
Definition: tw-pe.c:9
tw_stime trans_msg_ts
Last transient messages' time stamp.
Definition: ross-types.h:402
Holds the entire PE state.
Definition: ross-types.h:375
tw_eventq pevent_q
Events processed by LPs bound to this KP.
Definition: ross-types.h:359
static tw_kp * tw_getkp(tw_kpid id)
void * hash_t
Array of incoming events from remote pes, Note: only necessary for distributed DSR.
Definition: ross-types.h:418
void tw_pe_init(void)
Definition: tw-pe.c:32
static void tw_eventq_fossil_collect(tw_eventq *q, tw_pe *pe)
Definition: tw-eventq.h:134
tw_peid g_tw_mynode
Definition: ross-global.c:88
tw_rng * rng
Pointer to the random number generator on this PE.
Definition: ross-types.h:426
int g_tw_fossil_attempts
Definition: ross-global.c:28
tw_pe * g_tw_pe
Definition: ross-global.c:75
static void dummy_pe_f(tw_pe *pe)
Definition: tw-pe.c:3
tw_pe * pe
Definition: avl_tree.c:11
#define copy_pef(f, d)
Virtual Functions for per PE ops.
Definition: ross-types.h:59
tw_kpid g_tw_nkp
Definition: ross-global.c:25
tw_peid id
Definition: ross-types.h:376
void * tw_calloc(const char *file, int line, const char *for_who, size_t e_sz, size_t n)
Definition: tw-util.c:203