From 26c83295361ea3da5cd2c45b867069ad1a1d7349 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 10 Apr 2016 12:08:38 +0200 Subject: [PATCH 1/1] kill an unused layer of code --- src/include/simgrid/sg_config.h | 5 ----- src/instr/instr_config.cpp | 4 ++-- src/mc/Session.cpp | 4 ++-- src/msg/msg_global.cpp | 2 +- src/simgrid/sg_config.cpp | 34 ++------------------------------- src/simix/smx_global.cpp | 2 +- src/smpi/smpi_base.cpp | 14 +++++++------- src/smpi/smpi_bench.cpp | 6 +++--- src/smpi/smpi_coll.cpp | 2 +- src/smpi/smpi_global.cpp | 34 ++++++++++++++++----------------- src/surf/network_ib.cpp | 2 +- src/surf/network_smpi.cpp | 6 ++---- src/xbt/ex.c | 2 +- 13 files changed, 40 insertions(+), 77 deletions(-) diff --git a/src/include/simgrid/sg_config.h b/src/include/simgrid/sg_config.h index 70007cce78..96a46eca49 100644 --- a/src/include/simgrid/sg_config.h +++ b/src/include/simgrid/sg_config.h @@ -12,11 +12,6 @@ SG_BEGIN_DECL() XBT_PUBLIC_DATA(xbt_cfg_t) simgrid_config; XBT_PUBLIC_DATA(int) _sg_cfg_init_status; XBT_PUBLIC_DATA(int) _sg_cfg_exit_asap; -XBT_PUBLIC(int) sg_cfg_is_default_value(const char* name); -XBT_PUBLIC(int) sg_cfg_get_int(const char* name); -XBT_PUBLIC(double) sg_cfg_get_double(const char* name); -XBT_PUBLIC(char*) sg_cfg_get_string(const char* name); -XBT_PUBLIC(int) sg_cfg_get_boolean(const char* name); XBT_PUBLIC(void) sg_config_init(int *argc, char **argv); XBT_PUBLIC(void) sg_config_finalize(void); diff --git a/src/instr/instr_config.cpp b/src/instr/instr_config.cpp index 8555cfa981..3d844afa36 100644 --- a/src/instr/instr_config.cpp +++ b/src/instr/instr_config.cpp @@ -111,7 +111,7 @@ int TRACE_start() TRACE_init(); /* open the trace file(s) */ - const char* format = sg_cfg_get_string(OPT_TRACING_FORMAT); + const char* format = xbt_cfg_get_string(OPT_TRACING_FORMAT); XBT_DEBUG("Tracing format %s\n", format); if(!strcmp(format, "Paje")){ TRACE_paje_init(); @@ -193,7 +193,7 @@ int TRACE_end() xbt_dict_free(&created_categories); /* close the trace files */ - const char* format = sg_cfg_get_string(OPT_TRACING_FORMAT); + const char* format = xbt_cfg_get_string(OPT_TRACING_FORMAT); XBT_DEBUG("Tracing format %s\n", format); if(!strcmp(format, "Paje")){ TRACE_paje_end(); diff --git a/src/mc/Session.cpp b/src/mc/Session.cpp index 223bfc0ff6..63c0c7483b 100644 --- a/src/mc/Session.cpp +++ b/src/mc/Session.cpp @@ -81,7 +81,7 @@ Session::Session(pid_t pid, int socket) std::unique_ptr process(new simgrid::mc::Process(pid, socket)); // TODO, automatic detection of the config from the process process->privatized( - sg_cfg_get_boolean("smpi/privatize_global_variables")); + xbt_cfg_get_boolean("smpi/privatize_global_variables")); modelChecker_ = std::unique_ptr( new simgrid::mc::ModelChecker(std::move(process))); xbt_assert(mc_model_checker == nullptr); @@ -147,4 +147,4 @@ void Session::close() simgrid::mc::Session* session; } -} \ No newline at end of file +} diff --git a/src/msg/msg_global.cpp b/src/msg/msg_global.cpp index 9723905b86..19abf3dc2f 100644 --- a/src/msg/msg_global.cpp +++ b/src/msg/msg_global.cpp @@ -75,7 +75,7 @@ void MSG_init_nocheck(int *argc, char **argv) { XBT_DEBUG("ADD MSG LEVELS"); MSG_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, (void_f_pvoid_t) __MSG_storage_destroy); MSG_FILE_LEVEL = xbt_lib_add_level(file_lib, (void_f_pvoid_t) __MSG_file_destroy); - if(sg_cfg_get_boolean("clean_atexit")) atexit(MSG_exit); + if(xbt_cfg_get_boolean("clean_atexit")) atexit(MSG_exit); } /** \ingroup msg_simulation diff --git a/src/simgrid/sg_config.cpp b/src/simgrid/sg_config.cpp index 4b2253d2f5..3b7519c6e8 100644 --- a/src/simgrid/sg_config.cpp +++ b/src/simgrid/sg_config.cpp @@ -430,9 +430,7 @@ static void describe_model(char *result, model_description[0].name ? model_description[0].name : "n/a"); for (int i = 1; model_description[i].name; i++) p += sprintf(p, ", %s", model_description[i].name); - sprintf(p, - ".\n (use 'help' as a value to see the long description of each %s)", - name); + sprintf(p, ".\n (use 'help' as a value to see the long description of each %s)", name); } /* create the config set, register what should be and parse the command line*/ @@ -539,9 +537,7 @@ void sg_config_init(int *argc, char **argv) const char *dflt_ctx_fact = "thread"; { char *p = description + - sprintf(description, - "Context factory to use in SIMIX. Possible values: %s", - dflt_ctx_fact); + sprintf(description, "Context factory to use in SIMIX. Possible values: %s", dflt_ctx_fact); #if HAVE_UCONTEXT_CONTEXTS dflt_ctx_fact = "ucontext"; p += sprintf(p, ", %s", dflt_ctx_fact); @@ -671,29 +667,3 @@ void sg_config_finalize(void) xbt_cfg_free(&simgrid_config); _sg_cfg_init_status = 0; } - -int sg_cfg_is_default_value(const char *name) -{ - return xbt_cfg_is_default_value(name); -} - -int sg_cfg_get_int(const char* name) -{ - return xbt_cfg_get_int(name); -} - -double sg_cfg_get_double(const char* name) -{ - return xbt_cfg_get_double(name); -} - -char* sg_cfg_get_string(const char* name) -{ - return xbt_cfg_get_string(name); -} - -int sg_cfg_get_boolean(const char* name) -{ - return xbt_cfg_get_boolean(name); -} - diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index d84905a738..d039e8cd1e 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -260,7 +260,7 @@ void SIMIX_global_init(int *argc, char **argv) simix_timers = xbt_heap_new(8, &free); } - if (sg_cfg_get_boolean("clean_atexit")) + if (xbt_cfg_get_boolean("clean_atexit")) atexit(SIMIX_clean); #if HAVE_MC diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index d9ae5eefa1..a41febc007 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -126,7 +126,7 @@ static xbt_dynar_t parse_factor(const char *smpi_coef_string) static double smpi_os(double size) { if (!smpi_os_values) { - smpi_os_values = parse_factor(sg_cfg_get_string("smpi/os")); + smpi_os_values = parse_factor(xbt_cfg_get_string("smpi/os")); smpi_register_static(smpi_os_values, xbt_dynar_free_voidp); } unsigned int iter = 0; @@ -155,7 +155,7 @@ static double smpi_os(double size) static double smpi_ois(double size) { if (!smpi_ois_values) { - smpi_ois_values = parse_factor(sg_cfg_get_string("smpi/ois")); + smpi_ois_values = parse_factor(xbt_cfg_get_string("smpi/ois")); smpi_register_static(smpi_ois_values, xbt_dynar_free_voidp); } unsigned int iter = 0; @@ -182,7 +182,7 @@ static double smpi_ois(double size) static double smpi_or(double size) { if (!smpi_or_values) { - smpi_or_values = parse_factor(sg_cfg_get_string("smpi/or")); + smpi_or_values = parse_factor(xbt_cfg_get_string("smpi/or")); smpi_register_static(smpi_or_values, xbt_dynar_free_voidp); } unsigned int iter = 0; @@ -334,7 +334,7 @@ void smpi_mpi_start(MPI_Request request) if (request->flags & RECV) { print_request("New recv", request); - int async_small_thresh = sg_cfg_get_int("smpi/async_small_thresh"); + int async_small_thresh = xbt_cfg_get_int("smpi/async_small_thresh"); xbt_mutex_t mut = smpi_process_mailboxes_mutex(); if (async_small_thresh != 0 ||request->flags & RMA) @@ -412,7 +412,7 @@ void smpi_mpi_start(MPI_Request request) XBT_DEBUG("sending size of %zu : sleep %f ", request->size, smpi_os(request->size)); } - int async_small_thresh = sg_cfg_get_int("smpi/async_small_thresh"); + int async_small_thresh = xbt_cfg_get_int("smpi/async_small_thresh"); xbt_mutex_t mut=smpi_process_remote_mailboxes_mutex(receiver); @@ -449,7 +449,7 @@ void smpi_mpi_start(MPI_Request request) void* buf = request->buf; if ( (! (request->flags & SSEND)) && - (static_cast(request->size) < sg_cfg_get_int("smpi/send_is_detached_thresh"))) { + (static_cast(request->size) < xbt_cfg_get_int("smpi/send_is_detached_thresh"))) { void *oldbuf = NULL; request->detached = 1; XBT_DEBUG("Send request %p is detached", request); @@ -836,7 +836,7 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* print_request("New iprobe", request); // We have to test both mailboxes as we don't know if we will receive one one or another - if (sg_cfg_get_int("smpi/async_small_thresh")>0){ + if (xbt_cfg_get_int("smpi/async_small_thresh")>0){ mailbox = smpi_process_mailbox_small(); XBT_DEBUG("trying to probe the perm recv mailbox"); request->action = simcall_comm_iprobe(mailbox, 0, request->src, request->tag, &match_recv, (void*)request); diff --git a/src/smpi/smpi_bench.cpp b/src/smpi/smpi_bench.cpp index 00ded922f0..21abd6161e 100644 --- a/src/smpi/smpi_bench.cpp +++ b/src/smpi/smpi_bench.cpp @@ -261,7 +261,7 @@ void smpi_bench_end(void) xbt_die("Aborting."); } // Simulate the benchmarked computation unless disabled via command-line argument - if (sg_cfg_get_boolean("smpi/simulate_computation")) { + if (xbt_cfg_get_boolean("smpi/simulate_computation")) { smpi_execute(xbt_os_timer_elapsed(timer)); } @@ -481,7 +481,7 @@ void smpi_sample_3(int global, const char *file, int line) void *smpi_shared_malloc(size_t size, const char *file, int line) { void* mem; - if (sg_cfg_get_boolean("smpi/use_shared_malloc")){ + if (xbt_cfg_get_boolean("smpi/use_shared_malloc")){ int fd; smpi_source_location loc(file, line); auto res = allocs.insert(std::make_pair(loc, shared_data_t())); @@ -524,7 +524,7 @@ void smpi_shared_free(void *ptr) { char loc[PTR_STRLEN]; - if (sg_cfg_get_boolean("smpi/use_shared_malloc")){ + if (xbt_cfg_get_boolean("smpi/use_shared_malloc")){ snprintf(loc, PTR_STRLEN, "%p", ptr); auto meta = allocs_metadata.find(ptr); if (meta == allocs_metadata.end()) { diff --git a/src/smpi/smpi_coll.cpp b/src/smpi/smpi_coll.cpp index fc01931f1c..4a8806fb72 100644 --- a/src/smpi/smpi_coll.cpp +++ b/src/smpi/smpi_coll.cpp @@ -125,7 +125,7 @@ int find_coll_description(s_mpi_coll_description_t * table, char *name_list = NULL; int selector_on=0; if(name==NULL){//no argument provided, use active selector's algorithm - name=(char*)sg_cfg_get_string("smpi/coll_selector"); + name=(char*)xbt_cfg_get_string("smpi/coll_selector"); selector_on=1; } for (int i = 0; table[i].name; i++) diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index caacb69f22..cf08616b00 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -376,9 +376,9 @@ void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t static void smpi_check_options(){ //check correctness of MPI parameters - xbt_assert(sg_cfg_get_int("smpi/async_small_thresh") <= sg_cfg_get_int("smpi/send_is_detached_thresh")); + xbt_assert(xbt_cfg_get_int("smpi/async_small_thresh") <= xbt_cfg_get_int("smpi/send_is_detached_thresh")); - if (sg_cfg_is_default_value("smpi/running_power")) { + if (xbt_cfg_is_default_value("smpi/running_power")) { XBT_INFO("You did not set the power of the host running the simulation. " "The timings will certainly not be accurate. " "Use the option \"--cfg=smpi/running_power:\" to set its value." @@ -524,60 +524,60 @@ static void smpi_init_logs(){ } static void smpi_init_options(){ - int gather_id = find_coll_description(mpi_coll_gather_description, sg_cfg_get_string("smpi/gather"),"gather"); + int gather_id = find_coll_description(mpi_coll_gather_description, xbt_cfg_get_string("smpi/gather"),"gather"); mpi_coll_gather_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm)) mpi_coll_gather_description[gather_id].coll; int allgather_id = find_coll_description(mpi_coll_allgather_description, - sg_cfg_get_string("smpi/allgather"),"allgather"); + xbt_cfg_get_string("smpi/allgather"),"allgather"); mpi_coll_allgather_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm)) mpi_coll_allgather_description[allgather_id].coll; int allgatherv_id = find_coll_description(mpi_coll_allgatherv_description, - sg_cfg_get_string("smpi/allgatherv"),"allgatherv"); + xbt_cfg_get_string("smpi/allgatherv"),"allgatherv"); mpi_coll_allgatherv_fun = (int (*)(void *, int, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm)) mpi_coll_allgatherv_description[allgatherv_id].coll; int allreduce_id = find_coll_description(mpi_coll_allreduce_description, - sg_cfg_get_string("smpi/allreduce"),"allreduce"); + xbt_cfg_get_string("smpi/allreduce"),"allreduce"); mpi_coll_allreduce_fun = (int (*)(void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)) mpi_coll_allreduce_description[allreduce_id].coll; int alltoall_id = find_coll_description(mpi_coll_alltoall_description, - sg_cfg_get_string("smpi/alltoall"),"alltoall"); + xbt_cfg_get_string("smpi/alltoall"),"alltoall"); mpi_coll_alltoall_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm)) mpi_coll_alltoall_description[alltoall_id].coll; int alltoallv_id = find_coll_description(mpi_coll_alltoallv_description, - sg_cfg_get_string("smpi/alltoallv"),"alltoallv"); + xbt_cfg_get_string("smpi/alltoallv"),"alltoallv"); mpi_coll_alltoallv_fun = (int (*)(void *, int *, int *, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm)) mpi_coll_alltoallv_description[alltoallv_id].coll; - int bcast_id = find_coll_description(mpi_coll_bcast_description, sg_cfg_get_string("smpi/bcast"),"bcast"); + int bcast_id = find_coll_description(mpi_coll_bcast_description, xbt_cfg_get_string("smpi/bcast"),"bcast"); mpi_coll_bcast_fun = (int (*)(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm com)) mpi_coll_bcast_description[bcast_id].coll; - int reduce_id = find_coll_description(mpi_coll_reduce_description, sg_cfg_get_string("smpi/reduce"),"reduce"); + int reduce_id = find_coll_description(mpi_coll_reduce_description, xbt_cfg_get_string("smpi/reduce"),"reduce"); mpi_coll_reduce_fun = (int (*)(void *buf, void *rbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)) mpi_coll_reduce_description[reduce_id].coll; int reduce_scatter_id = find_coll_description(mpi_coll_reduce_scatter_description, - sg_cfg_get_string("smpi/reduce_scatter"),"reduce_scatter"); + xbt_cfg_get_string("smpi/reduce_scatter"),"reduce_scatter"); mpi_coll_reduce_scatter_fun = (int (*)(void *sbuf, void *rbuf, int *rcounts,MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)) mpi_coll_reduce_scatter_description[reduce_scatter_id].coll; - int scatter_id = find_coll_description(mpi_coll_scatter_description, sg_cfg_get_string("smpi/scatter"),"scatter"); + int scatter_id = find_coll_description(mpi_coll_scatter_description, xbt_cfg_get_string("smpi/scatter"),"scatter"); mpi_coll_scatter_fun = (int (*)(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)) mpi_coll_scatter_description[scatter_id].coll; - int barrier_id = find_coll_description(mpi_coll_barrier_description, sg_cfg_get_string("smpi/barrier"),"barrier"); + int barrier_id = find_coll_description(mpi_coll_barrier_description, xbt_cfg_get_string("smpi/barrier"),"barrier"); mpi_coll_barrier_fun = (int (*)(MPI_Comm comm)) mpi_coll_barrier_description[barrier_id].coll; - smpi_cpu_threshold = sg_cfg_get_double("smpi/cpu_threshold"); - smpi_running_power = sg_cfg_get_double("smpi/running_power"); - smpi_privatize_global_variables = sg_cfg_get_boolean("smpi/privatize_global_variables"); + smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu_threshold"); + smpi_running_power = xbt_cfg_get_double("smpi/running_power"); + smpi_privatize_global_variables = xbt_cfg_get_boolean("smpi/privatize_global_variables"); if (smpi_cpu_threshold < 0) smpi_cpu_threshold = DBL_MAX; } @@ -628,7 +628,7 @@ int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[]) SIMIX_run(); xbt_os_walltimer_stop(global_timer); - if (sg_cfg_get_boolean("smpi/display_timing")){ + if (xbt_cfg_get_boolean("smpi/display_timing")){ double global_time = xbt_os_timer_elapsed(global_timer); XBT_INFO("Simulated time: %g seconds. \n\n" "The simulation took %g seconds (after parsing and platform setup)\n" diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index b39302cb2d..ebc4483ba9 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -104,7 +104,7 @@ namespace simgrid { haveGap_=false; active_nodes=NULL; - const char* IB_factors_string=sg_cfg_get_string("smpi/IB_penalty_factors"); + const char* IB_factors_string=xbt_cfg_get_string("smpi/IB_penalty_factors"); xbt_dynar_t radical_elements = xbt_str_split(IB_factors_string, ";"); surf_parse_assert(xbt_dynar_length(radical_elements)==3, diff --git a/src/surf/network_smpi.cpp b/src/surf/network_smpi.cpp index 7899183641..ed9ece9f7d 100644 --- a/src/surf/network_smpi.cpp +++ b/src/surf/network_smpi.cpp @@ -172,8 +172,7 @@ namespace simgrid { double NetworkSmpiModel::bandwidthFactor(double size) { if (!smpi_bw_factor) - smpi_bw_factor = - parse_factor(sg_cfg_get_string("smpi/bw_factor")); + smpi_bw_factor = parse_factor(xbt_cfg_get_string("smpi/bw_factor")); unsigned int iter = 0; s_smpi_factor_t fact; @@ -193,8 +192,7 @@ namespace simgrid { double NetworkSmpiModel::latencyFactor(double size) { if (!smpi_lat_factor) - smpi_lat_factor = - parse_factor(sg_cfg_get_string("smpi/lat_factor")); + smpi_lat_factor = parse_factor(xbt_cfg_get_string("smpi/lat_factor")); unsigned int iter = 0; s_smpi_factor_t fact; diff --git a/src/xbt/ex.c b/src/xbt/ex.c index 37f1768373..a0127e54c2 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -154,7 +154,7 @@ void xbt_ex_display(xbt_ex_t * e) int i; int cutpath = 0; TRY { // We don't want to have an exception while checking how to deal with the one we already have, do we? - cutpath = sg_cfg_get_boolean("exception/cutpath"); + cutpath = xbt_cfg_get_boolean("exception/cutpath"); } CATCH_ANONYMOUS { } fprintf(stderr, "\n"); -- 2.20.1