From 208938b0a133c6aa7a73fbbcfb3be17ae08a4340 Mon Sep 17 00:00:00 2001 From: dehnert Date: Wed, 21 Dec 2016 15:51:42 +0100 Subject: [PATCH] changed sylvan behaviour to take auto-detected number of threads if no thread count was set --- src/storm/settings/modules/SylvanSettings.cpp | 6 +++++- src/storm/settings/modules/SylvanSettings.h | 5 +++++ src/storm/storage/dd/sylvan/InternalSylvanDdManager.cpp | 8 ++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/storm/settings/modules/SylvanSettings.cpp b/src/storm/settings/modules/SylvanSettings.cpp index 693682366..86319203c 100644 --- a/src/storm/settings/modules/SylvanSettings.cpp +++ b/src/storm/settings/modules/SylvanSettings.cpp @@ -17,12 +17,16 @@ namespace storm { SylvanSettings::SylvanSettings() : ModuleSettings(moduleName) { this->addOption(storm::settings::OptionBuilder(moduleName, maximalMemoryOptionName, true, "Sets the upper bound of memory available to Sylvan in MB.").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("value", "The memory available to Sylvan.").setDefaultValueUnsignedInteger(4096).build()).build()); - this->addOption(storm::settings::OptionBuilder(moduleName, threadCountOptionName, true, "Sets the number of threads used by Sylvan.").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("value", "The number of threads available to Sylvan (0 means 'auto-detect').").setDefaultValueUnsignedInteger(1).build()).build()); + this->addOption(storm::settings::OptionBuilder(moduleName, threadCountOptionName, true, "Sets the number of threads used by Sylvan.").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("value", "The number of threads available to Sylvan (0 means 'auto-detect').").build()).build()); } uint_fast64_t SylvanSettings::getMaximalMemory() const { return this->getOption(maximalMemoryOptionName).getArgumentByName("value").getValueAsUnsignedInteger(); } + + bool SylvanSettings::isNumberOfThreadsSet() const { + return this->getOption(threadCountOptionName).getArgumentByName("value").getHasBeenSet(); + } uint_fast64_t SylvanSettings::getNumberOfThreads() const { return this->getOption(threadCountOptionName).getArgumentByName("value").getValueAsUnsignedInteger(); diff --git a/src/storm/settings/modules/SylvanSettings.h b/src/storm/settings/modules/SylvanSettings.h index 039528809..b4eed806b 100644 --- a/src/storm/settings/modules/SylvanSettings.h +++ b/src/storm/settings/modules/SylvanSettings.h @@ -32,6 +32,11 @@ namespace storm { */ uint_fast64_t getNumberOfThreads() const; + /*! + * Retrieves whether the number of threads to use was set. + */ + bool isNumberOfThreadsSet() const; + // The name of the module. static const std::string moduleName; diff --git a/src/storm/storage/dd/sylvan/InternalSylvanDdManager.cpp b/src/storm/storage/dd/sylvan/InternalSylvanDdManager.cpp index de2e641ed..9211b4bd1 100644 --- a/src/storm/storage/dd/sylvan/InternalSylvanDdManager.cpp +++ b/src/storm/storage/dd/sylvan/InternalSylvanDdManager.cpp @@ -33,8 +33,12 @@ namespace storm { InternalDdManager::InternalDdManager() { if (numberOfInstances == 0) { - // Initialize lace: auto-detect number of workers. - lace_init(storm::settings::getModule().getNumberOfThreads(), 1000000); + storm::settings::modules::SylvanSettings const& settings = storm::settings::getModule(); + if (settings.isNumberOfThreadsSet()) { + lace_init(settings.getNumberOfThreads(), 1000000); + } else { + lace_init(0, 1000000); + } lace_startup(0, 0, 0); // Each node takes 24 bytes and the maximal memory is specified in megabytes.