1 /* Copyright (c) 2015-2023. The SimGrid Team. All rights reserved. */
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. */
6 #include "src/mc/explo/Exploration.hpp"
7 #include "src/mc/mc_config.hpp"
8 #include "src/mc/mc_exit.hpp"
9 #include "src/simgrid/sg_config.hpp"
12 #include "smpi/smpi.h"
15 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(mc);
17 using namespace simgrid::mc;
19 int main(int argc, char** argv)
21 xbt_assert(argc >= 2, "Missing arguments");
23 // Currently, we need this before sg_config_init:
24 simgrid::mc::set_model_checking_mode(simgrid::mc::ModelCheckingMode::CHECKER_SIDE);
26 // The initialization function can touch argv.
27 // We make a copy of argv before modifying it in order to pass the original value to the model-checked application:
28 std::vector<char*> argv_copy{argv, argv + argc + 1};
30 xbt_log_init(&argc, argv);
32 smpi_init_options(); // that's OK to call it twice, and we need it ASAP
34 sg_config_init(&argc, argv);
36 std::unique_ptr<Exploration> explo;
38 if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
39 explo = std::unique_ptr<Exploration>(
40 create_communication_determinism_checker(argv_copy, get_model_checking_reduction()));
41 else if (_sg_mc_unfolding_checker)
42 explo = std::unique_ptr<Exploration>(create_udpor_checker(argv_copy));
44 explo = std::unique_ptr<Exploration>(create_dfs_exploration(argv_copy, get_model_checking_reduction()));
49 status = ExitStatus::SUCCESS;
50 } catch (const McError& e) {
53 return static_cast<int>(status);