Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc: kill model-check/ksm option. Was not activated because not very useful
[simgrid.git] / src / mc / mc_config.cpp
1 /* Copyright (c) 2008-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "xbt/config.hpp"
7 #include "xbt/log.h"
8 #include <xbt/sysdep.h>
9
10 #include "src/mc/mc_replay.hpp"
11 #include <mc/mc.h>
12
13 #include <simgrid/sg_config.hpp>
14
15 #if SIMGRID_HAVE_MC
16 #include "src/mc/mc_private.hpp"
17 #include "src/mc/mc_safety.hpp"
18 #endif
19
20 #include "src/mc/mc_record.hpp"
21
22 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_config, mc, "Configuration of the Model Checker");
23
24 #if SIMGRID_HAVE_MC
25 namespace simgrid {
26 namespace mc {
27 /* Configuration support */
28 simgrid::mc::ReductionMode reduction_mode = simgrid::mc::ReductionMode::unset;
29 }
30 }
31 #endif
32
33 #if !SIMGRID_HAVE_MC
34 #define _sg_do_model_check 0
35 #endif
36
37 static void _mc_cfg_cb_check(const char* spec, bool more_check = true)
38 {
39   if (_sg_cfg_init_status && not _sg_do_model_check && more_check)
40     xbt_die("You are specifying a %s after the initialization (through MSG_config?), but the program was not run under "
41             "the model-checker (with simgrid-mc)). This won't work, sorry.",
42             spec);
43 }
44
45 /* Replay (this part is enabled even if MC it disabled) */
46 simgrid::config::Flag<std::string> _sg_mc_record_path{
47     "model-check/replay", "Model-check path to replay (as reported by SimGrid when a violation is reported)", ""};
48
49 simgrid::config::Flag<bool> _sg_mc_timeout{
50     "model-check/timeout", "Whether to enable timeouts for wait requests", false,
51     [](bool) { _mc_cfg_cb_check("value to enable/disable timeout for wait requests", MC_record_path.empty()); }};
52
53 #if SIMGRID_HAVE_MC
54 int _sg_do_model_check = 0;
55 int _sg_mc_max_visited_states = 0;
56
57 simgrid::config::Flag<int> _sg_mc_checkpoint{
58     "model-check/checkpoint", "Specify the amount of steps between checkpoints during stateful model-checking "
59                               "(default: 0 => stateless verification). If value=1, one checkpoint is saved for each "
60                               "step => faster verification, but huge memory consumption; higher values are good "
61                               "compromises between speed and memory consumption.",
62     0, [](int) { _mc_cfg_cb_check("checkpointing value"); }};
63
64 simgrid::config::Flag<bool> _sg_mc_sparse_checkpoint{"model-check/sparse-checkpoint", "Use sparse per-page snapshots.",
65                                                      false, [](bool) { _mc_cfg_cb_check("checkpointing value"); }};
66
67 simgrid::config::Flag<std::string> _sg_mc_property_file{
68     "model-check/property", "Name of the file containing the property, as formatted by the ltl2ba program.", "",
69     [](const std::string&) { _mc_cfg_cb_check("property"); }};
70
71 simgrid::config::Flag<bool> _sg_mc_comms_determinism{
72     "model-check/communications-determinism",
73     {"model-check/communications_determinism"},
74     "Whether to enable the detection of communication determinism",
75     false,
76     [](bool) {
77       _mc_cfg_cb_check("value to enable/disable the detection of determinism in the communications schemes");
78     }};
79
80 simgrid::config::Flag<bool> _sg_mc_send_determinism{
81     "model-check/send-determinism",
82     {"model-check/send_determinism"},
83     "Enable/disable the detection of send-determinism in the communications schemes",
84     false,
85     [](bool) {
86       _mc_cfg_cb_check("value to enable/disable the detection of send-determinism in the communications schemes");
87     }};
88
89 static simgrid::config::Flag<std::string> _sg_mc_reduce{
90     "model-check/reduction", "Specify the kind of exploration reduction (either none or DPOR)", "dpor",
91     [](const std::string& value) {
92       _mc_cfg_cb_check("reduction strategy");
93
94       if (value == "none")
95         simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::none;
96       else if (value == "dpor")
97         simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::dpor;
98       else
99         xbt_die("configuration option model-check/reduction can only take 'none' or 'dpor' as a value");
100     }};
101
102 simgrid::config::Flag<bool> _sg_mc_hash{
103     "model-check/hash", "Whether to enable state hash for state comparison (experimental)", false,
104     [](bool) { _mc_cfg_cb_check("value to enable/disable the use of global hash to speedup state comparaison"); }};
105
106 simgrid::config::Flag<int> _sg_mc_max_depth{"model-check/max-depth",
107                                             {"model-check/max_depth"},
108                                             "Maximal exploration depth (default: 1000)",
109                                             1000,
110                                             [](int) { _mc_cfg_cb_check("max depth value"); }};
111
112 static simgrid::config::Flag<int> _sg_mc_max_visited_states__{
113     "model-check/visited", "Specify the number of visited state stored for state comparison reduction. If value=5, the "
114                            "last 5 visited states are stored. If value=0 (the default), all states are stored.",
115     0, [](int value) {
116       _mc_cfg_cb_check("number of stored visited states");
117       _sg_mc_max_visited_states = value;
118     }};
119
120 simgrid::config::Flag<std::string> _sg_mc_dot_output_file{
121     "model-check/dot-output",
122     {"model-check/dot_output"},
123     "Name of dot output file corresponding to graph state",
124     "",
125     [](const std::string&) { _mc_cfg_cb_check("file name for a dot output of graph state"); }};
126
127 simgrid::config::Flag<bool> _sg_mc_termination{
128     "model-check/termination", "Whether to enable non progressive cycle detection", false,
129     [](bool) { _mc_cfg_cb_check("value to enable/disable the detection of non progressive cycles"); }};
130
131 #endif