Skip to content

Commit

Permalink
Limit Sylvan threads to 1 on Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
volkm committed Sep 4, 2024
1 parent ef92a81 commit 330e2c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/storm/settings/modules/SylvanSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,22 @@ uint_fast64_t SylvanSettings::getNumberOfThreads() const {
}
}
// Automatic detection
#ifdef APPLE_SILICON
// Prevents issues with multi-threaded execution on Apple Silicon
return 1u;
#else
return std::max(1u, storm::utility::getNumberOfThreads());
#endif
}

bool SylvanSettings::check() const {
if (isNumberOfThreadsSet()) {
auto const autoDetectThreads = std::max(1u, storm::utility::getNumberOfThreads());
auto const numberFromSettings = getNumberOfThreads();
#ifdef APPLE_SILICON
STORM_LOG_WARN_COND(numberFromSettings <= 1,
"Sylvan does not properly work for multiple threads on Apple Silicon. We recommend limiting the number of threads to 1.");
#endif
STORM_LOG_WARN_COND(numberFromSettings <= autoDetectThreads, "Setting the number of sylvan threads to "
<< numberFromSettings << " which exceeds the recommended number for your system ("
<< autoDetectThreads << ").");
Expand Down
3 changes: 3 additions & 0 deletions src/storm/utility/OsDetection.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#define MACOS
#define NOEXCEPT noexcept
#define _DARWIN_USE_64_BIT_INODE
#ifdef __arm64__
#define APPLE_SILICON
#endif
#include <cxxabi.h> // Required by ErrorHandling.h
#include <execinfo.h> // Required by ErrorHandling.h
#include <sys/mman.h>
Expand Down

0 comments on commit 330e2c9

Please sign in to comment.