From: Marion Guthmuller Date: Tue, 13 Nov 2012 14:12:35 +0000 (+0100) Subject: model-checker : new cfg command line flag (model-check/max_depth) for max depth of... X-Git-Tag: v3_9_rc1~91^2~111 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a8909d621db9ae5690144cbe00fc0589c8ac26c8 model-checker : new cfg command line flag (model-check/max_depth) for max depth of exploration (default value is 1000) --- diff --git a/src/include/mc/mc.h b/src/include/mc/mc.h index ec2c548791..defe37f7f7 100644 --- a/src/include/mc/mc.h +++ b/src/include/mc/mc.h @@ -30,6 +30,7 @@ void _mc_cfg_cb_reduce(const char *name, int pos); void _mc_cfg_cb_checkpoint(const char *name, int pos); void _mc_cfg_cb_property(const char *name, int pos); void _mc_cfg_cb_timeout(const char *name, int pos); +void _mc_cfg_cb_max_depth(const char *name, int pos); XBT_PUBLIC(void) MC_do_the_modelcheck_for_real(void); diff --git a/src/mc/mc_dpor.c b/src/mc/mc_dpor.c index 3c56d0d478..ccc3db80a2 100644 --- a/src/mc/mc_dpor.c +++ b/src/mc/mc_dpor.c @@ -88,7 +88,7 @@ void MC_dpor(void) /* If there are processes to interleave and the maximum depth has not been reached then perform one step of the exploration algorithm */ - if (xbt_fifo_size(mc_stack_safety) < MAX_DEPTH && + if (xbt_fifo_size(mc_stack_safety) < _surf_mc_max_depth && (req = MC_state_get_request(state, &value))) { /* Debug information */ diff --git a/src/mc/mc_global.c b/src/mc/mc_global.c index 8b8306f162..c351065cf2 100644 --- a/src/mc/mc_global.c +++ b/src/mc/mc_global.c @@ -63,6 +63,14 @@ void _mc_cfg_cb_timeout(const char *name, int pos) { xbt_cfg_set_int(_surf_cfg_set,"model-check",1); } +void _mc_cfg_cb_max_depth(const char *name, int pos) { + if (_surf_init_status && !_surf_do_model_check) { + xbt_die("You are specifying a max depth value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _surf_mc_max_depth= xbt_cfg_get_int(_surf_cfg_set, name); + xbt_cfg_set_int(_surf_cfg_set,"model-check",1); +} + /* MC global data structures */ diff --git a/src/mc/mc_liveness.c b/src/mc/mc_liveness.c index 381e3c996c..e534750edb 100644 --- a/src/mc/mc_liveness.c +++ b/src/mc/mc_liveness.c @@ -509,7 +509,7 @@ void MC_ddfs(int search_cycle){ mc_pair_stateless_t remove_pair; mc_pair_reached_t remove_pair_reached; - if(xbt_fifo_size(mc_stack_liveness) < MAX_DEPTH_LIVENESS){ + if(xbt_fifo_size(mc_stack_liveness) < _surf_mc_max_depth){ if(current_pair->requests > 0){ @@ -787,7 +787,7 @@ void MC_ddfs(int search_cycle){ } - if(xbt_fifo_size(mc_stack_liveness) == MAX_DEPTH_LIVENESS ){ + if(xbt_fifo_size(mc_stack_liveness) == _surf_mc_max_depth ){ XBT_DEBUG("Pair (depth = %d) shifted in stack, maximum depth reached", xbt_fifo_size(mc_stack_liveness) ); }else{ XBT_DEBUG("Pair (depth = %d) shifted in stack", xbt_fifo_size(mc_stack_liveness) ); diff --git a/src/mc/mc_private.h b/src/mc/mc_private.h index f93f35f7a2..d0e2162efd 100644 --- a/src/mc/mc_private.h +++ b/src/mc/mc_private.h @@ -55,10 +55,6 @@ void snapshot_stack_free_voidp(void *s); /********************************* MC Global **********************************/ extern double *mc_time; -/* Bound of the MC depth-first search algorithm */ -#define MAX_DEPTH 1000 -#define MAX_DEPTH_LIVENESS 500 - int MC_deadlock_check(void); void MC_replay(xbt_fifo_t stack, int start); void MC_replay_liveness(xbt_fifo_t stack, int all_stack); @@ -291,6 +287,7 @@ extern xbt_fifo_t mc_stack_safety; extern int _surf_mc_checkpoint; extern char* _surf_mc_property_file; extern int _surf_mc_timeout; +extern int _surf_mc_max_depth; /****** Core dump ******/ diff --git a/src/surf/surf_config.c b/src/surf/surf_config.c index 196377d952..cda623d550 100644 --- a/src/surf/surf_config.c +++ b/src/surf/surf_config.c @@ -524,6 +524,13 @@ void surf_config_init(int *argc, char **argv) "Enable/Disable timeout for wait requests", xbt_cfgelm_int, &default_value, 0, 1, _mc_cfg_cb_timeout, NULL); + + /* Set max depth exploration */ + default_value_int = 1000; + xbt_cfg_register(&_surf_cfg_set, "model-check/max_depth", + "Specify the max depth of exploration", + xbt_cfgelm_int, &default_value, 0, 1, + _mc_cfg_cb_max_depth, NULL); #endif /* do verbose-exit */ diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index a5b66056de..2ca9580227 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -33,6 +33,7 @@ int _surf_do_model_check = 0; int _surf_mc_checkpoint=0; char* _surf_mc_property_file=NULL; int _surf_mc_timeout=0; +int _surf_mc_max_depth=1000; /* Declare xbt_preinit and xbt_postexit as constructor/destructor of the library. * This is crude and rather compiler-specific, unfortunately.