Skip to content

Commit

Permalink
made avl_size a commandline flag instead of using cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
gonsie committed Jan 28, 2015
1 parent e517562 commit 2b24ecf
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
2 changes: 0 additions & 2 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ GET_GIT_HEAD_REVISION(GIT_REFSPEC GIT_SHA1)
# Data Structure for remote Events
# If AVL_TREE is OFF, ROSS reverts to hashing
OPTION(AVL_TREE "Use AVL trees for optimistic mode events? (hash tabels otherwise)" ON)
SET(AVL_TREE_SIZE 18 CACHE STRING "AVL Treet contians 2^AVL_TREE_SIZE nodes")
IF(AVL_TREE)
SET(ross_srcs ${ross_srcs} avl_tree.h avl_tree.c)
MATH( EXPR AVL_NODE_COUNT "1 << ${AVL_TREE_SIZE}" )
ENDIF(AVL_TREE)

# ROSS_MEMORY is either on or off depending on whether or not we desire
Expand Down
1 change: 0 additions & 1 deletion core/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#cmakedefine HAVE_CTIME 1
#define ROSS_VERSION "${GIT_SHA1}"
#cmakedefine AVL_TREE 1
#define AVL_NODE_COUNT ${AVL_NODE_COUNT}
#cmakedefine USE_BGPM
#cmakedefine ROSS_MEMORY
#cmakedefine RAND_NORMAL
Expand Down
9 changes: 5 additions & 4 deletions core/hash-quadratic.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ tw_hash_create()

g_tw_pe[0]->avl_tree_size = 0;

avl_list = (AvlTree) tw_calloc(TW_LOC, "avl tree", sizeof(struct avlNode), AVL_NODE_COUNT);
g_avl_node_count = 1 << g_tw_avl_node_count;
avl_list = (AvlTree) tw_calloc(TW_LOC, "avl tree", sizeof(struct avlNode), g_tw_avl_node_count);

for (i = 0; i < AVL_NODE_COUNT - 1; i++) {
for (i = 0; i < g_tw_avl_node_count - 1; i++) {
avl_list[i].next = &avl_list[i + 1];
}
avl_list[i].next = NULL;
Expand Down Expand Up @@ -179,7 +180,7 @@ find_entry(tw_event ** hash_t, tw_event * event, int hash_size, int pe)

if (key > hash_size)
{
tw_error(TW_LOC, "Cannot find event in hash table: PE %d, key %d, size %d\n",
tw_error(TW_LOC, "Cannot find event in hash table: PE %d, key %d, size %d\n",
pe, key, hash_size);
}
}
Expand Down Expand Up @@ -219,7 +220,7 @@ tw_hash_remove(void *h, tw_event * event, long pe)

hash_t->incoming[pe][key] = NULL;
(hash_t->num_stored[pe])--;

return ret_event;
#endif
}
Expand Down
5 changes: 3 additions & 2 deletions core/ross-extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern void tw_stats(tw_pe * me);
extern tw_synch g_tw_synchronization_protocol;
extern map_local_f g_tw_custom_lp_global_to_local_map;
extern map_custom_f g_tw_custom_initial_mapping;
extern tw_lp_map g_tw_mapping;
extern tw_lp_map g_tw_mapping;
extern tw_lpid g_tw_nlp;
extern tw_lpid g_tw_lp_offset;
extern tw_kpid g_tw_nkp;
Expand All @@ -33,6 +33,7 @@ extern size_t g_tw_event_msg_sz;
extern size_t g_tw_delta_sz;
extern uint32_t g_tw_buddy_alloc;
extern buddy_list_bucket_t *g_tw_buddy_master;
extern uint32_t g_tw_avl_node_count;

extern unsigned int g_tw_memory_nqueues;
extern size_t g_tw_memory_sz;
Expand Down Expand Up @@ -123,7 +124,7 @@ extern void tw_pe_settype(tw_pe *, const tw_petype * type);
extern void tw_pe_create(tw_peid npe);
extern void tw_pe_init(tw_peid id, tw_peid global);
extern void tw_pe_fossil_collect(tw_pe * me);
extern tw_fd tw_pe_memory_init(tw_pe * pe, size_t n_mem,
extern tw_fd tw_pe_memory_init(tw_pe * pe, size_t n_mem,
size_t d_sz, tw_stime mult);

/*
Expand Down
7 changes: 4 additions & 3 deletions core/ross-global.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* g_tw_nlp -- Number of LPs on this processor
* g_tw_lp_offset -- global id of g_tw_lp[0] (on this processor)
* g_tw_nkp -- Number of KPs on this processor
IF this is 1, then it gets over written as nkp_per_pe * g_tw_npe
IF this is 1, then it gets over written as nkp_per_pe * g_tw_npe
thus it is total KPs in simulation, not on this processor
* g_tw_lp -- Public LP object array (on this processor)
* g_tw_kp -- Public KP object array (on this processor)
Expand All @@ -18,7 +18,7 @@
tw_synch g_tw_synchronization_protocol=NO_SYNCH;
map_local_f g_tw_custom_lp_global_to_local_map=NULL;
map_custom_f g_tw_custom_initial_mapping=NULL;
tw_lp_map g_tw_mapping=LINEAR;
tw_lp_map g_tw_mapping=LINEAR;

tw_lpid g_tw_nlp = 0;
tw_lpid g_tw_lp_offset = 0;
Expand All @@ -34,10 +34,11 @@ size_t g_tw_msg_sz;
size_t g_tw_delta_sz = 0;
uint32_t g_tw_buddy_alloc = 0; /**< Allocation for buddy system */
buddy_list_bucket_t *g_tw_buddy_master = 0;
uint32_t g_tw_avl_node_count = 18;

#if ROSS_MEMORY
unsigned int g_tw_memory_nqueues = 64;
#else
#else
unsigned int g_tw_memory_nqueues = 0;
#endif

Expand Down
17 changes: 10 additions & 7 deletions core/tw-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ static const tw_optdef kernel_options[] = {
TWOPT_UINT("batch", g_tw_mblock, "messages per scheduler block"),
TWOPT_UINT("extramem", g_tw_events_per_pe_extra, "Number of extra events allocated per PE."),
TWOPT_UINT("buddy_size", g_tw_buddy_alloc, "delta encoding buddy system allocation (2^X)"),
#ifdef AVL_TREE
TWOPT_UINT("avl_size", g_tw_avl_node_count, "AVL Treet contians 2^avl_size nodes"),
#endif
TWOPT_END()
};

Expand Down Expand Up @@ -123,7 +126,7 @@ void map_linear(void) {

for(j = 0; j < nlp_per_kp && lpid < g_tw_nlp; j++, lpid++) {
tw_lp_onpe(lpid, pe, g_tw_lp_offset+lpid);
tw_lp_onkp(g_tw_lp[lpid], g_tw_kp[kpid]);
tw_lp_onkp(g_tw_lp[lpid], g_tw_kp[kpid]);

#if VERIFY_MAPPING
if(0 == j % 20) {
Expand Down Expand Up @@ -177,7 +180,7 @@ void tw_define_lps(tw_lpid nlp, size_t msg_sz, tw_seed * seed) {
int i;

g_tw_nlp = nlp;

#ifdef ROSS_MEMORY
g_tw_memory_sz = sizeof(tw_memory);
#endif
Expand Down Expand Up @@ -274,22 +277,22 @@ static void late_sanity_check(void) {
}

#ifdef USE_BGPM
unsigned cacheList[] = {
unsigned cacheList[] = {
PEVT_L2_HITS,
PEVT_L2_MISSES,
PEVT_L2_FETCH_LINE,
PEVT_L2_STORE_LINE,
};

unsigned instList[] = {
unsigned instList[] = {
PEVT_LSU_COMMIT_CACHEABLE_LDS,
PEVT_L1P_BAS_MISS,
PEVT_INST_XU_ALL,
PEVT_INST_QFPU_ALL,
PEVT_INST_QFPU_FPGRP1,
PEVT_INST_ALL,
};
#endif
#endif

void tw_run(void) {
tw_pe *me;
Expand Down Expand Up @@ -350,7 +353,7 @@ void tw_run(void) {
int numEvts = Bgpm_NumEvents(hEvtSet);
printf("\n \n ================================= \n");
printf( "Performance Counter Results:\n");
printf("--------------------------------- \n");
printf("--------------------------------- \n");
for (i=0; i<numEvts; i++) {
Bgpm_ReadEvent(hEvtSet, i, &cnt);
printf(" %40s = %20llu\n", Bgpm_GetEventLabel(hEvtSet, i), cnt);
Expand All @@ -377,7 +380,7 @@ int LZ4_compressBound(int isize);
*/
static void tw_delta_alloc(tw_pe *pe) {
g_tw_delta_sz = LZ4_compressBound(g_tw_delta_sz);

pe->delta_buffer[0] = tw_calloc(TW_LOC, "Delta buffers", g_tw_delta_sz, 1);
pe->delta_buffer[1] = tw_calloc(TW_LOC, "Delta buffers", g_tw_delta_sz, 1);
}
Expand Down

0 comments on commit 2b24ecf

Please sign in to comment.