ROSS
tw-pe.c
Go to the documentation of this file.
1#include <ross.h>
2
3static void dummy_pe_f (tw_pe *pe)
4{
5 (void) pe;
6}
7
8void
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 */
31void
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
38 g_tw_pe->id = g_tw_mynode;
39
40 tw_petype no_type;
41 memset(&no_type, 0, sizeof(no_type));
42 tw_pe_settype(&no_type);
43
44#ifdef USE_RAND_TIEBREAKER
45 tw_copy_event_sig(&g_tw_pe->trans_msg_sig, &g_tw_max_sig);
46 tw_copy_event_sig(&g_tw_pe->GVT_prev_sig, &g_tw_max_sig);
47#else
48 g_tw_pe->trans_msg_ts = TW_STIME_MAX;
49 g_tw_pe->GVT_prev = TW_STIME_MAX;
50#endif
51 g_tw_pe->gvt_status = 0;
52
53 g_tw_pe->rng = tw_rand_init(31, 41);
54 g_tw_pe->core_rng = tw_rand_core_init(31, 41); // Core RNG must have same v & w values as main RNG
55
56 //If we're in (some variation of) optimistic mode, we need this hash
60 g_tw_pe->hash_t = tw_hash_create();
61 } else {
62 g_tw_pe->hash_t = NULL;
63 }
64
65}
66
67void
69{
70 tw_kp *kp;
71
72 unsigned int i;
73
75
76 for(i = 0; i < g_tw_nkp; i++)
77 {
78 kp = tw_getkp(i);
80 }
81
82}
tw_pe * pe
Definition avl_tree.c:10
void * tw_hash_create()
#define TW_STIME_MAX
Definition ross-base.h:45
void * tw_calloc(const char *file, int line, const char *for_who, size_t e_sz, size_t n)
Definition tw-util.c:206
tw_pe * g_tw_pe
Definition ross-global.c:79
tw_kpid g_tw_nkp
Definition ross-global.c:27
void tw_error(const char *file, int line, const char *fmt,...)
Definition tw-util.c:77
tw_peid g_tw_mynode
Definition ross-global.c:92
tw_synch g_tw_synchronization_protocol
Definition ross-global.c:19
int g_tw_fossil_attempts
Definition ross-global.c:30
#define TW_LOC
static tw_kp * tw_getkp(tw_kpid id)
tw_rng * tw_rand_core_init(uint32_t v, uint32_t w)
tw_rng * tw_rand_init(uint32_t v, uint32_t w)
tw_event_sig const g_tw_max_sig
static void tw_copy_event_sig(tw_event_sig *e, tw_event_sig const *sig)
Definition ross-types.h:493
@ OPTIMISTIC_REALTIME
Definition ross-types.h:41
@ OPTIMISTIC
Definition ross-types.h:39
@ OPTIMISTIC_DEBUG
Definition ross-types.h:40
static void tw_eventq_fossil_collect(tw_eventq *q, tw_pe *pe)
Definition tw-eventq.h:160
tw_eventq pevent_q
Events processed by LPs bound to this KP.
Definition ross-types.h:396
Holds the entire PE state.
Definition ross-types.h:416
Virtual Functions for per PE ops.
Definition ross-types.h:69
void tw_pe_init(void)
Definition tw-pe.c:32
void tw_pe_fossil_collect(void)
Definition tw-pe.c:68
static void dummy_pe_f(tw_pe *pe)
Definition tw-pe.c:3
void tw_pe_settype(const tw_petype *type)
Definition tw-pe.c:9
#define copy_pef(f, d)