Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : new cfg command line flag (model-check/max_depth) for max depth of...
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Tue, 13 Nov 2012 14:12:35 +0000 (15:12 +0100)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Tue, 13 Nov 2012 14:13:19 +0000 (15:13 +0100)
src/include/mc/mc.h
src/mc/mc_dpor.c
src/mc/mc_global.c
src/mc/mc_liveness.c
src/mc/mc_private.h
src/surf/surf_config.c
src/xbt/xbt_main.c

index ec2c548..defe37f 100644 (file)
@@ -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_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);
 
 
 XBT_PUBLIC(void) MC_do_the_modelcheck_for_real(void);
 
index 3c56d0d..ccc3db8 100644 (file)
@@ -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 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 */
         (req = MC_state_get_request(state, &value))) {
 
       /* Debug information */
index 8b8306f..c351065 100644 (file)
@@ -63,6 +63,14 @@ void _mc_cfg_cb_timeout(const char *name, int pos) {
   xbt_cfg_set_int(_surf_cfg_set,"model-check",1);
 }
 
   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 */
 
 
 /* MC global data structures */
 
index 381e3c9..e534750 100644 (file)
@@ -509,7 +509,7 @@ void MC_ddfs(int search_cycle){
   mc_pair_stateless_t remove_pair;
   mc_pair_reached_t remove_pair_reached;
   
   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){
 
 
     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) );
     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) );
index f93f35f..d0e2162 100644 (file)
@@ -55,10 +55,6 @@ void snapshot_stack_free_voidp(void *s);
 /********************************* MC Global **********************************/
 extern double *mc_time;
 
 /********************************* 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);
 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_checkpoint;
 extern char* _surf_mc_property_file;
 extern int _surf_mc_timeout;
+extern int _surf_mc_max_depth;
 
 /****** Core dump ******/
 
 
 /****** Core dump ******/
 
index 196377d..cda623d 100644 (file)
@@ -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);
                      "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 */
 #endif
 
     /* do verbose-exit */
index a5b6605..2ca9580 100644 (file)
@@ -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_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.
 
 /* Declare xbt_preinit and xbt_postexit as constructor/destructor of the library.
  * This is crude and rather compiler-specific, unfortunately.