Browse Source

Added timeout flag so no external tool is needed for aborting a computation.

Former-commit-id: ad5a5527cd
tempestpy_adaptions
dehnert 11 years ago
parent
commit
6b9fd8b331
  1. 8
      src/storm.cpp
  2. 3
      src/utility/ErrorHandling.h
  3. 2
      src/utility/StormOptions.cpp

8
src/storm.cpp

@ -404,9 +404,15 @@ int main(const int argc, const char* argv[]) {
return 0;
}
// If requested by the user, we install a timeout signal to abort computation.
storm::settings::Settings* s = storm::settings::Settings::getInstance();
uint_fast64_t timeout = s->getOptionByLongName("timeout").getArgument(0).getValueAsUnsignedInteger();
if (timeout != 0) {
alarm(timeout);
}
// Now, the settings are received and the specified model is parsed. The actual actions taken depend on whether
// the model was provided in explicit or symbolic format.
storm::settings::Settings* s = storm::settings::Settings::getInstance();
if (s->isSet("explicit")) {
std::string const chosenTransitionSystemFile = s->getOptionByLongName("explicit").getArgument(0).getValueAsString();
std::string const chosenLabelingFile = s->getOptionByLongName("explicit").getArgument(1).getValueAsString();

3
src/utility/ErrorHandling.h

@ -139,6 +139,9 @@ void installSignalHandler() {
if (sigaction(SIGTERM, &sa, nullptr) == -1) {
std::cerr << "FATAL: Installing a signal handler failed." << std::endl;
}
if (sigaction(SIGALRM, &sa, nullptr) == -1) {
std::cerr << "FATAL: Installing a signal handler failed." << std::endl;
}
#else
signal(SIGSEGV, signalHandler);
signal(SIGABRT, signalHandler);

2
src/utility/StormOptions.cpp

@ -34,6 +34,8 @@ bool storm::utility::StormOptions::optionsRegistered = storm::settings::Settings
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "fixDeadlocks", "", "If the model contains deadlock states, setting this option will insert self-loops for these states.").build());
settings->addOption(storm::settings::OptionBuilder("StoRM Main", "timeout", "t", "If specified, computation will abort after the given number of seconds.").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("seconds", "The number of seconds after which to timeout.").setDefaultValueUnsignedInteger(0).build()).build());
std::vector<std::string> linearEquationSolver;
linearEquationSolver.push_back("gmm++");
linearEquationSolver.push_back("native");

Loading…
Cancel
Save