/* * tw_pe_init: initialize individual PE structs * * id -- local compute node g_tw_pe array index * gid -- global (across all compute nodes) PE id */ void tw_pe_init(tw_peid id, tw_peid gid) { tw_pe *pe = (tw_pe *) tw_calloc(TW_LOC, "Local PE", sizeof(*pe), 1); tw_petype no_type; memset(&no_type, 0, sizeof(no_type)); pe->id = gid; pe->node = g_tw_mynode; tw_pe_settype(pe, &no_type); pe->trans_msg_ts = DBL_MAX; pe->gvt_status = 0; if(id == g_tw_npe-1) pe->pe_next = NULL; else pe->pe_next = &g_tw_pe[id+1]; if (g_tw_pe[id]) tw_error(TW_LOC, "PE %u already initialized", pe->id); g_tw_pe[id] = pe; g_tw_pe[id]->rng = tw_rand_init(31, 41); }
/* * tw_pe_init: initialize individual PE structs * */ void tw_pe_init(void) { if (g_tw_pe) tw_error(TW_LOC, "PE %u already initialized", g_tw_mynode); g_tw_pe = (tw_pe*)tw_calloc(TW_LOC, "PE Struct", sizeof(*g_tw_pe), 1); tw_petype no_type; memset(&no_type, 0, sizeof(no_type)); g_tw_pe->id = g_tw_mynode; tw_pe_settype(&no_type); g_tw_pe->trans_msg_ts = DBL_MAX; g_tw_pe->gvt_status = 0; // TODO is the PE RNG ever actually used? g_tw_pe->rng = tw_rand_init(31, 41); }