From d70eab3aaab425170a86ec1b2124cadd9202d7d6 Mon Sep 17 00:00:00 2001 From: Caitlin Ross Date: Mon, 29 Apr 2019 17:57:38 -0400 Subject: [PATCH 1/9] ROSS cleanup (#135) This commit fixes warnings when building with -Wall and -Wextra. In addition, removes old unused code related to prior pthread versions of ROSS as well as removing the ROSS_MEMORY related code, due to no longer being fully functional. * fixing warnings when building with Wall, etc * fixing warnings in buddy.c * fixing warnings in the rest of ROSS core * fixing warnings in instrumentation * fixing warnings with phold * fixing undefined reference causing linking error * adding warning flags to Travis builds * fixing some additional warnings that appear in release builds * minor changes to travis builds * removing old, unnecessary pthread related code * fixing ifdefs for ROSS_MEMORY * removing tw-memory related stuff for now * removing some unused stuff and unnecessary function arguments * lots of documentation for network-mpi and removing some unnecessary stuff * keeping the ROSS models submodule from being used in Travis tests * minor fix for C++ Travis build * adding installing phold to bin * adding some RPATH commands to CMakeLists.txt for Spack * removed ROSS-Models and template model submodule * update readme for submodule details * rpath in pkg-config * adding develop branch to Travis safelist --- .gitmodules | 6 - .travis.yml | 14 +- CMakeLists.txt | 29 ++ README.md | 5 +- core/CMakeLists.txt | 1 - core/avl_tree.c | 10 +- core/buddy.c | 19 +- core/config.h.in | 1 - core/gvt/mpi_allreduce.c | 16 +- core/gvt/mpi_allreduce.h | 4 +- core/hash-quadratic.c | 30 +- core/instrumentation/ross-lps/analysis-lp.c | 9 +- .../ross-lps/specialized-lps.c | 2 +- core/instrumentation/st-event-trace.c | 2 +- core/instrumentation/st-instrumentation.h | 4 +- core/instrumentation/st-model-data.c | 3 +- core/instrumentation/st-sim-engine.c | 10 +- core/instrumentation/st-stats-buffer.c | 9 +- core/network-mpi.c | 277 +++++------------- core/network-mpi.h | 99 ++++++- core/rand-clcg4.c | 2 +- core/ross-extern.h | 92 +++--- core/ross-global.c | 25 +- core/ross-gvt.h | 4 +- core/ross-inline.h | 133 +-------- core/ross-kernel-inline.h | 53 +--- core/ross-network.h | 57 ---- core/ross-types.h | 57 +--- core/ross.h | 13 +- core/ross.pc.in | 2 +- core/tw-event.c | 6 +- core/tw-eventq.h | 10 +- core/tw-kp.c | 75 ----- core/tw-lp.c | 2 +- core/tw-memory.c | 66 ----- core/tw-memory.h | 123 -------- core/tw-memoryq.h | 220 -------------- core/tw-pe.c | 94 ++---- core/tw-sched.c | 52 ++-- core/tw-setup.c | 140 ++++----- core/tw-signal.c | 13 +- core/tw-state.c | 10 +- core/tw-stats.c | 111 ++++--- core/tw-util.c | 4 +- models/ROSS-Models | 1 - models/phold/CMakeLists.txt | 2 + models/phold/phold.c | 37 ++- models/template-model | 1 - 48 files changed, 546 insertions(+), 1409 deletions(-) delete mode 100644 core/ross-network.h delete mode 100644 core/tw-memory.c delete mode 100644 core/tw-memory.h delete mode 100644 core/tw-memoryq.h delete mode 160000 models/ROSS-Models delete mode 160000 models/template-model diff --git a/.gitmodules b/.gitmodules index e60942a31..f1f549816 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,3 @@ -[submodule "models/template-model"] - path = models/template-model - url = https://github.com/ROSS-org/template-model.git -[submodule "models/ROSS-Models"] - path = models/ROSS-Models - url = https://github.com/carothersc/ROSS-Models [submodule "damaris"] path = core/damaris url = https://github.com/caitlinross/ROSS-damaris diff --git a/.travis.yml b/.travis.yml index 2feed6603..1d22bb933 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,8 @@ notifications: on_failure: always env: - secure: "BbB1KVY0Yb6DJwxdfFDF1PJwSx9euNfNX94oDKftiH8LE0nEzfS6xZc2sBkWTWOThHml9ttBkDIx/NhxEThOjyVcX6uv4kibP6moV5EqxqC+kLoZSEZnVuAdTJfGRKBdzmRp66R5a/GiMzzz/F3+smdVFMb6XR06sPQa5TQZjEc=" +git: + submodules: false before_install: - sudo apt-add-repository -y ppa:libreoffice/libreoffice-4-2 - sudo apt-get update -q @@ -21,29 +23,31 @@ before_install: - mpirun --version script: - mkdir cxx-build && cd cxx-build - - cmake -DCMAKE_BUILD_TYPE=Release .. + - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Wall -Wextra" .. - export MPICH_CC=clang++ - make - unset MPICH_CC - cd .. - mkdir release && cd release - - MPICH_CC=clang cmake -DCMAKE_BUILD_TYPE=Release -DROSS_BUILD_MODELS=ON .. + - MPICH_CC=clang cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Wall -Wextra" -DROSS_BUILD_MODELS=ON .. - make - CTEST_OUTPUT_ON_FAILURE=1 make test - cd .. - mkdir build && cd build - - MPICH_CC=clang cmake -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug -DROSS_BUILD_MODELS=ON .. + - MPICH_CC=clang cmake -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Wall -Wextra" -DROSS_BUILD_MODELS=ON .. - make - CTEST_OUTPUT_ON_FAILURE=1 make test - make coveralls - cd .. - mkdir build2 && cd build2 - - MPICH_CC=clang cmake -DAVL_TREE=OFF -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug -DROSS_BUILD_MODELS=ON .. + - MPICH_CC=clang cmake -DAVL_TREE=OFF -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Wall -Wextra" -DROSS_BUILD_MODELS=ON .. - make - CTEST_OUTPUT_ON_FAILURE=1 make test - make coveralls branches: - only: master + only: + - master + - develop after_success: - bash <(curl -s https://codecov.io/bash) - ## the following automatically builds the doxygen diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dfc26de9..b827f4162 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,35 @@ INCLUDE(CTest) LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/core/cmake/") +# Follow section based on Spack doc: +# https://spack.readthedocs.io/en/latest/workflows.html#write-the-cmake-build +# enable @rpath in the install name for any shared library being built +# note: it is planned that a future version of CMake will enable this by default +set(CMAKE_MACOSX_RPATH 1) + +# Always use full RPATH +# http://www.cmake.org/Wiki/CMake_RPATH_handling +# http://www.kitware.com/blog/home/post/510 + +# use, i.e. don't skip the full RPATH for the build tree +SET(CMAKE_SKIP_BUILD_RPATH FALSE) + +# when building, don't use the install RPATH already +# (but later on when installing) +SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +# add the automatically determined parts of the RPATH +# which point to directories outside the build tree to the install RPATH +SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +# the RPATH to be used when installing, but only if it's not a system directory +LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) +IF("${isSystemDir}" STREQUAL "-1") + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +ENDIF("${isSystemDir}" STREQUAL "-1") + +# end of spack-related addition + # We probably don't want this to run on every build. option(COVERALLS "Generate coveralls data" OFF) diff --git a/README.md b/README.md index ecdbd65a7..97caeac99 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,8 @@ Developed as Simplified ROSS ([gonsie/SR](http://github.com/gonsie/SR)), this ve git submodule init git submodule update ``` - Currently, ROSS includes three submodules: - - [ROSS-Models](http://github.com/ROSS-org/ROSS-Models) is a set of existing models - - [template-model](http://github.com/ROSS-org/template-model) is a starting place for new models + Currently, ROSS includes one submodule: + - [damaris aka RISA](https://github.com/ROSS-org/RISA) ROSS In Situ Analysis 3. *Optional* Symlink your model to ROSS. Please [this wiki page](https://github.com/ROSS-org/ROSS/wiki/Constructing-the-Model) for details about creating and integrating a model with ROSS. diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 83ca30d95..9f1c2ca06 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -18,7 +18,6 @@ ross-gvt.h gvt/${GVT}.h gvt/${GVT}.c -ross-network.h network-${NETWORK}.h network-${NETWORK}.c diff --git a/core/avl_tree.c b/core/avl_tree.c index 6b12bd037..e9c454c4a 100644 --- a/core/avl_tree.c +++ b/core/avl_tree.c @@ -299,10 +299,10 @@ avlDelete(AvlTree *t, tw_event *key) AvlTree avl_alloc(void) { - AvlTree head = g_tw_pe[0]->avl_list_head; - g_tw_pe[0]->avl_list_head = head->next; + AvlTree head = g_tw_pe->avl_list_head; + g_tw_pe->avl_list_head = head->next; - if (g_tw_pe[0]->avl_list_head == NULL) { + if (g_tw_pe->avl_list_head == NULL) { tw_error(TW_LOC, "AVL tree out of memory.\nIncrease avl-size beyond %d\n", (int)log2(g_tw_avl_node_count)); @@ -320,6 +320,6 @@ void avl_free(AvlTree t) (t)->next = NULL; (t)->key = NULL; (t)->height = 0; - (t)->next = g_tw_pe[0]->avl_list_head; - g_tw_pe[0]->avl_list_head = t; + (t)->next = g_tw_pe->avl_list_head; + g_tw_pe->avl_list_head = t; } diff --git a/core/buddy.c b/core/buddy.c index b074f73aa..4a4643aee 100644 --- a/core/buddy.c +++ b/core/buddy.c @@ -44,9 +44,9 @@ int dump_buddy_table(buddy_list_bucket_t *buddy_master) buddy_list_bucket_t *blbt = buddy_master; while (1) { - int counter = 0; + unsigned int counter = 0; - printf("BLBT %p:\n", blbt); + printf("BLBT %p:\n", (void*)blbt); printf(" Count: %d\n", blbt->count); printf(" Order: %d\n", blbt->order); if (blbt->is_valid == VALID) @@ -58,10 +58,10 @@ int dump_buddy_table(buddy_list_bucket_t *buddy_master) LIST_FOREACH(blt, &blbt->ptr, next_freelist) { counter++; if (blt->use == FREE) - printf(" %11p%8s%16d\n", blt, "FREE", blt->size); + printf(" %11p%8s%16d\n", (void*)blt, "FREE", blt->size); else - printf(" %11p%8s%16d\n", blt, "USED", blt->size); - assert(next_power2(blt->size) == (1 << blbt->order)); + printf(" %11p%8s%16d\n", (void*)blt, "USED", blt->size); + assert(next_power2(blt->size) == (unsigned int) (1 << blbt->order)); } printf("\n"); assert(counter == blbt->count && "Count is incorrect!"); @@ -88,7 +88,7 @@ int buddy_try_merge(buddy_list_t *blt) unsigned int size = blt->size + sizeof(buddy_list_t); buddy_list_bucket_t *blbt = g_tw_buddy_master; // Find the bucket we need - while (size > (1 << blbt->order)) { + while (size > (unsigned int)(1 << blbt->order)) { blbt++; } // We need to normalize for the "buddy formula" to work @@ -144,7 +144,7 @@ void buddy_free(void *ptr) // Find the bucket we need buddy_list_bucket_t *blbt = g_tw_buddy_master; - while (size > (1 << blbt->order)) { + while (size > (unsigned int)(1 << blbt->order)) { blbt++; } @@ -161,7 +161,8 @@ void buddy_free(void *ptr) assert(0 && "buddy with FREE status not in freelist"); } - int initial_count = blbt->count; + unsigned int initial_count = blbt->count; + (void) initial_count; // quiet compiler when building Release // If there are no entries here, we can't have a buddy if (blbt->count == 0) { @@ -240,7 +241,7 @@ void *buddy_alloc(unsigned size) // Find the bucket we need buddy_list_bucket_t *blbt = g_tw_buddy_master; - while (size > (1 << blbt->order)) { + while (size > (unsigned int)(1 << blbt->order)) { blbt++; if (blbt->is_valid == INVALID) { // Error: we're out of bound for valid BLBTs diff --git a/core/config.h.in b/core/config.h.in index a397082cc..6e1f5b76d 100644 --- a/core/config.h.in +++ b/core/config.h.in @@ -11,7 +11,6 @@ #define ROSS_VERSION "${GIT_SHA1}" #cmakedefine AVL_TREE 1 #cmakedefine USE_BGPM -#cmakedefine ROSS_MEMORY #cmakedefine RAND_NORMAL #cmakedefine ROSS_timing #cmakedefine ROSS_runtime_checks diff --git a/core/gvt/mpi_allreduce.c b/core/gvt/mpi_allreduce.c index b0b9a0854..87c14d620 100644 --- a/core/gvt/mpi_allreduce.c +++ b/core/gvt/mpi_allreduce.c @@ -37,14 +37,14 @@ tw_gvt_start(void) } void -tw_gvt_force_update(tw_pe *me) +tw_gvt_force_update(void) { gvt_force++; gvt_cnt = g_tw_gvt_interval; } void -tw_gvt_force_update_realtime(tw_pe *me) +tw_gvt_force_update_realtime(void) { gvt_force++; g_tw_gvt_interval_start_cycles = 0; // reset to start of time @@ -85,10 +85,10 @@ tw_gvt_step1_realtime(tw_pe *me) ( ((current_rt = tw_clock_read()) - g_tw_gvt_interval_start_cycles < g_tw_gvt_realtime_interval) && (tw_pq_minimum(me->pq) - me->GVT < g_tw_max_opt_lookahead))) { - /* if( me->node == 0 ) */ + /* if( me->id == 0 ) */ /* { */ /* printf("GVT Step 1 RT Rank %ld: found start_cycles at %llu, rt interval at %llu, current time at %llu \n", */ - /* me->node, g_tw_gvt_interval_start_cycles, g_tw_gvt_realtime_interval, current_rt); */ + /* me->id, g_tw_gvt_interval_start_cycles, g_tw_gvt_realtime_interval, current_rt); */ /* } */ @@ -139,7 +139,7 @@ tw_gvt_step2(tw_pe *me) } pq_min = tw_pq_minimum(me->pq); - net_min = tw_net_minimum(me); + net_min = tw_net_minimum(); lvt = me->trans_msg_ts; if(lvt > pq_min) @@ -203,12 +203,12 @@ tw_gvt_step2(tw_pe *me) g_tw_synchronization_protocol == OPTIMISTIC_REALTIME ) { start = tw_clock_read(); - tw_pe_fossil_collect(me); + tw_pe_fossil_collect(); me->stats.s_fossil_collect += tw_clock_read() - start; } // do any necessary instrumentation calls - if ((g_st_engine_stats == GVT_STATS || g_st_engine_stats == ALL_STATS) && + if ((g_st_engine_stats == GVT_STATS || g_st_engine_stats == ALL_STATS) && g_tw_gvt_done % g_st_num_gvt == 0 && gvt <= g_tw_ts_end) { #ifdef USE_DAMARIS @@ -234,7 +234,7 @@ tw_gvt_step2(tw_pe *me) if ((g_st_model_stats == GVT_STATS || g_st_model_stats == ALL_STATS) && g_tw_gvt_done % g_st_num_gvt == 0) st_collect_model_data(me, (tw_stime)tw_clock_read() / g_tw_clock_rate, GVT_STATS); - + st_inst_dump(); // done with instrumentation related stuff diff --git a/core/gvt/mpi_allreduce.h b/core/gvt/mpi_allreduce.h index 22f09cb79..346b2ba3b 100644 --- a/core/gvt/mpi_allreduce.h +++ b/core/gvt/mpi_allreduce.h @@ -25,7 +25,7 @@ gvt_print(tw_stime gvt) printf("GVT #%d: simulation %d%% complete, max event queue size %u (", g_tw_gvt_done, (int) ROSS_MIN(100, floor(100 * (gvt/g_tw_ts_end))), - tw_pq_max_size(g_tw_pe[0]->pq)); + tw_pq_max_size(g_tw_pe->pq)); if (gvt == DBL_MAX) printf("GVT = %s", "MAX"); @@ -35,7 +35,7 @@ gvt_print(tw_stime gvt) printf(").\n"); #ifdef AVL_TREE - printf("AVL tree size: %d\n", g_tw_pe[0]->avl_tree_size); + printf("AVL tree size: %d\n", g_tw_pe->avl_tree_size); #endif percent_complete += gvt_print_interval; diff --git a/core/hash-quadratic.c b/core/hash-quadratic.c index 40d41e2cd..133787622 100644 --- a/core/hash-quadratic.c +++ b/core/hash-quadratic.c @@ -3,13 +3,15 @@ #include "avl_tree.h" #endif /* AVL_TREE */ +#ifndef AVL_TREE static void rehash(tw_hash * hash_t, int pe); -static int find_empty(tw_event ** hash_t, tw_event * event, int hash_size); static int find_entry(tw_event ** hash_t, tw_event * event, int hash_size, int pe); static void insert(tw_event ** hash_t, tw_event * event, int hash_size); +static int find_empty(tw_event ** hash_t, tw_event * event, int hash_size); +static int next_prime(int ptst); static tw_event **allocate_table(int hash_size); static int hash_(tw_eventid event_id, int hash_size); -static int next_prime(int ptst); +#endif static int is_prime(int ptst); tw_event *hash_search(tw_event ** hash_t, tw_event *evt, int size); @@ -18,20 +20,22 @@ void hash_print(tw_hash * h); static unsigned int ncpu = 1; unsigned int g_tw_hash_size = 31; +#ifndef AVL_TREE int hash_(tw_eventid event_id, int hash_size) { return event_id % hash_size; } +#endif void * tw_hash_create() { #ifdef AVL_TREE - int i; + unsigned int i; AvlTree avl_list; - g_tw_pe[0]->avl_tree_size = 0; + g_tw_pe->avl_tree_size = 0; g_tw_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); @@ -41,7 +45,7 @@ tw_hash_create() } avl_list[i].next = NULL; - g_tw_pe[0]->avl_list_head = &avl_list[0]; + g_tw_pe->avl_list_head = &avl_list[0]; return NULL; #else @@ -76,13 +80,15 @@ void tw_hash_insert(void *h, tw_event * event, long pe) { #ifdef AVL_TREE + (void) h; + (void) pe; tw_clock start; - g_tw_pe[0]->avl_tree_size++; + g_tw_pe->avl_tree_size++; start = tw_clock_read(); avlInsert(&event->dest_lp->kp->avl_tree, event); - g_tw_pe[0]->stats.s_avl += tw_clock_read() - start; + g_tw_pe->stats.s_avl += tw_clock_read() - start; #else tw_hash *hash_t; @@ -98,6 +104,7 @@ tw_hash_insert(void *h, tw_event * event, long pe) #endif } +#ifndef AVL_TREE void insert(tw_event ** hash_t, tw_event * event, int hash_size) { @@ -193,19 +200,22 @@ allocate_table(int hash_size) { return (tw_event **) tw_calloc(TW_LOC, "tw_hash", sizeof(tw_event *) * hash_size, 1); } +#endif tw_event * tw_hash_remove(void *h, tw_event * event, long pe) { #if AVL_TREE + (void) h; + (void) pe; tw_event *ret; tw_clock start; - g_tw_pe[0]->avl_tree_size--; + g_tw_pe->avl_tree_size--; start = tw_clock_read(); ret = avlDelete(&event->dest_lp->kp->avl_tree, event); - g_tw_pe[0]->stats.s_avl += tw_clock_read() - start; + g_tw_pe->stats.s_avl += tw_clock_read() - start; return ret; #else tw_hash *hash_t = (tw_hash *) h; @@ -295,7 +305,7 @@ hash_search(tw_event ** hash_t, tw_event *evt, int size) void hash_print(tw_hash * h) { - int i, j, empty; + unsigned int i, j, empty; unsigned int *sizes = h->hash_sizes; int *stored = h->num_stored; tw_event **hash_t; diff --git a/core/instrumentation/ross-lps/analysis-lp.c b/core/instrumentation/ross-lps/analysis-lp.c index 1eb1fe7fe..515dae01c 100644 --- a/core/instrumentation/ross-lps/analysis-lp.c +++ b/core/instrumentation/ross-lps/analysis-lp.c @@ -29,7 +29,7 @@ void analysis_init(analysis_state *s, tw_lp *lp) s->lp_list_sim[i] = ULLONG_MAX; } - for (i = 0; i < g_tw_nlp; i++) + for (i = 0; (unsigned int)i < g_tw_nlp; i++) { cur_lp = g_tw_lp[i]; @@ -146,7 +146,7 @@ void analysis_event(analysis_state *s, tw_bf *bf, analysis_msg *m, tw_lp *lp) void analysis_event_rc(analysis_state *s, tw_bf *bf, analysis_msg *m, tw_lp *lp) { tw_lp *model_lp; - int i, j; + int j; lp->pe->stats.s_alp_e_rbs++; @@ -198,11 +198,13 @@ void analysis_event_rc(analysis_state *s, tw_bf *bf, analysis_msg *m, tw_lp *lp) void analysis_commit(analysis_state *s, tw_bf *bf, analysis_msg *m, tw_lp *lp) { + (void) bf; + (void) lp; if ((g_st_model_stats == VT_STATS || g_st_model_stats == ALL_STATS) && s->num_lps > 0) { // write committed data to buffer model_sample_data *sample; - int i, j; + int j; tw_lp *model_lp; lp_metadata metadata; // start at beginning @@ -255,6 +257,7 @@ void analysis_commit(analysis_state *s, tw_bf *bf, analysis_msg *m, tw_lp *lp) void analysis_finish(analysis_state *s, tw_lp *lp) { + (void) lp; // TODO all samples should be written by the commit function, right? // Does anything actually need to be done here? if (s->model_samples_head != s->model_samples_current) diff --git a/core/instrumentation/ross-lps/specialized-lps.c b/core/instrumentation/ross-lps/specialized-lps.c index 48332c4ca..58a33514f 100644 --- a/core/instrumentation/ross-lps/specialized-lps.c +++ b/core/instrumentation/ross-lps/specialized-lps.c @@ -43,7 +43,7 @@ void specialized_lp_init_mapping() tw_lpid lpid; for(lpid = 0; lpid < g_st_analysis_nlp; lpid++) { - tw_lp_onpe(g_tw_nlp + lpid, g_tw_pe[0], analysis_start_gid + g_tw_mynode * g_st_analysis_nlp + lpid); + tw_lp_onpe(g_tw_nlp + lpid, g_tw_pe, analysis_start_gid + g_tw_mynode * g_st_analysis_nlp + lpid); tw_lp_onkp(g_tw_lp[g_tw_nlp + lpid], g_tw_kp[lpid]); // analysis lpid == kpid st_analysis_lp_settype(g_tw_nlp + lpid); } diff --git a/core/instrumentation/st-event-trace.c b/core/instrumentation/st-event-trace.c index db2bb48f7..c432cf959 100644 --- a/core/instrumentation/st-event-trace.c +++ b/core/instrumentation/st-event-trace.c @@ -46,6 +46,6 @@ void st_collect_event_data(tw_event *cev, tw_stime recv_rt) fwrite(buffer, total_sz, 1, seq_ev_trace); } - g_tw_pe[0]->stats.s_stat_comp += tw_clock_read() - start_cycle_time; + g_tw_pe->stats.s_stat_comp += tw_clock_read() - start_cycle_time; } diff --git a/core/instrumentation/st-instrumentation.h b/core/instrumentation/st-instrumentation.h index 91ac3514c..59a28b3d1 100644 --- a/core/instrumentation/st-instrumentation.h +++ b/core/instrumentation/st-instrumentation.h @@ -162,8 +162,8 @@ struct st_lp_stats{ void st_collect_engine_data(tw_pe *me, int col_type); void st_collect_engine_data_pes(tw_pe *pe, sample_metadata *sample_md, tw_statistics *s, int col_type); -void st_collect_engine_data_kps(tw_pe *me, tw_kp *kp, sample_metadata *sample_md, tw_statistics *s, int col_type); -void st_collect_engine_data_lps(tw_pe *me, tw_lp *lp, sample_metadata *sample_md, tw_statistics *s, int col_type); +void st_collect_engine_data_kps(tw_pe *me, tw_kp *kp, sample_metadata *sample_md, int col_type); +void st_collect_engine_data_lps(tw_lp *lp, sample_metadata *sample_md, int col_type); /* * st-event-trace.c diff --git a/core/instrumentation/st-model-data.c b/core/instrumentation/st-model-data.c index 89bee6f91..b7246ce4c 100644 --- a/core/instrumentation/st-model-data.c +++ b/core/instrumentation/st-model-data.c @@ -45,7 +45,8 @@ void st_model_settype(tw_lpid i, st_model_types *model_types) void st_collect_model_data(tw_pe *pe, tw_stime current_rt, int stats_type) { tw_clock start_cycle_time = tw_clock_read(); - int index, lpid = 0; + int index; + tw_lpid lpid = 0; int total_sz = 0; tw_lp *clp; sample_metadata sample_md; diff --git a/core/instrumentation/st-sim-engine.c b/core/instrumentation/st-sim-engine.c index 1d625cb19..8f3c55b4c 100644 --- a/core/instrumentation/st-sim-engine.c +++ b/core/instrumentation/st-sim-engine.c @@ -12,7 +12,7 @@ void st_collect_engine_data(tw_pe *pe, int col_type) tw_clock start_time = tw_clock_read(); tw_kp *kp; tw_lp *lp; - int i; + unsigned int i; tw_statistics s; bzero(&s, sizeof(s)); tw_get_stats(pe, &s); @@ -28,7 +28,7 @@ void st_collect_engine_data(tw_pe *pe, int col_type) for (i = 0; i < g_tw_nkp; i++) { kp = tw_getkp(i); - st_collect_engine_data_kps(pe, kp, &sample_md, &s, col_type); + st_collect_engine_data_kps(pe, kp, &sample_md, col_type); } } if (g_st_lp_data) @@ -36,7 +36,7 @@ void st_collect_engine_data(tw_pe *pe, int col_type) for (i = 0; i < g_tw_nlp; i++) { lp = tw_getlp(i); - st_collect_engine_data_lps(pe, lp, &sample_md, &s, col_type); + st_collect_engine_data_lps(lp, &sample_md, col_type); } } pe->stats.s_stat_comp += tw_clock_read() - start_time; @@ -99,7 +99,7 @@ void st_collect_engine_data_pes(tw_pe *pe, sample_metadata *sample_md, tw_statis last_all_reduce_cnt = all_reduce_cnt; } -void st_collect_engine_data_kps(tw_pe *pe, tw_kp *kp, sample_metadata *sample_md, tw_statistics *s, int col_type) +void st_collect_engine_data_kps(tw_pe *pe, tw_kp *kp, sample_metadata *sample_md, int col_type) { st_kp_stats kp_stats; int buf_size = sizeof(*sample_md) + sizeof(kp_stats); @@ -142,7 +142,7 @@ void st_collect_engine_data_kps(tw_pe *pe, tw_kp *kp, sample_metadata *sample_md st_buffer_push(col_type, &buffer[0], buf_size); } -void st_collect_engine_data_lps(tw_pe *pe, tw_lp *lp, sample_metadata *sample_md, tw_statistics *s, int col_type) +void st_collect_engine_data_lps(tw_lp *lp, sample_metadata *sample_md, int col_type) { st_lp_stats lp_stats; int buf_size = sizeof(*sample_md) + sizeof(lp_stats); diff --git a/core/instrumentation/st-stats-buffer.c b/core/instrumentation/st-stats-buffer.c index 45196e710..5781899f8 100644 --- a/core/instrumentation/st-stats-buffer.c +++ b/core/instrumentation/st-stats-buffer.c @@ -61,7 +61,6 @@ void st_buffer_allocate() */ void st_buffer_init(int type) { - int i; char filename[INST_MAX_LENGTH]; file_suffix[0] = "gvt"; file_suffix[1] = "rt"; @@ -141,7 +140,7 @@ void st_buffer_write(int end_of_sim, int type) MPI_File *fh = &buffer_fh[type]; int write_to_file = 0; int my_write_size = 0; - int i; + unsigned int i; int write_sizes[tw_nnodes()]; tw_clock start_cycle_time = tw_clock_read(); @@ -170,10 +169,10 @@ void st_buffer_write(int end_of_sim, int type) //printf("rank %ld writing %d bytes at offset %lld (prev_offsets[ANALYSIS_LP] = %lld)\n", g_tw_mynode, my_write_size, offset, prev_offsets[type]); // dump buffer to file MPI_Status status; - g_tw_pe[0]->stats.s_stat_comp += tw_clock_read() - start_cycle_time; + g_tw_pe->stats.s_stat_comp += tw_clock_read() - start_cycle_time; start_cycle_time = tw_clock_read(); MPI_File_write_at_all(*fh, offset, st_buffer_read_ptr(g_st_buffer[type]), my_write_size, MPI_BYTE, &status); - g_tw_pe[0]->stats.s_stat_write += tw_clock_read() - start_cycle_time; + g_tw_pe->stats.s_stat_write += tw_clock_read() - start_cycle_time; // reset the buffer g_st_buffer[type]->write_pos = 0; @@ -182,7 +181,7 @@ void st_buffer_write(int end_of_sim, int type) buffer_overflow_warned = 0; } else - g_tw_pe[0]->stats.s_stat_comp += tw_clock_read() - start_cycle_time; + g_tw_pe->stats.s_stat_comp += tw_clock_read() - start_cycle_time; } /* make sure we write out any remaining buffer data */ diff --git a/core/network-mpi.c b/core/network-mpi.c index f98b6b9c8..306bffcd3 100644 --- a/core/network-mpi.c +++ b/core/network-mpi.c @@ -4,30 +4,24 @@ MPI_Comm MPI_COMM_ROSS = MPI_COMM_WORLD; int custom_communicator = 0; -static long id_tmp; - +/** + * @struct act_q + * @brief Keeps track of posted send or recv operations. + */ struct act_q { - const char *name; - - tw_event **event_list; - MPI_Request *req_list; - int *idx_list; - MPI_Status *status_list; -#if ROSS_MEMORY - char **buffers; -#endif + const char *name; - unsigned int cur; + tw_event **event_list; /**< list of event pointers in this queue */ + MPI_Request *req_list; /**< list of MPI request handles */ + int *idx_list; /**< indices in this queue of finished operations */ + MPI_Status *status_list; /**< list of MPI_Status handles */ + unsigned int cur; /**< index of first open spot in the queue */ }; #define EVENT_TAG 1 -#if ROSS_MEMORY -#define EVENT_SIZE(e) TW_MEMORY_BUFFER_SIZE -#else #define EVENT_SIZE(e) g_tw_event_msg_sz -#endif static struct act_q posted_sends; static struct act_q posted_recvs; @@ -80,17 +74,20 @@ tw_net_init(int *argc, char ***argv) g_tw_masternode = 0; g_tw_mynode = my_rank; - + return mpi_opts; } +/** + * @brief Initializes queues used for posted sends and receives + * + * @param[in] q pointer to the queue to be initialized + * @param[in] name name of the queue + */ static void init_q(struct act_q *q, const char *name) { unsigned int n; -#if ROSS_MEMORY - unsigned int i; -#endif if(q == &posted_sends) n = send_buffer; @@ -102,18 +99,6 @@ init_q(struct act_q *q, const char *name) q->req_list = (MPI_Request *) tw_calloc(TW_LOC, name, sizeof(*q->req_list), n); q->idx_list = (int *) tw_calloc(TW_LOC, name, sizeof(*q->idx_list), n); q->status_list = (MPI_Status *) tw_calloc(TW_LOC, name, sizeof(*q->status_list), n); - -#if ROSS_MEMORY - q->buffers = tw_calloc(TW_LOC, name, sizeof(*q->buffers), n); - - for(i = 0; i < n; i++) - q->buffers[i] = tw_calloc(TW_LOC, "", TW_MEMORY_BUFFER_SIZE, 1); -#endif -} - -tw_node * tw_net_onnode(tw_peid gid) { - id_tmp = gid; - return &id_tmp; } unsigned int @@ -134,26 +119,25 @@ tw_net_start(void) } // Check after tw_nnodes is defined - if(tw_nnodes() == 1 && g_tw_npe == 1) { + if(tw_nnodes() == 1) { // force the setting of SEQUENTIAL protocol if (g_tw_synchronization_protocol == NO_SYNCH) { g_tw_synchronization_protocol = SEQUENTIAL; } else if(g_tw_synchronization_protocol == CONSERVATIVE || g_tw_synchronization_protocol == OPTIMISTIC) { g_tw_synchronization_protocol = SEQUENTIAL; - fprintf(stderr, "Warning: Defaulting to Sequential Simulation, not enought PEs defined.\n"); + fprintf(stderr, "Warning: Defaulting to Sequential Simulation, not enough PEs defined.\n"); } } - tw_pe_create(1); - tw_pe_init(0, g_tw_mynode); + tw_pe_init(); //If we're in (some variation of) optimistic mode, we need this hash if (g_tw_synchronization_protocol == OPTIMISTIC || g_tw_synchronization_protocol == OPTIMISTIC_DEBUG || g_tw_synchronization_protocol == OPTIMISTIC_REALTIME) { - g_tw_pe[0]->hash_t = tw_hash_create(); + g_tw_pe->hash_t = tw_hash_create(); } else { - g_tw_pe[0]->hash_t = NULL; + g_tw_pe->hash_t = NULL; } if (send_buffer < 1) @@ -167,7 +151,7 @@ tw_net_start(void) g_tw_net_device_size = read_buffer; // pre-post all the Irecv operations - recv_begin( g_tw_pe[0] ); + recv_begin(g_tw_pe); } void @@ -199,18 +183,18 @@ tw_net_stop(void) } void -tw_net_barrier(tw_pe * pe) +tw_net_barrier(void) { if (MPI_Barrier(MPI_COMM_ROSS) != MPI_SUCCESS) tw_error(TW_LOC, "Failed to wait for MPI_Barrier"); } tw_stime -tw_net_minimum(tw_pe *me) +tw_net_minimum(void) { tw_stime m = DBL_MAX; tw_event *e; - int i; + unsigned int i; e = outq.head; while (e) { @@ -228,6 +212,16 @@ tw_net_minimum(tw_pe *me) return m; } +/** + * @brief Calls MPI_Testsome on the provided queue, to check for finished operations. + * + * @param[in] q queue to check + * @param[in] me pointer to the PE + * @param[in] finish pointer to function that will perform the appropriate send/recv + * finish functionality + * + * @return 0 if MPI_Testsome did not return any finished operations, 1 otherwise. + */ static int test_q( struct act_q *q, @@ -236,10 +230,6 @@ test_q( { int ready, i, n; -#if ROSS_MEMORY - char *tmp; -#endif - if (!q->cur) return 0; @@ -267,15 +257,11 @@ test_q( e = q->event_list[n]; q->event_list[n] = NULL; -#if ROSS_MEMORY - finish(me, e, q->buffers[n]); -#else finish(me, e, NULL); -#endif } /* Collapse the lists to remove any holes we left. */ - for (i = 0, n = 0; i < q->cur; i++) + for (i = 0, n = 0; (unsigned int)i < q->cur; i++) { if (q->event_list[i]) { @@ -289,13 +275,7 @@ test_q( &q->req_list[n], &q->req_list[i], sizeof(q->req_list[0])); - -#if ROSS_MEMORY - // swap the buffers - tmp = q->buffers[n]; - q->buffers[n] = q->buffers[i]; - q->buffers[i] = tmp; -#endif + } // endif (i != n) n++; } // endif (q->event_list[i]) @@ -305,14 +285,17 @@ test_q( return 1; } +/** + * @brief If there are any openings in the posted_recvs queue, post more Irecvs. + * + * @param[in] me pointer to the PE + * @return 0 if no changes are made to the queue, 1 otherwise. + */ static int recv_begin(tw_pe *me) { - MPI_Status status; - tw_event *e = NULL; - int flag = 0; int changed = 0; while (posted_recvs.cur < read_buffer) @@ -323,18 +306,9 @@ recv_begin(tw_pe *me) { if(tw_gvt_inprogress(me)) tw_error(TW_LOC, "Out of events in GVT! Consider increasing --extramem"); - return changed; + return changed; } -#if ROSS_MEMORY - if( MPI_Irecv(posted_recvs.buffers[id], - EVENT_SIZE(e), - MPI_BYTE, - MPI_ANY_SOURCE, - EVENT_TAG, - MPI_COMM_ROSS, - &posted_recvs.req_list[id]) != MPI_SUCCESS) -#else if( MPI_Irecv(e, (int)EVENT_SIZE(e), MPI_BYTE, @@ -342,7 +316,6 @@ recv_begin(tw_pe *me) EVENT_TAG, MPI_COMM_ROSS, &posted_recvs.req_list[id]) != MPI_SUCCESS) -#endif { tw_event_free(me, e); return changed; @@ -356,26 +329,20 @@ recv_begin(tw_pe *me) return changed; } +/** + * @brief Determines how to handle the newly received event. + * + * @param[in] me pointer to PE + * @param[in] e pointer to event that we just received + * @param[in] buffer not currently used + */ static void recv_finish(tw_pe *me, tw_event *e, char * buffer) { + (void) buffer; tw_pe *dest_pe; tw_clock start; -#if ROSS_MEMORY - tw_memory *memory; - tw_memory *last; - - tw_fd mem_fd; - - size_t mem_size; - - unsigned position = 0; - - memcpy(e, buffer, g_tw_event_msg_sz); - position += g_tw_event_msg_sz; -#endif - me->stats.s_nread_network++; me->s_nwhite_recv++; @@ -433,33 +400,6 @@ recv_finish(tw_pe *me, tw_event *e, char * buffer) e->state.remote = 1; } -#if ROSS_MEMORY - mem_size = (size_t) e->memory; - mem_fd = (tw_fd) e->prev; - - last = NULL; - while(mem_size) - { - memory = tw_memory_alloc(e->dest_lp, mem_fd); - - if(last) - last->next = memory; - else - e->memory = memory; - - memcpy(memory, &buffer[position], mem_size); - position += mem_size; - - memory->fd = mem_fd; - memory->nrefs = 1; - - mem_size = (size_t) memory->next; - mem_fd = memory->fd; - - last = memory; - } -#endif - /* NOTE: the final check in the if conditional below was added to make sure * that we do not execute the fast case unless the cancellation queue is * empty on the destination PE. Otherwise we need to invoke the normal @@ -478,7 +418,7 @@ recv_finish(tw_pe *me, tw_event *e, char * buffer) return; } - if (me->node == dest_pe->node) { + if (me->id == dest_pe->id) { /* Slower, but still local send, so put into top * of dest_pe->event_q. */ @@ -500,6 +440,13 @@ recv_finish(tw_pe *me, tw_event *e, char * buffer) dest_pe->id); } +/** + * @brief If there are any openings in the posted_sends queue, start sends + * for events in the outgoing queue. + * + * @param[in] me pointer to the PE + * @return 0 if no changes are made to the posted_sends queue, 1 otherwise. + */ static int send_begin(tw_pe *me) { @@ -508,112 +455,30 @@ send_begin(tw_pe *me) while (posted_sends.cur < send_buffer) { tw_event *e = tw_eventq_peek(&outq); - tw_node *dest_node = NULL; + tw_peid dest_pe; unsigned id = posted_sends.cur; -#if ROSS_MEMORY - tw_event *tmp_prev = NULL; - - tw_lp *tmp_lp = NULL; - - tw_memory *memory = NULL; - tw_memory *m = NULL; - - char *buffer = NULL; - - size_t mem_size = 0; - - unsigned position = 0; -#endif - if (!e) break; if(e == me->abort_event) tw_error(TW_LOC, "Sending abort event!"); - dest_node = tw_net_onnode((*e->src_lp->type->map) - ((tw_lpid) e->dest_lp)); - - //if(!e->state.cancel_q) - //e->event_id = (tw_eventid) ++me->seq_num; + dest_pe = (*e->src_lp->type->map) ((tw_lpid) e->dest_lp); e->send_pe = (tw_peid) g_tw_mynode; e->send_lp = e->src_lp->gid; -#if ROSS_MEMORY - // pack pointers - tmp_prev = e->prev; - tmp_lp = e->src_lp; - - // delete when working - e->src_lp = NULL; - - memory = NULL; - if(e->memory) - { - memory = e->memory; - e->memory = (tw_memory *) tw_memory_getsize(me, memory->fd); - e->prev = (tw_event *) memory->fd; - mem_size = (size_t) e->memory; - } - - buffer = posted_sends.buffers[id]; - memcpy(&buffer[position], e, g_tw_event_msg_sz); - position += g_tw_event_msg_sz; - - // restore pointers - e->prev = tmp_prev; - e->src_lp = tmp_lp; - - m = NULL; - while(memory) - { - m = memory->next; - - if(m) - { - memory->next = (tw_memory *) - tw_memory_getsize(me, m->fd); - memory->fd = m->fd; - } - - if(position + mem_size > TW_MEMORY_BUFFER_SIZE) - tw_error(TW_LOC, "Out of buffer space!"); - - memcpy(&buffer[position], memory, mem_size); - position += mem_size; - - memory->nrefs--; - tw_memory_unshift(e->src_lp, memory, memory->fd); - - if(NULL != (memory = m)) - mem_size = tw_memory_getsize(me, memory->fd); - } - - e->memory = NULL; - - if (MPI_Isend(buffer, - EVENT_SIZE(e), - MPI_BYTE, - *dest_node, - EVENT_TAG, - MPI_COMM_ROSS, - &posted_sends.req_list[id]) != MPI_SUCCESS) { - return changed; - } -#else if (MPI_Isend(e, (int)EVENT_SIZE(e), MPI_BYTE, - (int)*dest_node, + (int)dest_pe, EVENT_TAG, MPI_COMM_ROSS, &posted_sends.req_list[id]) != MPI_SUCCESS) { return changed; } -#endif tw_eventq_pop(&outq); e->state.owner = e->state.cancel_q @@ -629,9 +494,18 @@ send_begin(tw_pe *me) return changed; } +/** + * @brief Determines how to handle the buffer of event whose send operation + * just finished. + * + * @param[in] me pointer to PE + * @param[in] e pointer to event that we just received + * @param[in] buffer not currently used + */ static void send_finish(tw_pe *me, tw_event *e, char * buffer) { + (void) buffer; me->stats.s_nsend_network++; // instrumentation e->src_lp->kp->kp_stats->s_nsend_network++; @@ -682,6 +556,11 @@ send_finish(tw_pe *me, tw_event *e, char * buffer) } +/** + * @brief Start checks for finished operations in send/recv queues, + * and post new sends/recvs if possible. + * @param[in] me pointer to PE + */ static void service_queues(tw_pe *me) { diff --git a/core/network-mpi.h b/core/network-mpi.h index b9e07bcaa..fc6dd3f9a 100644 --- a/core/network-mpi.h +++ b/core/network-mpi.h @@ -1,9 +1,106 @@ #ifndef INC_network_mpi_h #define INC_network_mpi_h -typedef unsigned int tw_eventid; typedef long tw_node; extern MPI_Comm MPI_COMM_ROSS; +/** + * @brief Initalize the network library and parse options. + * + * argc and argv are pointers to the original command line; the + * network library may edit these before the option parser sees + * them allowing for network implementation specific argument + * handling to occur. + * + * It's possible for a model to init MPI itself, as this + * function will first check if MPI is already initialized before + * attempting to call MPI_Init(). + * + * This function also sets the global variables + * g_tw_masternode and g_tw_mynode. + * + * @param[in] argc Pointer to command line arg count + * @param[in] argv Pointer to command line args + * @return tw_optdef array to be included in overall process + * command line argument display and parsing; NULL may be returned + * to indicate the implementation has no options it wants included. + */ +const tw_optdef *tw_net_init(int *argc, char ***argv); + +/** + * @brief Setup the MPI_COMM_ROSS communicator to use instead of MPI_COMM_WORLD. + * + * This function should be called before tw_net_init. + * @param[in] comm Custom MPI communicator for setting MPI_COMM_ROSS + */ +void tw_comm_set(MPI_Comm comm); + +/** + * @brief Starts the network library after option parsing. + * + * Makes calls to initialize the PE (g_tw_pe), create the hash/AVL tree + * (for optimistic modes), and queues for posted sends/recvs. + * Also pre-posts MPI Irecvs operations. + */ +void tw_net_start(void); + +/** + * @brief Stops the network library after simulation end. + * + * Checks to see if custom communicator was used. If not, finalizes MPI. + * Otherwise, the application is expected to finalize MPI itself. + */ +void tw_net_stop(void); + +/** Aborts the entire simulation when a grave error is found. */ +void tw_net_abort(void) NORETURN; + +/** + * @brief starts service_queues() to poll network + * + * @param[in] me pointer to the PE + */ +extern void tw_net_read(tw_pe *); + +/** + * @brief Adds the event to the outgoing queue of events to be sent, + * polls for finished sends, and attempts to start sends from outq. + * + * @param[in] e remote event to be sent + */ +extern void tw_net_send(tw_event *); + +/** + * @brief Cancel the given remote event by either removing from the outq + * or sending an antimessage, depending on the status of the original positive send. + * + * @param[in] e remote event to be canceled + */ +extern void tw_net_cancel(tw_event *); + +/** Obtain the total number of PEs executing the simulation. + * + * @return number of ROSS PEs/MPI world size + */ +extern unsigned tw_nnodes(void); + +/** Block until all nodes call the barrier. */ +extern void tw_net_barrier(void); + +/** + * @brief Obtain the lowest timestamp inside the network buffers. + * + * @return minimum timestamp for this PE's network buffers + */ +extern tw_stime tw_net_minimum(void); + +/** + * @brief Function to reduce all the statistics for output. + * @attention Notice that the MPI_Reduce "count" parameter is greater than one. + * We are reducing on multiple variables *simultaneously* so if you change + * this function or the struct tw_statistics, you must update the other. + **/ +extern tw_statistics *tw_net_statistics(tw_pe *, tw_statistics *); + #endif diff --git a/core/rand-clcg4.c b/core/rand-clcg4.c index c5f1b799b..96357f519 100644 --- a/core/rand-clcg4.c +++ b/core/rand-clcg4.c @@ -319,7 +319,7 @@ tw_rand_initial_seed(tw_rng_stream * g, tw_lpid id) void tw_rand_init_streams(tw_lp * lp, unsigned int nstreams) { - int i; + unsigned int i; if(nstreams > g_tw_nRNG_per_lp) tw_error(TW_LOC, "LP %lu asked for more RNG streams (%d) than the global maximum (g_tw_nRNG_per_lp:%d)\n", lp->gid, nstreams, g_tw_nRNG_per_lp); diff --git a/core/ross-extern.h b/core/ross-extern.h index 9d7c491da..2313fb599 100644 --- a/core/ross-extern.h +++ b/core/ross-extern.h @@ -1,7 +1,7 @@ #ifndef INC_ross_extern_h -#define INC_ross_extern_h +#define INC_ross_extern_h -extern void tw_rand_init_streams(tw_lp * lp, unsigned int nstreams); +extern void tw_rand_init_streams(tw_lp * lp, unsigned int nstreams); /* * tw-stats.c @@ -17,57 +17,52 @@ 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_lpid g_tw_nlp; -extern tw_lpid g_tw_lp_offset; +extern tw_lpid g_tw_lp_offset; extern tw_kpid g_tw_nkp; -extern tw_lp **g_tw_lp; -extern tw_kp **g_tw_kp; +extern tw_lp **g_tw_lp; +extern tw_kp **g_tw_kp; extern int g_tw_fossil_attempts; -extern unsigned int g_tw_nRNG_per_lp; -extern tw_lpid g_tw_rng_default; -extern tw_seed g_tw_rng_seed; -extern unsigned int g_tw_mblock; +extern unsigned int g_tw_nRNG_per_lp; +extern tw_lpid g_tw_rng_default; +extern tw_seed g_tw_rng_seed; +extern unsigned int g_tw_mblock; extern unsigned int g_tw_gvt_interval; extern unsigned long long g_tw_max_opt_lookahead; extern unsigned long long g_tw_gvt_realtime_interval; extern unsigned long long g_tw_gvt_interval_start_cycles; -extern tw_stime g_tw_ts_end; -extern unsigned int g_tw_sim_started; -extern size_t g_tw_msg_sz; -extern size_t g_tw_event_msg_sz; +extern tw_stime g_tw_ts_end; +extern unsigned int g_tw_sim_started; +extern size_t g_tw_msg_sz; +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 uint32_t g_tw_avl_node_count; extern unsigned int g_tw_lz4_knob; -extern unsigned int g_tw_memory_nqueues; -extern size_t g_tw_memory_sz; - extern tw_stime g_tw_lookahead; extern tw_stime g_tw_min_detected_offset; -extern tw_peid g_tw_npe; -extern tw_pe **g_tw_pe; +extern tw_pe *g_tw_pe; extern unsigned int g_tw_events_per_pe; extern unsigned int g_tw_events_per_pe_extra; -extern unsigned int g_tw_gvt_threshold; -extern unsigned int g_tw_gvt_done; +extern unsigned int g_tw_gvt_threshold; +extern unsigned int g_tw_gvt_done; -extern unsigned int g_tw_net_device_size; -extern tw_node g_tw_mynode; -extern tw_node g_tw_masternode; +extern unsigned int g_tw_net_device_size; +extern tw_peid g_tw_mynode; +extern tw_peid g_tw_masternode; -extern FILE *g_tw_csv; +extern FILE *g_tw_csv; extern tw_lptype * g_tw_lp_types; extern tw_typemap_f g_tw_lp_typemap; - /* - * Cycle Counter variables - */ - +/* + * Cycle Counter variables + */ extern tw_clock g_tw_cycles_gvt; extern tw_clock g_tw_cycles_ev_abort; extern tw_clock g_tw_cycles_ev_proc; @@ -87,8 +82,8 @@ extern unsigned long long g_tw_clock_rate; /* * tw-event.c */ -extern void tw_event_send(tw_event * event); -extern void tw_event_rollback(tw_event * event); +extern void tw_event_send(tw_event * event); +extern void tw_event_rollback(tw_event * event); /* * ross-inline.h @@ -100,11 +95,11 @@ static inline void * tw_event_data(tw_event * event); /* * tw-lp.c */ -extern tw_lp *tw_lp_next_onpe(tw_lp * last, tw_pe * pe); -extern void tw_lp_settype(tw_lpid lp, tw_lptype * type); -extern void tw_lp_onpe(tw_lpid index, tw_pe * pe, tw_lpid id); -extern void tw_lp_onkp(tw_lp * lp, tw_kp * kp); -extern void tw_init_lps(tw_pe * me); +extern tw_lp *tw_lp_next_onpe(tw_lp * last, tw_pe * pe); +extern void tw_lp_settype(tw_lpid lp, tw_lptype * type); +extern void tw_lp_onpe(tw_lpid index, tw_pe * pe, tw_lpid id); +extern void tw_lp_onkp(tw_lp * lp, tw_kp * kp); +extern void tw_init_lps(tw_pe * me); extern void tw_pre_run_lps(tw_pe * me); extern void tw_lp_setup_types(); extern void tw_lp_suspend(tw_lp * lp, int do_orig_event_rc, int error_num ); @@ -119,21 +114,15 @@ extern void tw_init_kps(tw_pe * me); extern tw_out* tw_kp_grab_output_buffer(tw_kp *kp); extern void tw_kp_put_back_output_buffer(tw_out *out); -extern void tw_kp_rollback_event(tw_event *event); -extern void tw_kp_rollback_to(tw_kp * kp, tw_stime to); -extern void tw_kp_fossil_memoryq(tw_kp * me, tw_fd); -extern void tw_kp_fossil_memory(tw_kp * me); +extern void tw_kp_rollback_event(tw_event *event); +extern void tw_kp_rollback_to(tw_kp * kp, tw_stime to); /* * tw-pe.c */ -extern tw_pe *tw_pe_next(tw_pe * last); -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, - size_t d_sz, tw_stime mult); +extern void tw_pe_settype(const tw_petype * type); +extern void tw_pe_init(void); +extern void tw_pe_fossil_collect(void); /* * tw-setup.c @@ -174,18 +163,11 @@ extern void tw_wall_now(tw_wtime * t); extern void tw_wall_sub(tw_wtime * r, tw_wtime * a, tw_wtime * b); extern double tw_wall_to_double(tw_wtime * t); -/* - * tw-memory.c - */ -#ifdef ROSS_MEMORY -extern size_t tw_memory_allocate(tw_memoryq *); -#endif - /* * tw-util.c */ -#define TW_LOC __FILE__,__LINE__ +#define TW_LOC __FILE__,__LINE__ extern int tw_output(tw_lp *lp, const char *fmt, ...); extern void tw_error(const char *file, int line, const char *fmt, ...) NORETURN; extern void tw_warning(const char *file, int line, const char *fmt, ...); diff --git a/core/ross-global.c b/core/ross-global.c index fdb784406..667b35e34 100644 --- a/core/ross-global.c +++ b/core/ross-global.c @@ -40,13 +40,6 @@ uint32_t g_tw_avl_node_count = 18; 17 is a good value for speed with 1 being the default value. */ unsigned int g_tw_lz4_knob = 17; -#if ROSS_MEMORY -unsigned int g_tw_memory_nqueues = 64; -#else -unsigned int g_tw_memory_nqueues = 0; -#endif - -size_t g_tw_memory_sz = 0; size_t g_tw_event_msg_sz = 0; /* @@ -74,14 +67,12 @@ unsigned long long g_tw_gvt_interval_start_cycles = 0; tw_stime g_tw_ts_end = 100000.0; - /* - * g_tw_npe -- Number of PEs on this processor (usually one) - * g_tw_pe -- Public PE object array (on this processor) - * g_tw_events_per_pe -- Number of events to place in for each PE. - * MUST be > 1 because of abort buffer. - */ -tw_peid g_tw_npe = 1; -tw_pe **g_tw_pe; +/* + * g_tw_pe -- Public PE pointer + * g_tw_events_per_pe -- Number of events to place in for each PE. + * MUST be > 1 because of abort buffer. + */ +tw_pe *g_tw_pe = NULL; unsigned int g_tw_events_per_pe = 2048; /** Number of extra events allocated per PE. Command-line customizable. */ unsigned int g_tw_events_per_pe_extra = 0; @@ -94,8 +85,8 @@ unsigned int g_tw_gvt_done = 0; * g_tw_masternode -- pointer to GVT net node, for GVT comp */ unsigned int g_tw_net_device_size = 0; -tw_node g_tw_mynode = -1; -tw_node g_tw_masternode = -1; +tw_peid g_tw_mynode = 0; +tw_peid g_tw_masternode = 0; FILE *g_tw_csv = NULL; diff --git a/core/ross-gvt.h b/core/ross-gvt.h index 7f3eb806c..9e128cbe7 100644 --- a/core/ross-gvt.h +++ b/core/ross-gvt.h @@ -24,8 +24,8 @@ extern void tw_gvt_step2(tw_pe *); * Provide a mechanism to force a GVT computation outside of the * GVT interval (optional) */ -extern void tw_gvt_force_update(tw_pe *); -extern void tw_gvt_force_update_realtime(tw_pe *); +extern void tw_gvt_force_update(void); +extern void tw_gvt_force_update_realtime(void); /* Set the PE GVT value */ extern int tw_gvt_set(tw_pe * pe, tw_stime LVT); diff --git a/core/ross-inline.h b/core/ross-inline.h index a9277ee39..05630272f 100644 --- a/core/ross-inline.h +++ b/core/ross-inline.h @@ -1,10 +1,10 @@ #ifndef INC_ross_inline_h -#define INC_ross_inline_h +#define INC_ross_inline_h static inline tw_event * tw_event_grab(tw_pe *pe) { - tw_event *e = tw_eventq_pop(&pe->free_q); + tw_event *e = tw_eventq_pop(&pe->free_q); if (e) { @@ -15,16 +15,6 @@ tw_event_grab(tw_pe *pe) memset(&e->state, 0, sizeof(e->state)); memset(&e->event_id, 0, sizeof(e->event_id)); - -#ifdef ROSS_MEMORY - if(e->memory) - { - if(!e->memory->nrefs) - tw_printf(TW_LOC, "membuf remaining on event: %d", - e->memory->nrefs); - e->memory = NULL; - } -#endif } return e; } @@ -49,9 +39,9 @@ tw_free_output_messages(tw_event *e, int print_message) static inline tw_event * tw_event_new(tw_lpid dest_gid, tw_stime offset_ts, tw_lp * sender) { - tw_pe *send_pe; - tw_event *e; - tw_stime recv_ts; + tw_pe *send_pe; + tw_event *e; + tw_stime recv_ts; if (offset_ts < 0.0) { tw_error(TW_LOC, "Cannot send events into the past! Sending LP: %lu\n", sender->gid); @@ -112,36 +102,12 @@ tw_event_free(tw_pe *pe, tw_event *e) * and freed -- which is how a membuf could end up on a freed * event. */ -#ifdef ROSS_MEMORY - tw_memory *next; - tw_memory *m; - - m = next = e->memory; - - while(m) - { - next = m->next; - - if(0 == --m->nrefs) - { - if(e->state.owner >= TW_net_outq && e->state.owner <= TW_pe_sevent_q) - tw_memory_unshift(e->src_lp, m, m->fd); - else - tw_memory_unshift(e->dest_lp, m, m->fd); - } - - m = next; - } - - e->memory = NULL; -#endif - tw_free_output_messages(e, 0); if (e->delta_buddy) { tw_clock start = tw_clock_read(); buddy_free(e->delta_buddy); - g_tw_pe[0]->stats.s_buddy += (tw_clock_read() - start); + g_tw_pe->stats.s_buddy += (tw_clock_read() - start); e->delta_buddy = 0; } @@ -150,93 +116,6 @@ tw_event_free(tw_pe *pe, tw_event *e) tw_eventq_unshift(&pe->free_q, e); } -#ifdef ROSS_MEMORY -static inline tw_memory * -tw_event_memory_get(tw_lp * lp) -{ - tw_memory *m = lp->pe->cur_event->memory; - - if(m && m->next) - lp->pe->cur_event->memory = lp->pe->cur_event->memory->next; - else - lp->pe->cur_event->memory = NULL; - - return m; -} - -static inline void -tw_event_memory_get_rc(tw_lp * lp, tw_memory * m, tw_fd fd) -{ - m->next = lp->pe->cur_event->memory; - lp->pe->cur_event->memory = m; -} - -static inline void -tw_event_memory_setfifo(tw_event * e, tw_memory * m, tw_fd fd) -{ - tw_memory *b; - - if(e == e->src_lp->pe->abort_event) - { - tw_memory_alloc_rc(e->src_lp, m, fd); - return; - } - - m->fd = fd; - - if(NULL == e->memory) - { - m->next = e->memory; - e->memory = m; - } else - { - b = e->memory; - while(b->next) - b = b->next; - - b->next = m; - m->next = NULL; - } -} - -static inline void -tw_event_memory_set(tw_event * e, tw_memory * m, tw_fd fd) -{ - if(e == e->src_lp->pe->abort_event) - { - tw_memory_alloc_rc(e->src_lp, m, fd); - return; - } - - m->next = e->memory; - e->memory = m; -} - -static inline void -tw_event_memory_forward(tw_event * e) -{ - tw_memory *m; - - if(e == e->src_lp->pe->abort_event) - return; - - e->memory = e->src_lp->pe->cur_event->memory; - - m = e->memory; - while(m) - { - m->nrefs++; - m = m->next; - } -} - -static inline void * -tw_memory_data(tw_memory * memory) -{ - return memory + 1; -} -#endif - static inline void * tw_event_data(tw_event * event) { diff --git a/core/ross-kernel-inline.h b/core/ross-kernel-inline.h index 3e8840f94..4b3f99653 100644 --- a/core/ross-kernel-inline.h +++ b/core/ross-kernel-inline.h @@ -2,13 +2,13 @@ #define INC_ross_kernel_inline_h #include "instrumentation/st-instrumentation.h" -#define ROSS_MAX(a,b) ((a) > (b) ? (a) : (b)) -#define ROSS_MIN(a,b) ((a) < (b) ? (a) : (b)) +#define ROSS_MAX(a,b) ((a) > (b) ? (a) : (b)) +#define ROSS_MIN(a,b) ((a) < (b) ? (a) : (b)) -static inline tw_lp * +static inline tw_lp * tw_getlocal_lp(tw_lpid gid) { - tw_lpid id; + tw_lpid id = gid; // finding analysis LPs doesn't depend on model's choice of mapping if (g_st_use_analysis_lps && gid >= g_st_total_model_lps) @@ -27,32 +27,32 @@ static inline tw_lp * break; } -#ifdef ROSS_runtime_checks +#ifdef ROSS_runtime_checks if (id >= g_tw_nlp) tw_error(TW_LOC, "ID %d exceeded MAX LPs", id); if (gid != g_tw_lp[id]->gid) tw_error(TW_LOC, "Inconsistent LP Mapping"); #endif /* ROSS_runtime_checks */ - + return g_tw_lp[id]; } -static inline tw_lp * +static inline tw_lp * tw_getlp(tw_lpid id) { -#ifdef ROSS_runtime_checks +#ifdef ROSS_runtime_checks if (id >= g_tw_nlp + g_st_analysis_nlp) tw_error(TW_LOC, "ID %d exceeded MAX LPs", id); if (id != g_tw_lp[id]->id) tw_error(TW_LOC, "Inconsistent LP Mapping"); -#endif /* ROSS_runtime_checks */ +#endif /* ROSS_runtime_checks */ return g_tw_lp[id]; } -static inline tw_kp * +static inline tw_kp * tw_getkp(tw_kpid id) { -#ifdef ROSS_runtime_checks +#ifdef ROSS_runtime_checks if (id >= g_tw_nkp) tw_error(TW_LOC, "ID %u exceeded MAX KPs", id); if( g_tw_kp[id] == NULL ) @@ -64,44 +64,19 @@ static inline tw_kp * return g_tw_kp[id]; } -static inline tw_pe * - tw_getpe(tw_peid id) -{ -#ifdef ROSS_runtime_checks - if (id >= g_tw_npe) - tw_error(TW_LOC, "ID %d exceeded MAX PEs", id); -#endif /* ROSS_runtime_checks */ - - return g_tw_pe[id]; -} - -#ifdef ROSS_MEMORY -static inline tw_memoryq * - tw_kp_getqueue(tw_kp * kp, tw_fd fd) -{ - return &kp->pmemory_q[fd]; -} - -static inline tw_memoryq * - tw_pe_getqueue(tw_pe * pe, tw_fd fd) -{ - return &pe->memory_q[fd]; -} -#endif - -static inline int +static inline int tw_ismaster(void) { return (g_tw_mynode == g_tw_masternode); } -static inline void * +static inline void * tw_getstate(tw_lp * lp) { return lp->cur_state; } -static inline tw_stime +static inline tw_stime tw_now(tw_lp const * lp) { return (lp->kp->last_time); diff --git a/core/ross-network.h b/core/ross-network.h deleted file mode 100644 index 928e32019..000000000 --- a/core/ross-network.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef INC_ross_network_h -#define INC_ross_network_h - -/* Initalize the network library and parse options. - * - * argc and argv are pointers to the original command line; the - * network library may edit these before the option parser sees - * them allowing for network implementation specific argument - * handling to occur. - * - * returned tw_optdef array will be included in the overall process - * command line argument display and parsing; NULL may be returned - * to indicate the implementation has no options it wants included. - */ -const tw_optdef *tw_net_init(int *argc, char ***argv); - -/* Setup the communicator to use instead of MPI_COMM_WORLD. - * This function should be called before tw_net_init. - */ -void tw_comm_set(MPI_Comm comm); - -/* Starts the network library after option parsing. */ -void tw_net_start(void); - -/* Stops the network library after simulation end. */ -void tw_net_stop(void); - -/* Aborts the entire simulation when a grave error is found. */ -void tw_net_abort(void) NORETURN; - -/* TODO: Old function definitions not yet replaced/redefined. */ -extern void tw_net_read(tw_pe *); -extern void tw_net_send(tw_event *); -extern void tw_net_cancel(tw_event *); - -/* Determine the identification of the node a pe is running on. */ -tw_node * tw_net_onnode(tw_peid gid); - -/* Obtain the total number of nodes executing the simulation. */ -extern unsigned tw_nnodes(void); - -/* Block until all nodes call the barrier. */ -extern void tw_net_barrier(tw_pe * pe); - -/* Obtain the lowest timestamp inside the network buffers. */ -extern tw_stime tw_net_minimum(tw_pe *); - -/* Send / receive tw_statistics objects. */ -extern tw_statistics *tw_net_statistics(tw_pe *, tw_statistics *); - -/* Communicate LVT / GVT values to compute node network. */ -extern void tw_net_gvt_compute(tw_pe *, tw_stime *); - -/* Provide a mechanism to send the PE LVT value to remote processors */ -extern void tw_net_send_lvt(tw_pe *, tw_stime); - -#endif diff --git a/core/ross-types.h b/core/ross-types.h index a6ba44e96..2a0b1e96e 100644 --- a/core/ross-types.h +++ b/core/ross-types.h @@ -20,11 +20,6 @@ typedef struct tw_kp tw_kp; typedef struct tw_pe tw_pe; typedef struct avlNode *AvlTree; -#ifdef ROSS_MEMORY -typedef struct tw_memoryq tw_memoryq; -typedef struct tw_memory tw_memory; -#endif - /** * Synchronization protocol used */ @@ -48,9 +43,7 @@ typedef enum tw_lp_map tw_lp_map; /** tw_kpid -- Kernel Process (KP) id*/ typedef tw_peid tw_kpid; - -/** tw_fd -- used to distinguish between memory and event arrays*/ -typedef unsigned long tw_fd; +typedef unsigned int tw_eventid; typedef unsigned long long tw_stat; @@ -85,7 +78,6 @@ typedef void (*event_f) (void *sv, tw_bf * cv, void *msg, tw_lp * me); typedef void (*revent_f) (void *sv, tw_bf * cv, void *msg, tw_lp * me); typedef void (*commit_f) (void *sv, tw_bf * cv, void *msg, tw_lp * me); typedef void (*final_f) (void *sv, tw_lp * me); -typedef void (*statecp_f) (void *sv_dest, void *sv_src); /** * tw_lptype @@ -170,39 +162,6 @@ struct tw_statistics { #endif }; -#ifdef ROSS_MEMORY -struct tw_memoryq { - tw_memory *head; - tw_memory *tail; - - size_t size; - size_t start_size; - size_t d_size; - - tw_stime grow; -}; - -/** - * tw_memory - * @brief Memory Buffer - * - * This is a memory buffer which applications can use in any way they - * see fit. ROSS provides API methods for handling memory buffers in the event of - * a rollback and manages the memory in an efficient way, ie, like events. - */ -struct tw_memory { - tw_memory *next; /**< \brief Next pointer for all queues except the LP RC queue */ - tw_memory *prev; /**< \brief Prev pointer for all queues except the LP RC queue */ - - //tw_memory *volatile up; - //int heap_index; - - tw_stime ts; /**< \brief Time at which this event can be fossil collected */ - tw_fd fd; /**< \brief Source memory queue index */ - unsigned int nrefs; /**< \brief Number of references to this membuf (for forwarding) */ -}; -#endif - struct tw_eventq { size_t size; tw_event *head; @@ -327,9 +286,6 @@ struct tw_event { tw_lpid dest_lpid; tw_stime send_ts; -#ifdef ROSS_MEMORY - tw_memory *memory; -#endif tw_out *out_msgs; /**< @brief Output messages */ }; @@ -410,9 +366,6 @@ struct tw_kp { struct st_kp_stats *kp_stats; struct st_kp_stats *last_stats[3]; -#ifdef ROSS_MEMORY - tw_memoryq *pmemory_q; /**< @brief TW processed memory buffer queues */ -#endif }; /** @@ -421,14 +374,12 @@ struct tw_kp { */ struct tw_pe { tw_peid id; - tw_node node; tw_petype type; /**< @brief Model defined PE type routines */ tw_eventq event_q; /**< @brief Linked list of events sent to this PE */ tw_event *cancel_q; /**< @brief List of canceled events */ tw_pq *pq; /**< @brief Priority queue used to sort events */ tw_kp *kp_list; /**< @brief */ - tw_pe **pe_next; /**< @brief Single linked list of PE structs */ tw_eventq free_q; /**< @brief Linked list of free tw_events */ tw_event *abort_event; /**< @brief Placeholder event for when free_q is empty */ @@ -443,16 +394,10 @@ struct tw_pe { unsigned avl_tree_size; #endif -#ifdef ROSS_MEMORY - tw_memoryq *memory_q; /**< @brief array of free tw_memory buffers linked lists */ -#endif - tw_clock clock_offset; /**< @brief Initial clock value for this PE */ tw_clock clock_time; /**< @brief Most recent clock value for this PE */ unsigned char cev_abort; /**< @brief Current event being processed must be aborted */ - unsigned char master; /**< @brief Master across all compute nodes */ - unsigned char local_master; /**< @brief Master for this node */ unsigned char gvt_status; /**< @brief Bits available for gvt computation */ tw_stime trans_msg_ts; /**< @brief Last transient messages' time stamp */ diff --git a/core/ross.h b/core/ross.h index 5008cada3..3aa236d94 100644 --- a/core/ross.h +++ b/core/ross.h @@ -186,14 +186,14 @@ typedef uint64_t tw_lpid; # include "clock/aarch64.h" #endif +#include "tw-timing.h" +#include "ross-types.h" +#include "tw-opts.h" + #ifdef ROSS_NETWORK_mpi # include "network-mpi.h" #endif -#include "tw-timing.h" -#include "ross-types.h" -#include "tw-opts.h" -#include "ross-network.h" #include "ross-gvt.h" #include "ross-extern.h" #include "ross-kernel-inline.h" @@ -209,11 +209,6 @@ typedef uint64_t tw_lpid; # include "gvt/mpi_allreduce.h" #endif -#ifdef ROSS_MEMORY -# include "tw-memoryq.h" -# include "tw-memory.h" -#endif - #include "instrumentation/st-instrumentation.h" #ifdef USE_DAMARIS diff --git a/core/ross.pc.in b/core/ross.pc.in index 50211d063..1082425d3 100644 --- a/core/ross.pc.in +++ b/core/ross.pc.in @@ -1,7 +1,7 @@ prefix = @CMAKE_INSTALL_PREFIX@ ross_cflags=-I${prefix}/include -ross_ldflags=-L${prefix}/lib +ross_ldflags=-L${prefix}/lib -Wl,-rpath,${prefix}/lib ross_libs=-lROSS -lm Name: ROSS diff --git a/core/tw-event.c b/core/tw-event.c index 2149e5b6b..01bf04f14 100644 --- a/core/tw-event.c +++ b/core/tw-event.c @@ -43,7 +43,7 @@ void tw_event_send(tw_event * event) { tw_error(TW_LOC, "Lookahead violation: decrease g_tw_lookahead %f\n" "Event causing violation: src LP: %lu, src PE: %lu\n" "dest LP %lu, dest PE %lu, recv_ts %f\n", - g_tw_lookahead, src_lp->gid, send_pe->id, event->dest_lpid, + g_tw_lookahead, src_lp->gid, send_pe->id, event->dest_lpid, dest_peid, recv_ts); } } @@ -163,7 +163,7 @@ static inline void event_cancel(tw_event * event) { default: tw_error(TW_LOC, "unknown fast local cancel owner %d", event->state.owner); } - } else if (send_pe->node == dest_peid) { + } else if ((unsigned long)send_pe->id == dest_peid) { /* Slower, but still a local cancel, so put into * top of dest_pe->cancel_q for final deletion. */ @@ -222,7 +222,7 @@ void tw_event_rollback(tw_event * event) { if (event->delta_buddy) { tw_clock start = tw_clock_read(); buddy_free(event->delta_buddy); - g_tw_pe[0]->stats.s_buddy += (tw_clock_read() - start); + g_tw_pe->stats.s_buddy += (tw_clock_read() - start); event->delta_buddy = 0; } diff --git a/core/tw-eventq.h b/core/tw-eventq.h index 5275e8ced..6404a68fb 100644 --- a/core/tw-eventq.h +++ b/core/tw-eventq.h @@ -12,7 +12,7 @@ tw_eventq_debug(tw_eventq * q) tw_event *next; tw_event *last; - int cnt; + unsigned int cnt; cnt = 0; next = q->head; @@ -79,7 +79,7 @@ tw_eventq_push_list(tw_eventq * q, tw_event * h, tw_event * t, long cnt) if (e->delta_buddy) { tw_clock start = tw_clock_read(); buddy_free(e->delta_buddy); - g_tw_pe[0]->stats.s_buddy += (tw_clock_read() - start); + g_tw_pe->stats.s_buddy += (tw_clock_read() - start); e->delta_buddy = 0; } @@ -195,12 +195,6 @@ tw_eventq_alloc(tw_eventq * q, unsigned int cnt) event_len += align - (event_len & (align - 1)); //tw_error(TW_LOC, "REALIGNING EVENT MEMORY!\n"); } -#if ROSS_MEMORY - if(event_len > TW_MEMORY_BUFFER_SIZE) - { - tw_error(TW_LOC, "g_tw_msg_sz of %d is too large.\nThe ROSS_MEMORY maximum buffer size (including space reserved for alignment and header) is %d.\nPlease reduce the message size specified by the model using tw_define_lps().", g_tw_msg_sz, TW_MEMORY_BUFFER_SIZE); - } -#endif g_tw_event_msg_sz = event_len; // compute number of events needed for the network. diff --git a/core/tw-kp.c b/core/tw-kp.c index 68bf9dd73..0ada665a6 100644 --- a/core/tw-kp.c +++ b/core/tw-kp.c @@ -130,7 +130,6 @@ init_output_messages(tw_kp *kp) void tw_init_kps(tw_pe * me) { - tw_kp *prev_kp = NULL; tw_kpid i; int j; @@ -146,7 +145,6 @@ tw_init_kps(tw_pe * me) kp->s_e_rbs = 0; kp->s_rb_total = 0; kp->s_rb_secondary = 0; - prev_kp = kp; if (g_tw_synchronization_protocol == OPTIMISTIC || g_tw_synchronization_protocol == OPTIMISTIC_DEBUG || g_tw_synchronization_protocol == OPTIMISTIC_REALTIME) { @@ -157,11 +155,6 @@ tw_init_kps(tw_pe * me) kp->kp_stats = (st_kp_stats*) tw_calloc(TW_LOC, "KP instrumentation", sizeof(st_kp_stats), 1); for (j = 0; j < 3; j++) kp->last_stats[j] = (st_kp_stats*) tw_calloc(TW_LOC, "KP instrumentation", sizeof(st_kp_stats), 1); - -#if ROSS_MEMORY - kp->pmemory_q = tw_calloc(TW_LOC, "KP memory queues", - sizeof(tw_memoryq), g_tw_memory_nqueues); -#endif } } @@ -193,71 +186,3 @@ tw_kp_put_back_output_buffer(tw_out *out) } } -void -tw_kp_fossil_memoryq(tw_kp * kp, tw_fd fd) -{ -#if ROSS_MEMORY - tw_memoryq *q; - - tw_memory *b; - tw_memory *tail; - - tw_memory *last; - - tw_stime gvt = kp->pe->GVT; - - int cnt; - - q = &kp->pmemory_q[fd]; - tail = q->tail; - - if(0 == q->size || tail->ts >= gvt) - return; - - if(q->head->ts < gvt) - { - tw_memoryq_push_list(tw_pe_getqueue(kp->pe, fd), - q->head, q->tail, q->size); - - q->head = q->tail = NULL; - q->size = 0; - - return; - } - - /* - * Start direct search. - */ - last = NULL; - cnt = 0; - - b = q->head; - while (b->ts >= gvt) - { - last = b; - cnt++; - - b = b->next; - } - - tw_memoryq_push_list(tw_pe_getqueue(kp->pe, fd), b, q->tail, q->size - cnt); - - /* fix what remains of our pmemory_q */ - q->tail = last; - q->tail->next = NULL; - q->size = cnt; - -#if VERIFY_PE_FC_MEM - printf("%d: FC %d buf from FD %d \n", kp->id, cnt, fd); -#endif -#endif -} - -void -tw_kp_fossil_memory(tw_kp * kp) -{ - int i; - - for(i = 0; i < g_tw_memory_nqueues; i++) - tw_kp_fossil_memoryq(kp, i); -} diff --git a/core/tw-lp.c b/core/tw-lp.c index c2066ff92..de43e17ac 100644 --- a/core/tw-lp.c +++ b/core/tw-lp.c @@ -17,7 +17,7 @@ void tw_lp_setup_types () { tw_error(TW_LOC, "No LP type mapping is defined"); } - int i; + unsigned int i; for (i = 0; i < g_tw_nlp; i++) { tw_lp *lp = g_tw_lp[i]; lp->type = &g_tw_lp_types[g_tw_lp_typemap(lp->gid)]; diff --git a/core/tw-memory.c b/core/tw-memory.c deleted file mode 100644 index 04ece9117..000000000 --- a/core/tw-memory.c +++ /dev/null @@ -1,66 +0,0 @@ -#include - -size_t -tw_memory_allocate(tw_memoryq * q) -{ - tw_memory *head; - tw_memory *tail; - - void *d; - size_t mem_sz; - size_t mem_len; - - size_t align; - size_t cnt; - - align = max(sizeof(double), sizeof(void *)); - mem_len = sizeof(tw_memory) + q->d_size; - - if(mem_len & (align - 1)) - mem_len += align - (mem_len & (align - 1)); - - cnt = align = q->start_size + ceil(q->start_size * q->grow); - mem_sz = mem_len * cnt; - - q->size += cnt; - q->start_size += ceil(q->start_size * q->grow); - -#if ROSS_VERIFY_MEMORY - printf("Allocating %d bytes in memory subsystem...", mem_sz); -#endif - - d = head = tail = tw_calloc(TW_LOC, "Memory Queue", mem_sz, 1); - - if (!d) - tw_error(TW_LOC, "\nCannot allocate %u buffers! \n", q->size); -#if ROSS_VERIFY_MEMORY - else - printf("Allocated %ld buffers\n", cnt); -#endif - - while (--cnt) - { - tail->next = (tw_memory *) (((char *)tail) + mem_len); - tail->prev = (tw_memory *) (((char *)tail) - mem_len); - tail = tail->next; - } - - head->prev = tail->next = NULL; - - if(q->head == NULL) - { - q->head = head; - q->tail = tail; - } else - { - q->tail->next = head; - head->prev = q->tail; - q->tail = tail; - } - -#if ROSS_VERIFY_MEMORY - printf("successful! \n"); -#endif - - return align; -} diff --git a/core/tw-memory.h b/core/tw-memory.h deleted file mode 100644 index 8a753a3cb..000000000 --- a/core/tw-memory.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef INC_tw_memory_h -#define INC_tw_memory_h - -#define TW_MEMORY_BUFFER_SIZE 500 - -/* - * Use this function to allocate a memory buffer in model event handlers. - */ -static inline tw_memory * -tw_memory_alloc(tw_lp * lp, tw_fd fd) -{ - tw_pe *pe; - tw_memoryq *q; - tw_memory *m; - - pe = lp->pe; - - q = tw_pe_getqueue(pe, fd); - - /* - * First try to fossil collect.. then allocate more - */ - // not certain we can rely on membuf timestamps to be sorted - if(!q->size) - tw_kp_fossil_memoryq(lp->kp, fd); - - if(!q->size) - { -#if 1 - int cnt = tw_memory_allocate(q); - pe->stats.s_mem_buffers_used += cnt; - printf("%d: Allocating %d buffers in memory fd: %ld \n", - g_tw_mynode, cnt, fd); -#else - tw_error(TW_LOC, "Out of buffers in fd: %ld\n", fd); -#endif - } - - if(NULL == (m = tw_memoryq_pop(q))) - tw_error(TW_LOC, "No memory buffers to allocate!"); - - m->next = m->prev = NULL; - m->nrefs = 1; - - //printf("%ld: mem alloc, remain: %d, fd %ld \n", lp->id, q->size, fd); - - return m; -} - -/* - * The RC of an alloc is to place the buffer back into the - * free_q of memory buffers. - */ -static inline void -tw_memory_alloc_rc(tw_lp * lp, tw_memory * m, tw_fd fd) -{ - if(--m->nrefs) - tw_error(TW_LOC, "membuf stills has refs: %d", m->nrefs); - - tw_memoryq_push(tw_pe_getqueue(lp->pe, fd), m); -} - -static inline void -tw_memory_free(tw_lp * lp, tw_memory * m, tw_fd fd) -{ - tw_memoryq *q; - - /* If seq sim, just reclaim buffer now. */ - if((tw_nnodes() * g_tw_npe) == 1) - q = tw_pe_getqueue(lp->pe, fd); - else - q = tw_kp_getqueue(lp->kp, fd); - - m->ts = tw_now(lp); - - /* - * Now we need to link this buffer into the KPs - * processed memory queue. - */ - tw_memoryq_push(q, m); -} - -static inline tw_memory * -tw_memory_free_rc(tw_lp * lp, tw_fd fd) -{ - tw_memory *m = tw_memoryq_pop(tw_kp_getqueue(lp->kp, fd)); - - if(m && m->ts < lp->pe->GVT) - { - tw_error(TW_LOC, "You are attempting to rollback a buffer" - " with ts (%g) < GVT (%g)!", - m->ts, lp->pe->GVT); - } - - return m; -} - -static inline void -tw_memory_unshift(tw_lp * lp, tw_memory * m, tw_fd fd) -{ - if(m->nrefs) - return; - - tw_memoryq_push(tw_pe_getqueue(lp->pe, fd), m); -} - -static inline size_t -tw_memory_getsize(tw_pe * pe, int fd) -{ - return tw_pe_getqueue(pe, fd)->d_size + g_tw_memory_sz; -} - -static inline tw_fd -tw_memory_init(size_t n_mem, size_t d_sz, tw_stime mult) -{ -#ifndef ROSS_MEMORY - tw_error(TW_LOC, "ROSS memory library disabled!"); -#endif - - return tw_pe_memory_init(tw_getpe(0), n_mem, d_sz, mult); -} - -#endif diff --git a/core/tw-memoryq.h b/core/tw-memoryq.h deleted file mode 100644 index 2bf74fdce..000000000 --- a/core/tw-memoryq.h +++ /dev/null @@ -1,220 +0,0 @@ -#ifndef INC_tw_memoryq_h -#define INC_tw_memoryq_h - -static inline tw_memoryq * -tw_memoryq_init() -{ - tw_memoryq *q; - - q = tw_calloc(TW_LOC, "Memory Queue", sizeof(tw_memoryq), 1); - - if(!q) - tw_error(TW_LOC, "Error allocating queue!"); - - q->size = -1; - - return q; -} - -static inline void -tw_memoryq_debug(tw_memoryq * q) -{ -#if ROSS_DEBUG - tw_memory *next; - tw_memory *last; - - int cnt; - - cnt = 0; - next = q->head; - last = NULL; - - while(next) - { - cnt++; - - if(next->prev != last) - tw_error(TW_LOC, "Prev pointer not correct!"); - - last = next; - - next = next->next; - } - - if(q->tail != last) - tw_error(TW_LOC, "Tail pointer not correct!"); - - if(cnt != q->size) - tw_error(TW_LOC, "Size not correct!"); -#endif -} - -static inline void -tw_memoryq_push(tw_memoryq * q, tw_memory * buf) -{ - tw_memoryq_debug(q); - - buf->next = q->head; - buf->prev = NULL; - - if(q->head) - q->head->prev = buf; - - q->head = buf; - - if(!q->tail) - { - buf->next = NULL; - q->tail = buf; - } - - q->size++; - - tw_memoryq_debug(q); -} - -static inline void -tw_memoryq_push_list(tw_memoryq * q, tw_memory * h, tw_memory * t, int cnt) -{ - tw_memoryq_debug(q); - - t->next = q->head; - h->prev = NULL; - - if(q->head) - { - q->head->prev = t; - t->next = q->head; - } - - q->head = h; - q->head->prev = NULL; - - if(!q->tail) - q->tail = t; - - q->size += cnt; - - tw_memoryq_debug(q); -} - -static inline tw_memory * -tw_memoryq_pop(tw_memoryq * q) -{ - tw_memory *buf; - - tw_memoryq_debug(q); - - if(!q->head) - return NULL; - - buf = q->head; - - if(q->head->next) - { - q->head = q->head->next; - q->head->prev = NULL; - } else - q->head = q->tail = NULL; - - q->size--; - - buf->next = buf->prev = NULL; - - tw_memoryq_debug(q); - - return buf; -} - -static inline tw_memory * -tw_memoryq_pop_list(tw_memoryq * q) -{ - tw_memory *b; - - tw_memoryq_debug(q); - - q->size = 0; - - b = q->head; - q->head = q->tail = NULL; - - tw_memoryq_debug(q); - - return b; -} - -/* - * The purpose of this function is to be able to remove some - * part of a list.. could be all of list, from head to some inner - * buffer, or from some inner buffer to tail. I only care about the - * last case.. - */ -static inline void -tw_memoryq_splice(tw_memoryq * q, tw_memory * h, tw_memory * t, int cnt) -{ - tw_memoryq_debug(q); - - if(h == q->head && t == q->tail) - { - q->size = 0; - q->head = q->tail = NULL; - return; - } - - if(h == q->head) - q->head = t->next; - else - h->prev->next = t->next; - - if(t == q->tail) - q->tail = h->prev; - else - t->next->prev = h->prev; - - q->size -= cnt; - - tw_memoryq_debug(q); -} - -static inline void -tw_memoryq_delete_any(tw_memoryq * q, tw_memory * buf) -{ - tw_memory *next; - - tw_memoryq_debug(q); - - next = q->head; - while(next) - { - if(buf == next) - break; - - next = next->next; - } - - if(buf != next) - { - printf("Buffer not in this queue!! \n"); - return; - } - - tw_memoryq_debug(q); - - if(buf->prev != NULL) - buf->prev->next = buf->next; - else - q->head = buf->next; - - if(buf->next != NULL) - buf->next->prev = buf->prev; - else - q->tail = buf->prev; - - buf->next = buf->prev = NULL; - - q->size--; - - tw_memoryq_debug(q); -} - -#endif diff --git a/core/tw-pe.c b/core/tw-pe.c index 5f9f5f2b1..6835d85b7 100644 --- a/core/tw-pe.c +++ b/core/tw-pe.c @@ -2,16 +2,17 @@ static void dummy_pe_f (tw_pe *pe) { + (void) pe; } void -tw_pe_settype(tw_pe * pe, const tw_petype * type) +tw_pe_settype(const tw_petype * type) { - if (!pe) + if (!g_tw_pe) tw_error(TW_LOC, "Undefined PE!"); #define copy_pef(f, d) \ - pe->type.f = type->f ? type->f : d + g_tw_pe->type.f = type->f ? type->f : d copy_pef(pre_lp_init, dummy_pe_f); copy_pef(post_lp_init, dummy_pe_f); @@ -21,105 +22,46 @@ tw_pe_settype(tw_pe * pe, const tw_petype * type) #undef copy_pef } -tw_pe * -tw_pe_next(tw_pe * last) -{ - if (!last) - return g_tw_pe[0]; - if (!last->pe_next) - return NULL; - return *last->pe_next; -} - -void -tw_pe_create(tw_peid id) -{ - g_tw_npe = id; - g_tw_pe = (tw_pe **) tw_calloc(TW_LOC, "PE Array", sizeof(*g_tw_pe), id); -} - /* * 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_init(void) { - tw_pe *pe = (tw_pe *) tw_calloc(TW_LOC, "Local PE", sizeof(*pe), 1); + 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)); - 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 = g_tw_mynode; + tw_pe_settype(&no_type); - g_tw_pe[id] = pe; + g_tw_pe->trans_msg_ts = DBL_MAX; + g_tw_pe->gvt_status = 0; - g_tw_pe[id]->rng = tw_rand_init(31, 41); + // TODO is the PE RNG ever actually used? + g_tw_pe->rng = tw_rand_init(31, 41); } void -tw_pe_fossil_collect(tw_pe * me) +tw_pe_fossil_collect(void) { tw_kp *kp; - int i; + unsigned int i; g_tw_fossil_attempts++; for(i = 0; i < g_tw_nkp; i++) { kp = tw_getkp(i); - tw_eventq_fossil_collect(&kp->pevent_q, me); - -#ifdef ROSS_MEMORY - tw_kp_fossil_memory(kp); -#endif + tw_eventq_fossil_collect(&kp->pevent_q, g_tw_pe); } } -#ifdef ROSS_MEMORY -static int next_mem_q = 0; - -tw_fd -tw_pe_memory_init(tw_pe * pe, size_t n_mem, size_t d_sz, tw_stime mult) -{ - tw_memoryq *q; - - int fd; - - if(!pe->memory_q) - pe->memory_q = tw_calloc(TW_LOC, "KP memory queues", - sizeof(tw_memoryq), g_tw_memory_nqueues); - - fd = next_mem_q++; - pe->stats.s_mem_buffers_used = 0; - - q = &pe->memory_q[fd]; - - q->size = 0; - q->start_size = n_mem; - q->d_size = d_sz; - q->grow = mult; - - tw_memory_allocate(q); - - return fd; -} -#endif diff --git a/core/tw-sched.c b/core/tw-sched.c index 0ec9d726e..2043ea697 100644 --- a/core/tw-sched.c +++ b/core/tw-sched.c @@ -10,15 +10,7 @@ */ static inline void reset_bitfields(tw_event *revent) { - if (sizeof(revent->cv) == sizeof(uint32_t)){ - *(uint32_t*)&revent->cv = 0; - } - else if (sizeof(revent->cv) == sizeof(uint64_t)){ - *(uint64_t*)&revent->cv = 0; - } - else{ - memset(&revent->cv, 0, sizeof(revent->cv)); - } + memset(&revent->cv, 0, sizeof(revent->cv)); } /* @@ -175,7 +167,7 @@ static void tw_sched_batch(tw_pe * me) { tw_error(TW_LOC, "Event allocation failed %d consecutive times. Exiting.", max_alloc_fail_count); } } - tw_gvt_force_update(me); + tw_gvt_force_update(); break; } no_free_event_buffers = 0; @@ -242,7 +234,7 @@ static void tw_sched_batch(tw_pe * me) { cev = tw_eventq_peek(&ckp->pevent_q); ckp->last_time = cev ? cev->recv_ts : me->GVT; - tw_gvt_force_update(me); + tw_gvt_force_update(); me->stats.s_event_abort += tw_clock_read() - start; @@ -309,7 +301,7 @@ static void tw_sched_batch_realtime(tw_pe * me) { tw_error(TW_LOC, "Event allocation failed %d consecutive times. Exiting.", max_alloc_fail_count); } } - tw_gvt_force_update_realtime(me); + tw_gvt_force_update_realtime(); break; } no_free_event_buffers = 0; @@ -377,7 +369,7 @@ static void tw_sched_batch_realtime(tw_pe * me) { cev = tw_eventq_peek(&ckp->pevent_q); ckp->last_time = cev ? cev->recv_ts : me->GVT; - tw_gvt_force_update_realtime(me); + tw_gvt_force_update_realtime(); me->stats.s_event_abort += tw_clock_read() - start; @@ -391,7 +383,7 @@ static void tw_sched_batch_realtime(tw_pe * me) { /* Check if realtime GVT time interval has expired */ if( tw_clock_read() - g_tw_gvt_interval_start_cycles > g_tw_gvt_realtime_interval) { - tw_gvt_force_update_realtime(me); + tw_gvt_force_update_realtime(); break; // leave the batch function } @@ -416,17 +408,17 @@ void tw_sched_init(tw_pe * me) { tw_init_lps(me); (*me->type.post_lp_init)(me); - tw_net_barrier(me); + tw_net_barrier(); /* Second Stage Init -- all LPs are created and have proper mappings */ tw_pre_run_lps(me); - tw_net_barrier(me); + tw_net_barrier(); #ifdef USE_RIO tw_clock start = tw_clock_read(); io_load_events(me); me->stats.s_rio_load += (tw_clock_read() - start); - tw_net_barrier(me); + tw_net_barrier(); #endif /* @@ -435,7 +427,7 @@ void tw_sched_init(tw_pe * me) { */ if (tw_nnodes() > 1) { tw_net_read(me); - tw_net_barrier(me); + tw_net_barrier(); tw_clock_init(me); } @@ -443,9 +435,7 @@ void tw_sched_init(tw_pe * me) { * the scheduler loop, and to print out the stats before * finishing if someone should type CTRL-c */ - if (me->local_master) { - g_tw_sim_started = 1; - } + g_tw_sim_started = 1; } /*************************************************************************/ @@ -525,7 +515,7 @@ void tw_scheduler_conservative(tw_pe * me) { tw_clock start; unsigned int msg_i; - if ((g_tw_mynode == g_tw_masternode) && me->local_master) { + if (g_tw_mynode == g_tw_masternode) { printf("*** START PARALLEL CONSERVATIVE SIMULATION ***\n\n"); } @@ -560,7 +550,7 @@ void tw_scheduler_conservative(tw_pe * me) { * Go do fossil collect immediately. */ if (me->free_q.size <= g_tw_gvt_threshold) { - tw_gvt_force_update(me); + tw_gvt_force_update(); break; } @@ -627,11 +617,11 @@ void tw_scheduler_conservative(tw_pe * me) { tw_wall_now(&me->end_time); me->stats.s_total = tw_clock_read() - me->stats.s_total; - if ((g_tw_mynode == g_tw_masternode) && me->local_master) { + if (g_tw_mynode == g_tw_masternode) { printf("*** END SIMULATION ***\n\n"); } - tw_net_barrier(me); + tw_net_barrier(); // call the model PE finalize function (*me->type.final)(me); @@ -644,7 +634,7 @@ void tw_scheduler_conservative(tw_pe * me) { void tw_scheduler_optimistic(tw_pe * me) { tw_clock start; - if ((g_tw_mynode == g_tw_masternode) && me->local_master) { + if (g_tw_mynode == g_tw_masternode) { printf("*** START PARALLEL OPTIMISTIC SIMULATION WITH SUSPEND LP FEATURE ***\n\n"); } @@ -673,9 +663,9 @@ void tw_scheduler_optimistic(tw_pe * me) { tw_wall_now(&me->end_time); me->stats.s_total = tw_clock_read() - me->stats.s_total; - tw_net_barrier(me); + tw_net_barrier(); - if ((g_tw_mynode == g_tw_masternode) && me->local_master) { + if (g_tw_mynode == g_tw_masternode) { printf("*** END SIMULATION ***\n\n"); } @@ -692,7 +682,7 @@ void tw_scheduler_optimistic_realtime(tw_pe * me) { g_tw_gvt_realtime_interval = g_tw_gvt_interval * g_tw_clock_rate / 1000; - if ((g_tw_mynode == g_tw_masternode) && me->local_master) { + if (g_tw_mynode == g_tw_masternode) { printf("*** START PARALLEL OPTIMISTIC SIMULATION WITH SUSPEND LP FEATURE AND REAL TIME GVT ***\n\n"); } @@ -724,9 +714,9 @@ void tw_scheduler_optimistic_realtime(tw_pe * me) { tw_wall_now(&me->end_time); me->stats.s_total = tw_clock_read() - me->stats.s_total; - tw_net_barrier(me); + tw_net_barrier(); - if ((g_tw_mynode == g_tw_masternode) && me->local_master) { + if (g_tw_mynode == g_tw_masternode) { printf("*** END SIMULATION ***\n\n"); } diff --git a/core/tw-setup.c b/core/tw-setup.c index 10f8db559..9cd9c9120 100644 --- a/core/tw-setup.c +++ b/core/tw-setup.c @@ -38,7 +38,7 @@ void tw_init(int *argc, char ***argv) { #endif tw_opt_add(tw_net_init(argc, argv)); - + // Print out the command-line so we know what we passed in if (tw_ismaster()) { for (i = 0; i < *argc; i++) { @@ -76,8 +76,8 @@ void tw_init(int *argc, char ***argv) { #ifdef USE_DAMARIS st_damaris_ross_init(); if (!g_st_ross_rank) // Damaris ranks only - return; - else + return; + else { #endif @@ -86,7 +86,7 @@ void tw_init(int *argc, char ***argv) { struct stat buffer; int csv_check = stat("ross.csv", &buffer); - if (NULL == (g_tw_csv = fopen("ross.csv", "a"))) + if (NULL == (g_tw_csv = fopen("ross.csv", "a"))) tw_error(TW_LOC, "Unable to open: ross.csv\n"); if (csv_check == -1) @@ -120,21 +120,12 @@ void tw_init(int *argc, char ***argv) { } static void early_sanity_check(void) { -#if ROSS_MEMORY - if(0 == g_tw_memory_nqueues) { - tw_error(TW_LOC, "ROSS memory library enabled!"); - } -#endif - - if (!g_tw_npe) { - tw_error(TW_LOC, "need at least one PE"); - } if (!g_tw_nlp) { tw_error(TW_LOC, "need at least one LP"); } if (!nkp_per_pe) { - tw_printf(TW_LOC, "number of KPs (%u) must be >= PEs (%u), adjusting.", g_tw_nkp, g_tw_npe); - g_tw_nkp = g_tw_npe; + tw_printf(TW_LOC, "number of KPs (%u) must be >= 1, adjusting.", g_tw_nkp); + g_tw_nkp = 1; } } @@ -142,13 +133,11 @@ static void early_sanity_check(void) { * map: map LPs->KPs->PEs linearly */ void map_linear(void) { - tw_pe *pe; - int nlp_per_kp; - int lpid; - int kpid; - int i; - int j; + unsigned int nlp_per_kp; + tw_lpid lpid; + tw_kpid kpid; + unsigned int j; // may end up wasting last KP, but guaranteed each KP has == nLPs nlp_per_kp = (int)ceil((double) g_tw_nlp / (double) g_tw_nkp); @@ -161,36 +150,31 @@ void map_linear(void) { #if VERIFY_MAPPING printf("NODE %d: nlp %lld, offset %lld\n", g_tw_mynode, g_tw_nlp, g_tw_lp_offset); + printf("\tPE %d\n", g_tw_pe->id); #endif - for(kpid = 0, lpid = 0, pe = NULL; (pe = tw_pe_next(pe)); ) { -#if VERIFY_MAPPING - printf("\tPE %d\n", pe->id); -#endif - - for(i = 0; i < nkp_per_pe; i++, kpid++) { - tw_kp_onpe(kpid, pe); + for(kpid = 0, lpid = 0; kpid < nkp_per_pe; kpid++) { + tw_kp_onpe(kpid, g_tw_pe); #if VERIFY_MAPPING - printf("\t\tKP %d", kpid); + printf("\t\tKP %d", kpid); #endif - 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]); + for(j = 0; j < nlp_per_kp && lpid < g_tw_nlp; j++, lpid++) { + tw_lp_onpe(lpid, g_tw_pe, g_tw_lp_offset+lpid); + tw_lp_onkp(g_tw_lp[lpid], g_tw_kp[kpid]); #if VERIFY_MAPPING - if(0 == j % 20) { - printf("\n\t\t\t"); - } - printf("%lld ", lpid+g_tw_lp_offset); -#endif + if(0 == j % 20) { + printf("\n\t\t\t"); } + printf("%lld ", lpid+g_tw_lp_offset); +#endif + } #if VERIFY_MAPPING - printf("\n"); + printf("\n"); #endif - } } if(!g_tw_lp[g_tw_nlp-1]) { @@ -203,10 +187,11 @@ void map_linear(void) { } void map_round_robin(void) { - tw_pe * pe = g_tw_pe[0]; // ASSUMPTION: only 1 pe + tw_pe * pe = g_tw_pe; // ASSUMPTION: only 1 pe - int kpid, lpid; - int i; + tw_kpid kpid; + tw_lpid lpid; + unsigned int i; // ASSUMPTION: g_tw_nlp is the same on each rank int lp_stride = tw_nnodes(); @@ -231,14 +216,10 @@ void map_round_robin(void) { * but mainly just here. */ void tw_define_lps(tw_lpid nlp, size_t msg_sz) { - int i; + unsigned int i; g_tw_nlp = nlp; -#ifdef ROSS_MEMORY - g_tw_memory_sz = sizeof(tw_memory); -#endif - g_tw_msg_sz = msg_sz; early_sanity_check(); @@ -247,7 +228,7 @@ void tw_define_lps(tw_lpid nlp, size_t msg_sz) { * Construct the KP array. */ if( g_tw_nkp == 1 && g_tw_synchronization_protocol != OPTIMISTIC_DEBUG ) { // if it is the default, then check with the overide param - g_tw_nkp = nkp_per_pe * g_tw_npe; + g_tw_nkp = nkp_per_pe; } // else assume the application overloaded and has BRAINS to set its own g_tw_nkp @@ -255,7 +236,7 @@ void tw_define_lps(tw_lpid nlp, size_t msg_sz) { st_buffer_allocate(); //if (g_tw_mapping == CUSTOM) // analysis LPs currently only supported for custom mapping - specialized_lp_setup(); // for ROSS analysis LPs, important for setting g_st_analysis_nlp + specialized_lp_setup(); // for ROSS analysis LPs, important for setting g_st_analysis_nlp /* * Construct the LP array. @@ -363,7 +344,7 @@ void tw_run(void) { me = setup_pes(); // init instrumentation - st_inst_init(); + st_inst_init(); #ifdef USE_DAMARIS if (g_st_damaris_enabled) st_damaris_inst_init(); @@ -465,61 +446,49 @@ static void tw_delta_alloc(tw_pe *pe) { } static tw_pe * setup_pes(void) { - tw_pe *pe; - tw_pe *master; + tw_pe *pe = g_tw_pe; - int i; unsigned int num_events_per_pe; num_events_per_pe = 1 + g_tw_events_per_pe + g_tw_events_per_pe_extra; - master = g_tw_pe[0]; - - if (!master) { + if (!pe) { tw_error(TW_LOC, "No PE configured on this node."); } - if (g_tw_mynode == g_tw_masternode) { - master->master = 1; - } - master->local_master = 1; - - for(i = 0; i < g_tw_npe; i++) { - pe = g_tw_pe[i]; - if (g_tw_buddy_alloc) { - g_tw_buddy_master = create_buddy_table(g_tw_buddy_alloc); - if (g_tw_buddy_master == NULL) { - tw_error(TW_LOC, "create_buddy_table() failed."); - } - tw_delta_alloc(pe); + // TODO need to make sure we don't break this stuff + if (g_tw_buddy_alloc) { + g_tw_buddy_master = create_buddy_table(g_tw_buddy_alloc); + if (g_tw_buddy_master == NULL) { + tw_error(TW_LOC, "create_buddy_table() failed."); } - pe->pq = tw_pq_create(); + tw_delta_alloc(pe); + } + pe->pq = tw_pq_create(); - tw_eventq_alloc(&pe->free_q, num_events_per_pe); - pe->abort_event = tw_eventq_shift(&pe->free_q); + tw_eventq_alloc(&pe->free_q, num_events_per_pe); + pe->abort_event = tw_eventq_shift(&pe->free_q); #ifdef USE_RIO - tw_clock start = tw_clock_read(); - for (i = 0; i < g_io_events_buffered_per_rank; i++) { - tw_eventq_push(&g_io_free_events, tw_eventq_pop(&g_tw_pe[0]->free_q)); - } - pe->stats.s_rio_load = (tw_clock_read() - start); -#endif + int i; + tw_clock start = tw_clock_read(); + for (i = 0; i < g_io_events_buffered_per_rank; i++) { + tw_eventq_push(&g_io_free_events, tw_eventq_pop(&g_tw_pe->free_q)); } + pe->stats.s_rio_load = (tw_clock_read() - start); +#endif if (g_tw_mynode == g_tw_masternode) { printf("\nROSS Core Configuration: \n"); - printf("\t%-50s %11u\n", "Total Nodes", tw_nnodes()); + printf("\t%-50s %11u\n", "Total PEs", tw_nnodes()); fprintf(g_tw_csv, "%u,", tw_nnodes()); - printf("\t%-50s [Nodes (%u) x PE_per_Node (%lu)] %lu\n", "Total Processors", tw_nnodes(), g_tw_npe, (tw_nnodes() * g_tw_npe)); - //fprintf(g_tw_csv, "%lu,", (tw_nnodes() * g_tw_npe)); - printf("\t%-50s [Nodes (%u) x KPs (%lu)] %lu\n", "Total KPs", tw_nnodes(), g_tw_nkp, (tw_nnodes() * g_tw_nkp)); fprintf(g_tw_csv, "%lu,", (tw_nnodes() * g_tw_nkp)); + // TODO need to do an allreduce call to get actual total number of LPs (e.g., for CODES) printf("\t%-50s %11llu\n", "Total LPs", - ((unsigned long long)tw_nnodes() * (unsigned long long)g_tw_npe * g_tw_nlp)); - fprintf(g_tw_csv, "%llu,", ((unsigned long long)tw_nnodes() * (unsigned long long)g_tw_npe * g_tw_nlp)); + ((unsigned long long)tw_nnodes() * g_tw_nlp)); + fprintf(g_tw_csv, "%llu,", ((unsigned long long)tw_nnodes() * g_tw_nlp)); printf("\t%-50s %11.2lf\n", "Simulation End Time", g_tw_ts_end); fprintf(g_tw_csv, "%.2lf,", g_tw_ts_end); @@ -561,11 +530,12 @@ static tw_pe * setup_pes(void) { printf("\n"); #endif } - return master; + return pe; } // This is the default lp type mapping function // valid ONLY if there is one lp type tw_lpid map_onetype (tw_lpid gid) { + (void) gid; return 0; } diff --git a/core/tw-signal.c b/core/tw-signal.c index dfc705b7c..167ac63b0 100644 --- a/core/tw-signal.c +++ b/core/tw-signal.c @@ -19,17 +19,8 @@ tw_sigsegv(int sig) if (once) { - tw_pe *master = NULL; - tw_pe *pe = NULL; - - while(NULL != (pe = tw_pe_next(pe))) - { - if (pe->local_master == 1) - master = pe; - } - - if (master) - tw_stats(master); + if (g_tw_pe) + tw_stats(g_tw_pe); } once = 0; diff --git a/core/tw-state.c b/core/tw-state.c index 9ffd70d8e..3a546d51d 100644 --- a/core/tw-state.c +++ b/core/tw-state.c @@ -20,7 +20,7 @@ tw_snapshot(tw_lp *lp, size_t state_sz) long tw_snapshot_delta(tw_lp *lp, size_t state_sz) { - long i; + unsigned long i; tw_clock start; int ret_size = 0; unsigned char *current_state = (unsigned char *)lp->cur_state; @@ -33,14 +33,14 @@ tw_snapshot_delta(tw_lp *lp, size_t state_sz) start = tw_clock_read(); ret_size = LZ4_compress_fast_extState(scratch, (char*)snapshot, (char*)lp->pe->delta_buffer[1], state_sz, g_tw_delta_sz, g_tw_lz4_knob); - g_tw_pe[0]->stats.s_lz4 += (tw_clock_read() - start); + g_tw_pe->stats.s_lz4 += (tw_clock_read() - start); if (ret_size < 0) { tw_error(TW_LOC, "LZ4_compress error"); } start = tw_clock_read(); lp->pe->cur_event->delta_buddy = buddy_alloc(ret_size); - g_tw_pe[0]->stats.s_buddy += (tw_clock_read() - start); + g_tw_pe->stats.s_buddy += (tw_clock_read() - start); assert(lp->pe->cur_event->delta_buddy); lp->pe->cur_event->delta_size = ret_size; memcpy(lp->pe->cur_event->delta_buddy, lp->pe->delta_buffer[1], ret_size); @@ -54,13 +54,13 @@ tw_snapshot_delta(tw_lp *lp, size_t state_sz) void tw_snapshot_restore(tw_lp *lp, size_t state_sz) { - int i; + unsigned int i; tw_clock start = tw_clock_read(); unsigned char *snapshot = (unsigned char *)lp->pe->cur_event->delta_buddy; unsigned char *current_state = (unsigned char *)lp->cur_state; int ret = LZ4_decompress_fast((char *)snapshot, (char*)lp->pe->delta_buffer[0], state_sz); - g_tw_pe[0]->stats.s_lz4 += (tw_clock_read() - start); + g_tw_pe->stats.s_lz4 += (tw_clock_read() - start); if (ret < 0) { tw_error(TW_LOC, "LZ4_decompress_fast error"); } diff --git a/core/tw-stats.c b/core/tw-stats.c index 1a5790855..cd6ce2132 100644 --- a/core/tw-stats.c +++ b/core/tw-stats.c @@ -32,73 +32,68 @@ show_4f(const char *name, double v) #endif void -tw_get_stats(tw_pe * me, tw_statistics *s) +tw_get_stats(tw_pe * pe, tw_statistics *s) { - tw_pe *pe; - tw_kp *kp; + tw_kp *kp; - int i; + unsigned int i; - if (me != g_tw_pe[0]) + if (pe != g_tw_pe) return; if (0 == g_tw_sim_started) return; - - for(pe = NULL; (pe = tw_pe_next(pe));) - { - tw_wtime rt; - - tw_wall_sub(&rt, &pe->end_time, &pe->start_time); - - s->s_max_run_time = ROSS_MAX(s->s_max_run_time, tw_wall_to_double(&rt)); - s->s_nevent_abort += pe->stats.s_nevent_abort; - s->s_pq_qsize += tw_pq_get_size(me->pq); - - s->s_nsend_net_remote += pe->stats.s_nsend_net_remote; - s->s_nsend_loc_remote += pe->stats.s_nsend_loc_remote; - - s->s_nsend_network += pe->stats.s_nsend_network; - s->s_nread_network += pe->stats.s_nread_network; - s->s_nsend_remote_rb += pe->stats.s_nsend_remote_rb; - - s->s_total += pe->stats.s_total; - s->s_init += pe->stats.s_init; - s->s_net_read += pe->stats.s_net_read; - s->s_net_other += pe->stats.s_net_other; - s->s_gvt += pe->stats.s_gvt; - s->s_fossil_collect += pe->stats.s_fossil_collect; - s->s_event_abort += pe->stats.s_event_abort; - s->s_event_process += pe->stats.s_event_process; - s->s_pq += pe->stats.s_pq; - s->s_rollback += pe->stats.s_rollback; - s->s_cancel_q += pe->stats.s_cancel_q; - s->s_pe_event_ties += pe->stats.s_pe_event_ties; - s->s_min_detected_offset = g_tw_min_detected_offset; - s->s_avl += pe->stats.s_avl; - s->s_buddy += pe->stats.s_buddy; - s->s_lz4 += pe->stats.s_lz4; - s->s_stat_comp += pe->stats.s_stat_comp; - s->s_stat_write += pe->stats.s_stat_write; - s->s_events_past_end += pe->stats.s_events_past_end; + tw_wtime rt; + + tw_wall_sub(&rt, &pe->end_time, &pe->start_time); + + s->s_max_run_time = ROSS_MAX(s->s_max_run_time, tw_wall_to_double(&rt)); + s->s_nevent_abort += pe->stats.s_nevent_abort; + s->s_pq_qsize += tw_pq_get_size(pe->pq); + + s->s_nsend_net_remote += pe->stats.s_nsend_net_remote; + s->s_nsend_loc_remote += pe->stats.s_nsend_loc_remote; + + s->s_nsend_network += pe->stats.s_nsend_network; + s->s_nread_network += pe->stats.s_nread_network; + s->s_nsend_remote_rb += pe->stats.s_nsend_remote_rb; + + s->s_total += pe->stats.s_total; + s->s_init += pe->stats.s_init; + s->s_net_read += pe->stats.s_net_read; + s->s_net_other += pe->stats.s_net_other; + s->s_gvt += pe->stats.s_gvt; + s->s_fossil_collect += pe->stats.s_fossil_collect; + s->s_event_abort += pe->stats.s_event_abort; + s->s_event_process += pe->stats.s_event_process; + s->s_pq += pe->stats.s_pq; + s->s_rollback += pe->stats.s_rollback; + s->s_cancel_q += pe->stats.s_cancel_q; + s->s_pe_event_ties += pe->stats.s_pe_event_ties; + s->s_min_detected_offset = g_tw_min_detected_offset; + s->s_avl += pe->stats.s_avl; + s->s_buddy += pe->stats.s_buddy; + s->s_lz4 += pe->stats.s_lz4; + s->s_stat_comp += pe->stats.s_stat_comp; + s->s_stat_write += pe->stats.s_stat_write; + s->s_events_past_end += pe->stats.s_events_past_end; #ifdef USE_RIO - s->s_rio_load += pe->stats.s_rio_load; - s->s_rio_lp_init += pe->stats.s_rio_lp_init; + s->s_rio_load += pe->stats.s_rio_load; + s->s_rio_lp_init += pe->stats.s_rio_lp_init; #endif - s->s_alp_nevent_processed = pe->stats.s_alp_nevent_processed; - s->s_alp_e_rbs = pe->stats.s_alp_e_rbs; - - for(i = 0; i < g_tw_nkp; i++) - { - kp = tw_getkp(i); - s->s_nevent_processed += kp->s_nevent_processed; - s->s_e_rbs += kp->s_e_rbs; - s->s_rb_total += kp->s_rb_total; - s->s_rb_secondary += kp->s_rb_secondary; - } + s->s_alp_nevent_processed = pe->stats.s_alp_nevent_processed; + s->s_alp_e_rbs = pe->stats.s_alp_e_rbs; + + for(i = 0; i < g_tw_nkp; i++) + { + kp = tw_getkp(i); + s->s_nevent_processed += kp->s_nevent_processed; + s->s_e_rbs += kp->s_e_rbs; + s->s_rb_total += kp->s_rb_total; + s->s_rb_secondary += kp->s_rb_secondary; + } - } s->s_fc_attempts = g_tw_fossil_attempts; s->s_net_events = s->s_nevent_processed - s->s_e_rbs; @@ -134,7 +129,7 @@ tw_stats(tw_pe *me) size_t m_alloc, m_waste; tw_calloc_stats(&m_alloc, &m_waste); tw_lp *lp = NULL; - int i; + unsigned int i; for(i = 0; i < g_tw_nlp + g_st_analysis_nlp; i++) { lp = tw_getlp(i); @@ -195,7 +190,7 @@ tw_stats(tw_pe *me) show_lld("Total Events Scheduled Past End Time", s.s_events_past_end); printf("\nTW Memory Statistics:\n"); - show_lld("Events Allocated",(1+g_tw_events_per_pe+g_tw_events_per_pe_extra) * g_tw_npe); + show_lld("Events Allocated", 1 + g_tw_events_per_pe + g_tw_events_per_pe_extra); show_lld("Memory Allocated", m_alloc / 1024); show_lld("Memory Wasted", m_waste / 1024); diff --git a/core/tw-util.c b/core/tw-util.c index f8c3dcec9..054b321fc 100644 --- a/core/tw-util.c +++ b/core/tw-util.c @@ -47,7 +47,7 @@ tw_output(tw_lp *lp, const char *fmt, ...) va_start(ap, fmt); ret = vsnprintf(out->message, sizeof(out->message), fmt, ap); va_end(ap); - if (ret >= 0 && ret < sizeof(out->message)) { + if (ret >= 0 && (unsigned)ret < sizeof(out->message)) { // Should be successful } else { @@ -163,7 +163,7 @@ pool_alloc(size_t len) void *r; for (p = main_pool; p; p = p->next_pool) - if ((p->end_free - p->next_free >= len)) + if ((unsigned)(p->end_free - p->next_free) >= len) break; if (!p) { diff --git a/models/ROSS-Models b/models/ROSS-Models deleted file mode 160000 index 6e61c3a99..000000000 --- a/models/ROSS-Models +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6e61c3a993f158257c3ddc3f1d2ede577f0843d1 diff --git a/models/phold/CMakeLists.txt b/models/phold/CMakeLists.txt index 100cfb411..1a41777a0 100644 --- a/models/phold/CMakeLists.txt +++ b/models/phold/CMakeLists.txt @@ -34,3 +34,5 @@ ROSS_TEST_INSTRUMENTATION(phold) SET_TARGET_PROPERTIES(phold_test PROPERTIES COMPILE_DEFINITIONS TEST_COMM_ROSS) ROSS_TEST_SCHEDULERS(phold_test) ROSS_TEST_INSTRUMENTATION(phold_test) + +INSTALL(FILES ${ROSS_BINARY_DIR}/../models/phold/phold DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) diff --git a/models/phold/phold.c b/models/phold/phold.c index 961d8a435..fd2538e91 100644 --- a/models/phold/phold.c +++ b/models/phold/phold.c @@ -10,6 +10,7 @@ phold_map(tw_lpid gid) void phold_init(phold_state * s, tw_lp * lp) { + (void) s; int i; if( stagger ) @@ -37,6 +38,7 @@ phold_init(phold_state * s, tw_lp * lp) void phold_pre_run(phold_state * s, tw_lp * lp) { + (void) s; tw_lpid dest; if(tw_rand_unif(lp->rng) <= percent_remote) @@ -56,6 +58,8 @@ phold_pre_run(phold_state * s, tw_lp * lp) void phold_event_handler(phold_state * s, tw_bf * bf, phold_message * m, tw_lp * lp) { + (void) s; + (void) m; tw_lpid dest; if(tw_rand_unif(lp->rng) <= percent_remote) @@ -81,6 +85,8 @@ phold_event_handler(phold_state * s, tw_bf * bf, phold_message * m, tw_lp * lp) void phold_event_handler_rc(phold_state * s, tw_bf * bf, phold_message * m, tw_lp * lp) { + (void) s; + (void) m; tw_rand_reverse_unif(lp->rng); tw_rand_reverse_unif(lp->rng); @@ -90,11 +96,17 @@ phold_event_handler_rc(phold_state * s, tw_bf * bf, phold_message * m, tw_lp * l void phold_commit(phold_state * s, tw_bf * bf, phold_message * m, tw_lp * lp) { + (void) s; + (void) bf; + (void) m; + (void) lp; } void phold_finish(phold_state * s, tw_lp * lp) { + (void) s; + (void) lp; } tw_lptype mylps[] = { @@ -112,14 +124,18 @@ tw_lptype mylps[] = { void event_trace(phold_message *m, tw_lp *lp, char *buffer, int *collect_flag) { + (void) m; + (void) lp; + (void) buffer; + (void) collect_flag; return; } void phold_stats_collect(phold_state *s, tw_lp *lp, char *buffer) { - // just testing - int a = 1; - memcpy(buffer, &a, sizeof(a)); + (void) s; + (void) lp; + (void) buffer; return; } @@ -127,7 +143,10 @@ st_model_types model_types[] = { {(ev_trace_f) event_trace, 0, (model_stat_f) phold_stats_collect, - sizeof(int)}, + sizeof(int), + NULL, //(sample_event_f) + NULL, //(sample_revent_f) + 0}, {0} }; @@ -147,7 +166,7 @@ const tw_optdef app_opt[] = }; int -main(int argc, char **argv, char **env) +main(int argc, char **argv) { #ifdef TEST_COMM_ROSS @@ -166,10 +185,8 @@ main(int argc, char **argv, char **env) tw_comm_set(split_comm); #endif - int i; + unsigned int i; - // get rid of error if compiled w/ MEMORY queues - g_tw_memory_nqueues=1; // set a min lookahead of 1.0 lookahead = 1.0; tw_opt_add(app_opt); @@ -185,10 +202,8 @@ main(int argc, char **argv, char **env) //reset mean based on lookahead mean = mean - lookahead; - g_tw_memory_nqueues = 16; // give at least 16 memory queue event - offset_lpid = g_tw_mynode * nlp_per_pe; - ttl_lps = tw_nnodes() * g_tw_npe * nlp_per_pe; + ttl_lps = tw_nnodes() * nlp_per_pe; g_tw_events_per_pe = (mult * nlp_per_pe * g_phold_start_events) + optimistic_memory; //g_tw_rng_default = TW_FALSE; diff --git a/models/template-model b/models/template-model deleted file mode 160000 index aebdfcaad..000000000 --- a/models/template-model +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aebdfcaad7a775b691ce26cb8b97ee69c121328e From d25f0984a79873f26d7bf408fe33fc09227c57c6 Mon Sep 17 00:00:00 2001 From: Caitlin Ross Date: Thu, 2 May 2019 17:58:55 -0400 Subject: [PATCH 2/9] simplifying the build of static or shared libraries (#147) --- core/CMakeLists.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 9f1c2ca06..1d14353b5 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -129,16 +129,13 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DROSS_OPTION_LIST='\"${OPTIONS}\"'") # Generate Library ADD_LIBRARY(ROSS_obj OBJECT ${ross_srcs}) -ADD_LIBRARY(ROSS SHARED $) +OPTION(ROSS_BUILD_SHARED_LIBS "Build shared libraries instead of static" OFF) +SET(BUILD_SHARED_LIBS ${ROSS_BUILD_SHARED_LIBS}) +ADD_LIBRARY(ROSS $) SET_TARGET_PROPERTIES(ROSS PROPERTIES OUTPUT_NAME ROSS) TARGET_LINK_LIBRARIES(ROSS ${ROSS_EXTERNAL_LIBS}) TARGET_INCLUDE_DIRECTORIES(ROSS INTERFACE ${MPI_C_INCLUDE_PATH}) -ADD_LIBRARY(ROSS_static STATIC $) -SET_TARGET_PROPERTIES(ROSS_static PROPERTIES OUTPUT_NAME ROSS) -TARGET_LINK_LIBRARIES(ROSS_static ${ROSS_EXTERNAL_LIBS}) -TARGET_INCLUDE_DIRECTORIES(ROSS_static INTERFACE ${MPI_C_INCLUDE_PATH}) - if (COVERALLS) set(COVERAGE_SRCS ${ross_srcs}) # Don't check coverage on lz4 @@ -171,7 +168,7 @@ SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/ross.pc PROPERTIES GENER INSTALL(FILES ${ROSS_BINARY_DIR}/ross-config DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) INSTALL(FILES ${ROSS_BINARY_DIR}/config.h DESTINATION include) INSTALL(DIRECTORY ${ROSS_SOURCE_DIR}/ DESTINATION include FILES_MATCHING PATTERN "*.h") -INSTALL(TARGETS ROSS_static ROSS EXPORT ROSS-targets DESTINATION lib) +INSTALL(TARGETS ROSS EXPORT ROSS-targets DESTINATION lib) INSTALL(EXPORT ROSS-targets DESTINATION lib) INSTALL(FILES ROSSConfig.cmake DESTINATION lib) INSTALL(FILES ${ROSS_BINARY_DIR}/ross.pc DESTINATION lib/pkgconfig) From 2f10a736c590bc311a081a7cb07901fba0f8f6f3 Mon Sep 17 00:00:00 2001 From: Caitlin Ross Date: Fri, 3 May 2019 14:46:30 -0400 Subject: [PATCH 3/9] Update to the way the build process grabs version number (#148) * updating the way the version number is grabbed, so we can have the actual version and not the git commit * fixing an error that caused coveralls to fail --- core/CMakeLists.txt | 20 ++++++++++++++++++-- core/GitSHA1.cpp.in | 2 -- core/GitSHA1.h | 3 --- core/cmake/GetGitRevisionDescription.cmake | 1 - core/config.h.in | 2 +- core/ross.pc.in | 2 +- core/tw-setup.c | 2 +- core/version.cpp.in | 4 ++++ core/version.h | 9 +++++++++ 9 files changed, 34 insertions(+), 11 deletions(-) delete mode 100644 core/GitSHA1.cpp.in delete mode 100644 core/GitSHA1.h create mode 100644 core/version.cpp.in create mode 100644 core/version.h diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 1d14353b5..55b6c42d7 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -74,9 +74,25 @@ CHECK_FUNCTION_EXISTS(ctime HAVE_CTIME) ## Print ROSS Git Hash # From http://stackoverflow.com/questions/1435953/how-can-i-pass-git-sha1-to-compiler-as-definition-using-cmake +# Now following this approach (which is based on the previous): +# http://ipenguin.ws/2012/11/cmake-automatically-use-git-tags-as.html +# This way lets us use the actual version numbers of ROSS, instead of the git commit LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") INCLUDE(GetGitRevisionDescription) -GET_GIT_HEAD_REVISION(GIT_REFSPEC GIT_SHA1) +#GET_GIT_HEAD_REVISION(GIT_REFSPEC GIT_SHA1) + +git_describe(VERSION --tags --dirty=-d) + +#parse the version information into pieces. +string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}") +string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION}") +string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${VERSION}") +string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" VERSION_SHA1 "${VERSION}") +set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in + ${CMAKE_CURRENT_BINARY_DIR}/version.cpp) +set(version_file "${CMAKE_CURRENT_BINARY_DIR}/version.cpp") # Data Structure for remote Events # If AVL_TREE is OFF, ROSS reverts to hashing @@ -127,7 +143,7 @@ ENDIF(CMAKE_BUILD_TYPE MATCHES Debug) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DROSS_OPTION_LIST='\"${OPTIONS}\"'") # Generate Library -ADD_LIBRARY(ROSS_obj OBJECT ${ross_srcs}) +ADD_LIBRARY(ROSS_obj OBJECT ${ross_srcs} ${version_file}) OPTION(ROSS_BUILD_SHARED_LIBS "Build shared libraries instead of static" OFF) SET(BUILD_SHARED_LIBS ${ROSS_BUILD_SHARED_LIBS}) diff --git a/core/GitSHA1.cpp.in b/core/GitSHA1.cpp.in deleted file mode 100644 index aeaef1dfa..000000000 --- a/core/GitSHA1.cpp.in +++ /dev/null @@ -1,2 +0,0 @@ -#define GIT_SHA1 "@GIT_SHA1@" -const char ROSS_VERSION[] = GIT_SHA1; diff --git a/core/GitSHA1.h b/core/GitSHA1.h deleted file mode 100644 index f7d70a2e5..000000000 --- a/core/GitSHA1.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef _GIT_SHA1_H -extern const char ROSS_VERSION[]; -#endif /* _GIT_SHA1_H */ diff --git a/core/cmake/GetGitRevisionDescription.cmake b/core/cmake/GetGitRevisionDescription.cmake index c8d27f2e8..f4b5a9a44 100644 --- a/core/cmake/GetGitRevisionDescription.cmake +++ b/core/cmake/GetGitRevisionDescription.cmake @@ -107,7 +107,6 @@ function(git_describe _var) execute_process(COMMAND "${GIT_EXECUTABLE}" describe - ${hash} ${ARGN} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" diff --git a/core/config.h.in b/core/config.h.in index 6e1f5b76d..37f07e805 100644 --- a/core/config.h.in +++ b/core/config.h.in @@ -8,7 +8,7 @@ // ROSS Core #cmakedefine HAVE_CTIME 1 -#define ROSS_VERSION "${GIT_SHA1}" +#define ROSS_VERSION "${VERSION_SHORT}" #cmakedefine AVL_TREE 1 #cmakedefine USE_BGPM #cmakedefine RAND_NORMAL diff --git a/core/ross.pc.in b/core/ross.pc.in index 1082425d3..e1e7dec15 100644 --- a/core/ross.pc.in +++ b/core/ross.pc.in @@ -6,7 +6,7 @@ ross_libs=-lROSS -lm Name: ROSS Description: Rensselaer's Optimistic Simulation System -Version: 1.0 +Version: @VERSION_SHORT@ URL: https://github.com/ROSS-org/ROSS Requires: Libs: ${ross_ldflags} ${ross_libs} diff --git a/core/tw-setup.c b/core/tw-setup.c index 9cd9c9120..ec8f27634 100644 --- a/core/tw-setup.c +++ b/core/tw-setup.c @@ -54,7 +54,7 @@ void tw_init(int *argc, char ***argv) { time(&raw_time); printf("%s\n", ctime(&raw_time)); #endif - printf("ROSS Revision: %s\n\n", ROSS_VERSION); + printf("ROSS Version: %s\n\n", ROSS_VERSION); } #endif diff --git a/core/version.cpp.in b/core/version.cpp.in new file mode 100644 index 000000000..f860c2586 --- /dev/null +++ b/core/version.cpp.in @@ -0,0 +1,4 @@ +#include "version.h" + +const std::string ROSS_VERSION = "@VERSION@"; +const std::string ROSS_VERSION_SHORT = "@VERSION_SHORT@"; diff --git a/core/version.h b/core/version.h new file mode 100644 index 000000000..1d6b455d3 --- /dev/null +++ b/core/version.h @@ -0,0 +1,9 @@ +#ifndef VERSION_H +#define VERSION_H + + +//Global version strings +extern const std::string ROSS_VERSION; +extern const std::string ROSS_VERSION_SHORT; + +#endif //VERSION_H From 62bb6b73579c5a32d76f03be8ef231b72cf0de56 Mon Sep 17 00:00:00 2001 From: Caitlin Ross Date: Fri, 3 May 2019 15:04:14 -0400 Subject: [PATCH 4/9] updating README and removing out-of-date README-vis (current info is on webpage) --- README-vis.md | 141 -------------------------------------------------- README.md | 6 ++- 2 files changed, 4 insertions(+), 143 deletions(-) delete mode 100644 README-vis.md diff --git a/README-vis.md b/README-vis.md deleted file mode 100644 index 0da794267..000000000 --- a/README-vis.md +++ /dev/null @@ -1,141 +0,0 @@ -## README for ROSS Instrumentation - -Currently several different types of instrumentation have been added to ROSS that can be used to collect data on the simulation engine and/or the model being simulated: GVT-based, real time sampling, and event tracing. For GVT-based and real time-based sampling modes you can now collect simulation engine data and model-level data. For collection of simulation engine data, the models should not require any code changes. Obviously to collect model-level data, this will require adding in some code to the model(s), but we've attempted to keep this as simple as possible. - -All 3 instrumentation types can be used independently or together. The command line options for the instrumentation are shown under the title "ROSS Instrumentation" when you run `--help` with a ROSS/CODES model. Just make sure to update ROSS for the instrumentation and then rebuild your model (including CODES if necessary). For all instrumentation types, you can use `--stats-filename` option to set a prefix for the output files. All of the output files are stored in a directory named `stats-output` that is created in the running directory. - -### GVT-based Instrumentation -This collects data immediately after each GVT and can be turned on by using `--enable-gvt-stats=1` at runtime. By default, the data is collected on a PE basis, but some metrics can be changed to tracking on a KP or LP basis (depending on the metric). To turn on instrumentation for the KP/LP granularity, use `--granularity=1`. - -When collecting only on a PE basis (i.e., `--granularity=0`), this is the format of the data: - -``` -PE_ID, GVT, all_reduce_count, events_processed, events_aborted, events_rolled_back, event_ties, -total_rollbacks, secondary_rollbacks, fossil_collects, network_sends, -network_recvs, remote_events, efficiency -``` - -When collecting on a KP/LP basis, this is the format: - -``` -PE_ID, GVT, all_reduce_count, events_aborted, event_ties, fossil_collect, efficiency, -total_rollbacks_KP0, secondary_rollbacks_KP0, ..., total_rollbacks_KPi, secondary_rollbacks_KPi, -events_processed_LP0, events_rolled_back_LP0, network_sends_LP0, network_recvs_LP0, remote_events_LP0, -..., events_processed_LPj, events_rolled_back_LPj, network_sends_LPj,network_recvs_LPj, -remote_events_LPj -``` - -where i,j are the total number of KPs and LPs per PE, respectively. - -You can also choose to sample less often at GVT using the `--num-gvt=n` command, where n is the number of GVT computations to complete between each sampling point. - -### Real Time Sampling -This collects data at real time intervals specified by the user. -It is turned on using `--real-time-samp=n`, where n is the number of milliseconds per interval. This collects all of the same data as the GVT-based instrumentation, as well as some other metrics, which is the difference in GVT and local virtual time for each KP as well as the cycle counters for the PEs (e.g., how much time is spent in event processing, roll back processing, GVT, etc). The difference in GVT and KP virtual time is always recorded per KP, regardless of how `--granularity` is set. For the other metrics, the granularity can be switched as described in the section on the GVT-based instrumentation. - -When collecting on a PE basis, this is the data format: - -``` -PE_ID, current_real_time, current_GVT, time_ahead_GVT_KP0, ..., time_ahead_GVT_KPi, -network_read_CC, gvt_CC, fossil_collect_CC, event_abort_CC, event_processing_CC, -priority_queue_CC, rollbacks_CC, cancelq_CC, avl_CC, buddy_CC, lz4_CC, -events_aborted, pq_size, remote_events, network_sends, network_recvs, -event_ties, fossil_collects, num_GVT, events_processed, events_rolled_back, -total_rollbacks, secondary_rollbacks, -``` - -For the KP/LP granularity: -``` -PE_ID, current_real_time, current_GVT, time_ahead_GVT_KP0, ..., time_ahead_GVT_KPi, -network_read_CC, gvt_CC, fossil_collect_CC, event_abort_CC, event_processing_CC, -priority_queue_CC, rollbacks_CC, cancelq_CC, avl_CC, buddy_CC, lz4_CC, -events_aborted, pq_size, event_ties, fossil_collects, num_GVT, -total_rollbacks_KP0, secondary_rollbacks_KP0, ..., total_rollbacks_KPi, secondary_rollbacks_KPi, -events_processed_LP0, events_rolled_back_LP0, network_sends_LP0, network_recvs_LP0, remote_events_LP0, -..., events_processed_LPj, events_rolled_back_LPj, network_sends_LPj,network_recvs_LPj, -remote_events_LPj -``` - - -### Event Tracing -There are two ways to collect the event trace. One is to collect data only about events that are causing rollbacks. When an event that should have been processed in the past is received, data about this event is collected (described below). The other method of event tracing is to collect data for all events. For event tracing, ROSS can directly access the source and destination LP IDs for each event, as well as the sent and received virtual timestamps. It will also record the real time that the event is computed at. To turn on the event tracing with either `--event-trace=1` for full event trace or `--event-trace=2` for tracing only events that cause rollbacks. - -Because event types are determined by the model developer, ROSS cannot directly access this. -The user can create a callback function that ROSS will use to collect the event type, and ROSS will then handle storing -the data in the buffer and the I/O. The benefit to this is that the user can choose to collect other data about the event, -and ROSS will handle this as well. It's important to remember that this data collection will result in a lot of output, since it's happening per event. The details on using event tracing with model-level data is described in the next section on Model-level sampling - -### Model-level data sampling -To turn on the model-level data sampling, you need to use `--model-stats=n`. You can turn it on for the GVT-based sampling (`--model-stats=1`), real time sampling (`--model-stats=2`), or both (`--model-stats=3`). It will sample the model data at the same time as the simulation engine data, depending on the modes you have turned on. You do not actually need to turn on the simulation engine instrumentation though. For instance, setting `--model-stats=1` with no other ROSS instrumentation options specified, will sample model data at each GVT, but will not sample the simulation engine data. We have plans to add sampling on a virtual time basis (i.e., the user specifies the virtual time interval instead of sampling at GVT) in the future. - -Registering the function pointers necessary for the callback functions required for the model-level sampling is implemented similarly to how the LP type function pointers are implemented. (As a side note, it is a different struct, so that non-instrumented ROSS can still be run without requiring any additions to models). - -##### Function pointers: -```C -typedef void (*rbev_trace_f) (void *msg, tw_lp *lp, char *buffer, int *collect_flag); -typedef void (*ev_trace_f) (void *msg, tw_lp *lp, char *buffer, int *collect_flag); -typedef void (*model_stat_f) (void *sv, tw_lp *lp, char *buffer); -``` - -The first two functions are for the event tracing functionality. `msg` is the message being passed, `lp` is the LP pointer. `buffer` is the pointer to where the data needs to be copied for ROSS to manage. `collect_flag` is a pointer to a ROSS flag. By default `*collect_flag == 1`. This means that the event will be collected. This flag was added to let you control whether specific events for an LP are collected or not. Change the value to 0 for any events you do not want to show in the trace. This means even the ROSS level data will not be collected for that event (e.g., src_LP, dest_LP, etc). You can use this feature to turn off event tracing for certain events, reducing the amount of data you will be storing. - -The third function is for model-level data to be sampled at the same time as the simulation engine data (at GVT or based on real time). `sv` is the pointer to the LP state. - - -##### Model types struct for function pointers -```C -typedef struct st_model_types st_model_types; -struct st_model_types { - rbev_trace_f rbev_trace; /* function pointer to collect data about events causing rollbacks */ - size_t rbev_sz; /* size of data collected from model about events causing rollbacks */ - ev_trace_f ev_trace; /* function pointer to collect data about all events for given LP */ - size_t ev_sz; /* size of data collected from model for each event */ - model_stat_f model_stat_fn; /* function pointer to collect model-level data */ - size_t mstat_sz; /* size of data collected from model at sampling points */ -}; -``` -This is the struct where we provide the function pointers to ROSS. `rbev_trace` is the pointer for the event collection for only events causing rollbacks, while `ev_trace` is for the full event collection. `rbev_sz` and `ev_sz` are the sizes of the data that need to be pushed to the buffer for the rollback causing events, or for all events, respectively. `model_stat_fn` is the pointer for collecting model-level data with the GVT-based and real time sampling modes. Similarly, `mstat_sz` is the size of the data that will be saved at each sampling point for that LP. - -There are two ways of registering your pointer functions with ROSS depending on the way you register your LP types with ROSS: - -###### Method 1 -If you call the `tw_lp_settype()` for LP type registration with ROSS, you should follow this method. - -To register the function pointers with ROSS, call `st_model_settype(tw_lpid i, st_trace_type *trace_types)` right after you call the `tw_lp_settype()` function when initializing your LPs. You can also choose to turn event tracing on for only certain LPs. To do this, you only need to call `st_model_settype()` with the appropriate arguments for the LPs you want event tracing turned on. - -For example, here is how it is done in PHOLD in `main()`: -```C -for (i = 0; i < g_tw_nlp; i++) -{ -    tw_lp_settype(i, &mylps[0]); -    st_model_settype(i, &model_types[0]); -} -``` - -`mylps` is the `tw_lptype` struct containing the usual ROSS function pointers for initialization, event handlers, etc. `model_types` is the `st_model_types` struct described above. - -If your model is a part of CODES, the CODES mapping will handle this for you. See the [CODES repo](https://xgitlab.cels.anl.gov/codes/codes) and documentation for more details. - -###### Method 2 -If you call the `tw_lp_setup_types()` function for LP registration, follow this method. This requires that you set `g_tw_lp_types` and `g_tw_lp_typemap`. - -Similarly for registering the model sampling functions, you'll need to set `st_model_types *g_st_model_types`. This needs to be set *before* the call to `tw_lp_setup_types()`. If you have multiple LP types that you are registering, the array of `st_model_types` should be in the same order as the `tw_lptypes` array that you set `g_tw_lp_types` to point to. - -That's it. The call to `tw_lp_setup_types()` will make the call to `st_model_setup_types()` if you have anything requiring model-level sampling turned on. - - - -### Output formatting -All collected data is pushed to a buffer as it is collected, in order to reduce the amount of I/O accesses. Currently the buffer is per PE. If multiple instrumentation modes are used, each has its own buffer. The default buffer size is 8 MB but this can be changed using `--buffer-size=n`, where n is the size of the buffer in bytes. - -After GVT, the buffer's free space is checked. By default, if there is less than 15% free space, then it is dumped to file in a binary format. This can be changed using `--buffer-free=n`, where n is the percentage of free space it checks for before writing out. - -The output is in binary and right now it outputs one file per simulation per instrumentation type (e.g., if you run both GVT-based and real time instrumentation, you get a file with the GVT data and a 2nd file for the real time sampling). ROSS will create a directory called stats-output that these files will be placed in. - -There is a basic binary reader for all of the instrumentation modes being developed in the -[ROSS Binary Reader repo](https://github.com/caitlinross/ross-binary-reader). For the time being, ROSS will output a README file in the stats-output directory with the given filename prefix. The file contains some general information about values of input parameters, but also has data that the reader can use to correctly read the instrumentation data. - -### Other notes -There are a couple of other options that show up in the ROSS stats options. One is `--disable-output=1`. This is for use when examining the perturbation of the data collection on the simulation. It means that data (for GVT and real time collections) will be pushed to the buffer, but the buffer will never be dumped, so it will just keep overwriting data. This is so we can measure the effects of the instrumentation layer itself without the I/O, otherwise you'll want to leave this turned off. At some point in the future, this will probably be converted into allowing data to be streamed to an in situ analysis system. - - diff --git a/README.md b/README.md index 97caeac99..53d8d6c7c 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ You may find the now-deprecated version at the [ROSS-Legacy tag](https://github. Using this repository you can compare files from the new `ROSS/core` to `ROSS/ross`. For a detailed list of changes between old ROSS and SR please visit [the wiki](https://github.com/ROSS-org/ROSS/wiki/Differences-between-Simplified-ROSS-and-ROSS-Legacy). +For the most recent docs and other important posts about ROSS, see the [ROSS webpage](http://ross-org.github.io). + [![Build Status](https://travis-ci.com/ROSS-org/ROSS.svg?branch=master)](https://travis-ci.com/ROSS-org/ROSS) [![codecov.io](http://codecov.io/github/ROSS-org/ROSS/coverage.svg?branch=master)](http://codecov.io/github/ROSS-org/ROSS?branch=master) [![Doxygen](https://img.shields.io/badge/doxygen-reference-blue.svg)](http://ross-org.github.io/ROSS-docs/docs/html) @@ -27,7 +29,7 @@ Developed as Simplified ROSS ([gonsie/SR](http://github.com/gonsie/SR)), this ve ## Requirements 1. ROSS is written in C standard and thus requires a C compiler (C11 is prefered, but not required). -2. The build system is [CMake](http://cmake.org), and we require version 2.8 or higher. +2. The build system is [CMake](http://cmake.org), and we require version 3.5 or higher. 3. ROSS relies on MPI. We recommend the [MPICH](http://www.mpich.org) implementation. @@ -47,7 +49,7 @@ Developed as Simplified ROSS ([gonsie/SR](http://github.com/gonsie/SR)), this ve git submodule update ``` Currently, ROSS includes one submodule: - - [damaris aka RISA](https://github.com/ROSS-org/RISA) ROSS In Situ Analysis + - [RISA](https://github.com/ROSS-org/RISA) ROSS In Situ Analysis 3. *Optional* Symlink your model to ROSS. Please [this wiki page](https://github.com/ROSS-org/ROSS/wiki/Constructing-the-Model) for details about creating and integrating a model with ROSS. From 9b73765a1cccd73bdef9a5089080838a5cf24dba Mon Sep 17 00:00:00 2001 From: Caitlin Ross Date: Fri, 3 May 2019 15:37:37 -0400 Subject: [PATCH 5/9] few more updates to README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 53d8d6c7c..e6ecf8a83 100644 --- a/README.md +++ b/README.md @@ -52,13 +52,13 @@ Developed as Simplified ROSS ([gonsie/SR](http://github.com/gonsie/SR)), this ve - [RISA](https://github.com/ROSS-org/RISA) ROSS In Situ Analysis 3. *Optional* Symlink your model to ROSS. -Please [this wiki page](https://github.com/ROSS-org/ROSS/wiki/Constructing-the-Model) for details about creating and integrating a model with ROSS. +Please [this blog post](https://ross-org.github.io/setup/build-model-with-ross.html) for details about creating and integrating a model with ROSS. ``` ln -s ~/path-to/your-existing-model models/your-model-name ``` 4. Create a build directory. -ROSS developers typically do out-of-tree builds. See the [Installation page](https://github.com/ROSS-org/ROSS/wiki/Installation) for more details. +ROSS developers typically do out-of-tree builds. See the [Installation page](https://ross-org.github.io/setup/installation.html) for more details. ``` cd ~/directory-of-builds/ mkdir ROSS-build @@ -74,7 +74,7 @@ ROSS developers typically do out-of-tree builds. See the [Installation page](ht ``` 6. Run your model. -See [this wiki page](https://github.com/ROSS-org/ROSS/wiki/Running-the-Simulator) for details about the ROSS command line options. +See [this blog post](https://ross-org.github.io/setup/running-sim.html) for details about the ROSS command line options. ``` cd ~/directory-of-builds/ROSS-build/models/your-model ./your-model --synch=1 // sequential mode From 7e0eef99979679d12f7f19a5d3f46a37f932f93f Mon Sep 17 00:00:00 2001 From: Caitlin Ross Date: Fri, 3 May 2019 16:04:44 -0400 Subject: [PATCH 6/9] changing damaris submodule/directory to risa --- .gitmodules | 6 +++--- core/CMakeLists.txt | 2 +- core/{damaris => risa} | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename core/{damaris => risa} (100%) diff --git a/.gitmodules b/.gitmodules index f1f549816..0c9a798f7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "damaris"] - path = core/damaris - url = https://github.com/caitlinross/ROSS-damaris +[submodule "risa"] + path = core/risa + url = https://github.com/ROSS-org/RISA diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 55b6c42d7..fd7461cbe 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -118,7 +118,7 @@ ENDIF(USE_RIO) # Damaris I/O and data management OPTION(USE_DAMARIS "Build with Damaris library (for in situ vis/analysis)?" OFF) if (USE_DAMARIS) - ADD_SUBDIRECTORY(damaris) + ADD_SUBDIRECTORY(risa) INCLUDE_DIRECTORIES(${DAMARIS_INCLUDE}) SET(ross_srcs ${ross_srcs} ${ROSS_Damaris_SOURCE_DIR}/core/damaris.h) ENDIF(USE_DAMARIS) diff --git a/core/damaris b/core/risa similarity index 100% rename from core/damaris rename to core/risa From d8be7e48f4e48584debe4b718e6db3fa14693ab7 Mon Sep 17 00:00:00 2001 From: "Elsa Gonsiorowski, PhD" Date: Sat, 11 May 2019 16:02:42 -0700 Subject: [PATCH 7/9] see if gcov and clang versions match (#150) * see if gcov and clang versions match * maybe we should be using lcov... since we apt-get it * whitespace * what version is llvm-cov? * use llvm-cov * llvm-cov gcov * remove cov version checks --- core/cmake/CoverallsGenerateGcov.cmake | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/core/cmake/CoverallsGenerateGcov.cmake b/core/cmake/CoverallsGenerateGcov.cmake index c4276c94c..0d28797fb 100644 --- a/core/cmake/CoverallsGenerateGcov.cmake +++ b/core/cmake/CoverallsGenerateGcov.cmake @@ -33,8 +33,8 @@ # # Example for running as standalone CMake script from the command line: # (Note it is important the -P is at the end...) -# $ cmake -DCOV_PATH=$(pwd) -# -DCOVERAGE_SRCS="catcierge_rfid.c;catcierge_timer.c" +# $ cmake -DCOV_PATH=$(pwd) +# -DCOVERAGE_SRCS="catcierge_rfid.c;catcierge_timer.c" # -P ../cmake/CoverallsGcovUpload.cmake # CMAKE_MINIMUM_REQUIRED(VERSION 2.8) @@ -65,7 +65,8 @@ endif() # CMake list format. string(REGEX REPLACE "\\*" ";" COVERAGE_SRCS ${COVERAGE_SRCS}) -find_program(GCOV_EXECUTABLE gcov) +find_program(GCOV_EXECUTABLE llvm-cov) +message("Found ${GCOV_EXECUTABLE}") if (NOT GCOV_EXECUTABLE) message(FATAL_ERROR "gcov not found! Aborting...") @@ -121,9 +122,9 @@ endif() # macro(get_source_path_from_gcov_filename _SRC_FILENAME _GCOV_FILENAME) - # /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov - # -> - # #path#to#project#root#subdir#the_file.c.gcov + # /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov + # -> + # #path#to#project#root#subdir#the_file.c.gcov get_filename_component(_GCOV_FILENAME_WEXT ${_GCOV_FILENAME} NAME) # #path#to#project#root#subdir#the_file.c.gcov -> /path/to/project/root/subdir/the_file.c @@ -161,7 +162,7 @@ foreach(GCDA ${GCDA_FILES}) # If -p is not specified then the file is named only "the_file.c.gcov" # execute_process( - COMMAND ${GCOV_EXECUTABLE} -p -o ${GCDA_DIR} ${GCDA} + COMMAND ${GCOV_EXECUTABLE} gcov -p -o ${GCDA_DIR} ${GCDA} WORKING_DIRECTORY ${COV_PATH} ) endforeach() @@ -191,9 +192,9 @@ file(GLOB ALL_GCOV_FILES ${COV_PATH}/*.gcov) # ALL_GCOV_FILES = # /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov # /path/to/project/root/build/#path#to#project#root#subdir#other_file.c.gcov -# +# # Result should be: -# GCOV_FILES = +# GCOV_FILES = # /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov # set(GCOV_FILES "") @@ -206,9 +207,9 @@ set(COVERAGE_SRCS_REMAINING ${COVERAGE_SRCS}) foreach (GCOV_FILE ${ALL_GCOV_FILES}) # - # /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov - # -> - # /path/to/project/root/subdir/the_file.c + # /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov + # -> + # /path/to/project/root/subdir/the_file.c get_source_path_from_gcov_filename(GCOV_SRC_PATH ${GCOV_FILE}) # Is this in the list of source files? @@ -306,8 +307,8 @@ foreach (GCOV_FILE ${GCOV_FILES}) # Example of what we're parsing: # Hitcount |Line | Source # " 8: 26: if (!allowed || (strlen(allowed) == 0))" - string(REGEX REPLACE - "^([^:]*):([^:]*):(.*)$" + string(REGEX REPLACE + "^([^:]*):([^:]*):(.*)$" "\\1;\\2;\\3" RES "${GCOV_LINE}") @@ -344,7 +345,7 @@ foreach (GCOV_FILE ${GCOV_FILES}) # Lines with 0 line numbers are metadata and can be ignored. if (NOT ${LINE} EQUAL 0) - + if (DO_SKIP) set(GCOV_FILE_COVERAGE "${GCOV_FILE_COVERAGE}null, ") else() @@ -424,7 +425,6 @@ string(CONFIGURE ${JSON_TEMPLATE} JSON) file(WRITE "${COVERALLS_OUTPUT_FILE}" "${JSON}") message("###########################################################################") -message("Generated coveralls JSON containing coverage data:") +message("Generated coveralls JSON containing coverage data:") message("${COVERALLS_OUTPUT_FILE}") message("###########################################################################") - From 1375c71984bfb463c5b44cc44a4fd94ebc38895c Mon Sep 17 00:00:00 2001 From: Caitlin Ross Date: Thu, 16 May 2019 13:57:33 -0400 Subject: [PATCH 8/9] removing ROSS_obj from Cmake build - no longer necessary with single library creation --- core/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index fd7461cbe..28c6c9dd9 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -143,11 +143,9 @@ ENDIF(CMAKE_BUILD_TYPE MATCHES Debug) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DROSS_OPTION_LIST='\"${OPTIONS}\"'") # Generate Library -ADD_LIBRARY(ROSS_obj OBJECT ${ross_srcs} ${version_file}) - OPTION(ROSS_BUILD_SHARED_LIBS "Build shared libraries instead of static" OFF) SET(BUILD_SHARED_LIBS ${ROSS_BUILD_SHARED_LIBS}) -ADD_LIBRARY(ROSS $) +ADD_LIBRARY(ROSS ${ross_srcs} ${version_file}) SET_TARGET_PROPERTIES(ROSS PROPERTIES OUTPUT_NAME ROSS) TARGET_LINK_LIBRARIES(ROSS ${ROSS_EXTERNAL_LIBS}) TARGET_INCLUDE_DIRECTORIES(ROSS INTERFACE ${MPI_C_INCLUDE_PATH}) From 38e0a2e4b968ae02431695b6122150c537c0cac6 Mon Sep 17 00:00:00 2001 From: Caitlin Ross Date: Thu, 16 May 2019 14:34:40 -0400 Subject: [PATCH 9/9] removing some files that are actually unnecessary for version numbers as well as having ROSS output both version number and commit, instead of just version --- core/CMakeLists.txt | 8 +++----- core/config.h.in | 2 +- core/version.cpp.in | 4 ---- core/version.h | 9 --------- 4 files changed, 4 insertions(+), 19 deletions(-) delete mode 100644 core/version.cpp.in delete mode 100644 core/version.h diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 28c6c9dd9..bca77a9a3 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -81,18 +81,16 @@ LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") INCLUDE(GetGitRevisionDescription) #GET_GIT_HEAD_REVISION(GIT_REFSPEC GIT_SHA1) -git_describe(VERSION --tags --dirty=-d) +git_describe(VERSION --tags --dirty) #parse the version information into pieces. string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}") string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION}") string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${VERSION}") string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" VERSION_SHA1 "${VERSION}") +# VERSION_SHORT used in the ross.pc file set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in - ${CMAKE_CURRENT_BINARY_DIR}/version.cpp) -set(version_file "${CMAKE_CURRENT_BINARY_DIR}/version.cpp") # Data Structure for remote Events # If AVL_TREE is OFF, ROSS reverts to hashing @@ -145,7 +143,7 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DROSS_OPTION_LIST='\"${OPTIONS}\"'") # Generate Library OPTION(ROSS_BUILD_SHARED_LIBS "Build shared libraries instead of static" OFF) SET(BUILD_SHARED_LIBS ${ROSS_BUILD_SHARED_LIBS}) -ADD_LIBRARY(ROSS ${ross_srcs} ${version_file}) +ADD_LIBRARY(ROSS ${ross_srcs}) SET_TARGET_PROPERTIES(ROSS PROPERTIES OUTPUT_NAME ROSS) TARGET_LINK_LIBRARIES(ROSS ${ROSS_EXTERNAL_LIBS}) TARGET_INCLUDE_DIRECTORIES(ROSS INTERFACE ${MPI_C_INCLUDE_PATH}) diff --git a/core/config.h.in b/core/config.h.in index 37f07e805..02d04e960 100644 --- a/core/config.h.in +++ b/core/config.h.in @@ -8,7 +8,7 @@ // ROSS Core #cmakedefine HAVE_CTIME 1 -#define ROSS_VERSION "${VERSION_SHORT}" +#define ROSS_VERSION "${VERSION}" #cmakedefine AVL_TREE 1 #cmakedefine USE_BGPM #cmakedefine RAND_NORMAL diff --git a/core/version.cpp.in b/core/version.cpp.in deleted file mode 100644 index f860c2586..000000000 --- a/core/version.cpp.in +++ /dev/null @@ -1,4 +0,0 @@ -#include "version.h" - -const std::string ROSS_VERSION = "@VERSION@"; -const std::string ROSS_VERSION_SHORT = "@VERSION_SHORT@"; diff --git a/core/version.h b/core/version.h deleted file mode 100644 index 1d6b455d3..000000000 --- a/core/version.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef VERSION_H -#define VERSION_H - - -//Global version strings -extern const std::string ROSS_VERSION; -extern const std::string ROSS_VERSION_SHORT; - -#endif //VERSION_H