Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SylvanSettings.cpp
Go to the documentation of this file.
2
4
10
11namespace storm {
12namespace settings {
13namespace modules {
14
15const std::string SylvanSettings::moduleName = "sylvan";
16const std::string SylvanSettings::maximalMemoryOptionName = "maxmem";
17const std::string SylvanSettings::threadCountOptionName = "threads";
18
20 this->addOption(storm::settings::OptionBuilder(moduleName, maximalMemoryOptionName, true, "Sets the upper bound of memory available to Sylvan in MB.")
21 .setIsAdvanced()
22 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("value", "The memory available to Sylvan.")
24 .build())
25 .build());
26 this->addOption(storm::settings::OptionBuilder(moduleName, threadCountOptionName, true, "Sets the number of threads used by Sylvan.")
27 .setIsAdvanced()
29 "value", "The number of threads available to Sylvan (0 means 'auto-detect').")
30 .build())
31 .build());
32}
33
35 return this->getOption(maximalMemoryOptionName).getArgumentByName("value").getValueAsUnsignedInteger();
36}
37
39 return this->getOption(threadCountOptionName).getArgumentByName("value").getHasBeenSet();
40}
41
44 auto numberFromSettings = this->getOption(threadCountOptionName).getArgumentByName("value").getValueAsUnsignedInteger();
45 if (numberFromSettings != 0u) {
46 return numberFromSettings;
47 }
48 }
49 // Automatic detection
50#ifdef APPLE_SILICON
51 // Prevents issues with multi-threaded execution on Apple Silicon
52 return 1u;
53#else
54 return std::max(1u, storm::utility::getNumberOfThreads());
55#endif
56}
57
60 auto const autoDetectThreads = std::max(1u, storm::utility::getNumberOfThreads());
62#ifdef APPLE_SILICON
64 "Sylvan does not properly work for multiple threads on Apple Silicon. We recommend limiting the number of threads to 1.");
65#endif
66 STORM_LOG_WARN_COND(numberFromSettings <= autoDetectThreads, "Setting the number of sylvan threads to "
67 << numberFromSettings << " which exceeds the recommended number for your system ("
68 << autoDetectThreads << ").");
69 }
70 return true;
71}
72
73} // namespace modules
74} // namespace settings
75} // namespace storm
virtual uint_fast64_t getValueAsUnsignedInteger() const =0
Retrieves the value of this argument as an unsigned integer.
virtual bool getHasBeenSet() const
Retrieves whether the argument has been set.
static ArgumentBuilder createUnsignedIntegerArgument(std::string const &name, std::string const &description)
Creates an unsigned integer argument with the given parameters.
This class provides the interface to create an option...
ArgumentBase const & getArgumentByName(std::string const &argumentName) const
Returns a reference to the argument with the specified long name.
Definition Option.cpp:79
This is the base class of the settings for a particular module.
void addOption(std::shared_ptr< Option > const &option)
Adds and registers the given option.
Option & getOption(std::string const &longName)
Retrieves the option with the given long name.
uint_fast64_t getMaximalMemory() const
Retrieves the maximal amount of memory (in megabytes) that Sylvan can occupy.
SylvanSettings()
Creates a new set of Sylvan settings.
uint_fast64_t getNumberOfThreads() const
Retrieves the amount of threads available to Sylvan.
bool check() const override
Checks whether the settings are consistent.
bool isNumberOfThreadsSet() const
Retrieves whether the number of threads to use was set.
#define STORM_LOG_WARN_COND(cond, message)
Definition macros.h:38
SettingsType const & getModule()
Get module.
uint getNumberOfThreads()
Definition threads.cpp:53
LabParser.cpp.
Definition cli.cpp:18