Commit c634ad86 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Alignment: allow configuration of workers

parent 3c609a86
Pipeline #4045197 passed with stages
in 14 minutes and 42 seconds
......@@ -31,7 +31,9 @@ AlignmentDUTResidual::AlignmentDUTResidual(Configuration& config, std::shared_pt
config_.setDefault<std::string>("align_orientation_axes", "xyz");
config_.setDefault<size_t>("max_associated_clusters", 1);
config_.setDefault<double>("max_track_chi2ndof", 10.);
config_.setDefault<unsigned int>("workers", std::max(std::thread::hardware_concurrency() - 1, 1u));
m_workers = config.get<unsigned int>("workers");
nIterations = config_.get<size_t>("iterations");
m_pruneTracks = config_.get<bool>("prune_tracks");
......@@ -244,11 +246,10 @@ void AlignmentDUTResidual::finalize(const std::shared_ptr<ReadonlyClipboard>& cl
AlignmentDUTResidual::globalTracks = clipboard->getPersistentData<Track>();
// Create thread pool:
auto threads = std::max(std::thread::hardware_concurrency() - 1, 1u);
ThreadPool::registerThreadCount(threads);
ThreadPool::registerThreadCount(m_workers);
AlignmentDUTResidual::thread_pool =
new ThreadPool(threads,
threads * 1024,
new ThreadPool(m_workers,
m_workers * 1024,
[log_level = corryvreckan::Log::getReportingLevel(), log_format = corryvreckan::Log::getFormat()]() {
// clang-format on
// Initialize the threads to the same log level and format as the master setting
......
......@@ -62,6 +62,7 @@ namespace corryvreckan {
static std::shared_ptr<Detector> globalDetector;
static ThreadPool* thread_pool;
unsigned int m_workers;
size_t nIterations;
bool m_pruneTracks;
bool m_alignPosition;
......
......@@ -30,9 +30,12 @@ AlignmentTrackChi2::AlignmentTrackChi2(Configuration& config, std::vector<std::s
config_.setDefault<bool>("align_orientation", true);
config_.setDefault<size_t>("max_associated_clusters", 1);
config_.setDefault<double>("max_track_chi2ndof", 10.);
config_.setDefault<unsigned int>("workers", std::max(std::thread::hardware_concurrency() - 1, 1u));
m_workers = config.get<unsigned int>("workers");
nIterations = config_.get<size_t>("iterations");
m_pruneTracks = config_.get<bool>("prune_tracks");
m_alignPosition = config_.get<bool>("align_position");
if(m_alignPosition) {
LOG(INFO) << "Aligning positions";
......@@ -177,11 +180,10 @@ void AlignmentTrackChi2::finalize(const std::shared_ptr<ReadonlyClipboard>& clip
AlignmentTrackChi2::globalTracks = clipboard->getPersistentData<Track>();
// Create thread pool:
auto threads = std::max(std::thread::hardware_concurrency() - 1, 1u);
ThreadPool::registerThreadCount(threads);
ThreadPool::registerThreadCount(m_workers);
AlignmentTrackChi2::thread_pool =
new ThreadPool(threads,
threads * 1024,
new ThreadPool(m_workers,
m_workers * 1024,
[log_level = corryvreckan::Log::getReportingLevel(), log_format = corryvreckan::Log::getFormat()]() {
// clang-format on
// Initialize the threads to the same log level and format as the master setting
......
......@@ -50,6 +50,7 @@ namespace corryvreckan {
static int detNum;
static ThreadPool* thread_pool;
unsigned int m_workers;
size_t nIterations;
bool m_pruneTracks;
bool m_alignPosition;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment