Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Sequencer run with 0 threads or 0 events #4053

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Examples/Framework/src/Framework/Sequencer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ Sequencer::Sequencer(const Sequencer::Config& cfg)
m_taskArena((m_cfg.numThreads < 0) ? tbb::task_arena::automatic
: m_cfg.numThreads),
m_logger(Acts::getDefaultLogger("Sequencer", m_cfg.logLevel)) {
if (m_cfg.numThreads < -1 || m_cfg.numThreads == 0) {
ACTS_ERROR("Number of threads must be -1 (automatic) or positive");
throw std::invalid_argument(
"Number of threads must be -1 (automatic) or positive");
}

if (m_cfg.numThreads == 1) {
ACTS_INFO("Create Sequencer (single-threaded)");
} else {
Expand Down Expand Up @@ -387,6 +393,9 @@ inline std::string asString(D duration) {
// Convert duration scaled to one event to a printable string.
template <typename D>
inline std::string perEvent(D duration, std::size_t numEvents) {
if (numEvents == 0) {
return "undef/event";
}
return asString(duration / numEvents) + "/event";
}

Expand Down
Loading