Skip to content

Commit

Permalink
Make the throughput applications use progress bars.
Browse files Browse the repository at this point in the history
  • Loading branch information
krasznaa committed Nov 23, 2024
1 parent 61bb906 commit 22b0da1
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 13 deletions.
21 changes: 21 additions & 0 deletions examples/run/common/throughput_mt.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
#include <tbb/task_arena.h>
#include <tbb/task_group.h>

// Indicators include(s).
#include <indicators/progress_bar.hpp>

// System include(s).
#include <atomic>
#include <cstdlib>
Expand Down Expand Up @@ -193,6 +196,14 @@ int throughput_mt(std::string_view description, int argc, char* argv[],
// Cold Run events. To discard any "initialisation issues" in the
// measurements.
{
// Set up a progress bar for the warm-up processing.
indicators::ProgressBar progress_bar{
indicators::option::BarWidth{50},
indicators::option::PrefixText{"Warm-up processing "},
indicators::option::ShowPercentage{true},
indicators::option::ShowRemainingTime{true},
indicators::option::MaxProgress{throughput_opts.cold_run_events}};

// Measure the time of execution.
performance::timer t{"Warm-up processing", times};

Expand All @@ -210,6 +221,7 @@ int throughput_mt(std::string_view description, int argc, char* argv[],
tbb::this_task_arena::current_thread_index()))(
input[event])
.size());
progress_bar.tick();
});
});
}
Expand All @@ -222,6 +234,14 @@ int throughput_mt(std::string_view description, int argc, char* argv[],
rec_track_params = 0;

{
// Set up a progress bar for the event processing.
indicators::ProgressBar progress_bar{
indicators::option::BarWidth{50},
indicators::option::PrefixText{"Event processing "},
indicators::option::ShowPercentage{true},
indicators::option::ShowRemainingTime{true},
indicators::option::MaxProgress{throughput_opts.processed_events}};

// Measure the total time of execution.
performance::timer t{"Event processing", times};

Expand All @@ -239,6 +259,7 @@ int throughput_mt(std::string_view description, int argc, char* argv[],
tbb::this_task_arena::current_thread_index()))(
input[event])
.size());
progress_bar.tick();
});
});
}
Expand Down
21 changes: 21 additions & 0 deletions examples/run/common/throughput_st.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
// VecMem include(s).
#include <vecmem/memory/binary_page_memory_resource.hpp>

// Indicators include(s).
#include <indicators/progress_bar.hpp>

// System include(s).
#include <cstdlib>
#include <ctime>
Expand Down Expand Up @@ -132,6 +135,14 @@ int throughput_st(std::string_view description, int argc, char* argv[],
// Cold Run events. To discard any "initialisation issues" in the
// measurements.
{
// Set up a progress bar for the warm-up processing.
indicators::ProgressBar progress_bar{
indicators::option::BarWidth{50},
indicators::option::PrefixText{"Warm-up processing "},
indicators::option::ShowPercentage{true},
indicators::option::ShowRemainingTime{true},
indicators::option::MaxProgress{throughput_opts.cold_run_events}};

// Measure the time of execution.
performance::timer t{"Warm-up processing", times};

Expand All @@ -144,13 +155,22 @@ int throughput_st(std::string_view description, int argc, char* argv[],

// Process one event.
rec_track_params += (*alg)(input[event]).size();
progress_bar.tick();
}
}

// Reset the dummy counter.
rec_track_params = 0;

{
// Set up a progress bar for the event processing.
indicators::ProgressBar progress_bar{
indicators::option::BarWidth{50},
indicators::option::PrefixText{"Event processing "},
indicators::option::ShowPercentage{true},
indicators::option::ShowRemainingTime{true},
indicators::option::MaxProgress{throughput_opts.processed_events}};

// Measure the total time of execution.
performance::timer t{"Event processing", times};

Expand All @@ -163,6 +183,7 @@ int throughput_st(std::string_view description, int argc, char* argv[],

// Process one event.
rec_track_params += (*alg)(input[event]).size();
progress_bar.tick();
}
}

Expand Down
8 changes: 4 additions & 4 deletions examples/run/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ target_link_libraries( traccc_examples_cpu
PUBLIC vecmem::core detray::core detray::detectors traccc::core )

traccc_add_executable( throughput_st "throughput_st.cpp"
LINK_LIBRARIES vecmem::core detray::detectors detray::io
traccc::core traccc::io traccc::performance
LINK_LIBRARIES indicators::indicators vecmem::core detray::detectors
detray::io traccc::core traccc::io traccc::performance
traccc::options traccc_examples_cpu )

traccc_add_executable( throughput_mt "throughput_mt.cpp"
LINK_LIBRARIES TBB::tbb vecmem::core detray::detectors detray::io
traccc::core traccc::io traccc::performance
LINK_LIBRARIES indicators::indicators TBB::tbb vecmem::core detray::detectors
detray::io traccc::core traccc::io traccc::performance
traccc::options traccc_examples_cpu )
10 changes: 5 additions & 5 deletions examples/run/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TRACCC library, part of the ACTS project (R&D line)
#
# (c) 2021-2022 CERN for the benefit of the ACTS project
# (c) 2021-2024 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

Expand Down Expand Up @@ -37,13 +37,13 @@ target_link_libraries( traccc_examples_cuda
traccc::core traccc::device_common traccc::cuda )

traccc_add_executable( throughput_st_cuda "throughput_st.cpp"
LINK_LIBRARIES vecmem::core vecmem::cuda detray::detectors detray::io
traccc::io traccc::performance
LINK_LIBRARIES indicators::indicators vecmem::core vecmem::cuda
detray::detectors detray::io traccc::io traccc::performance
traccc::core traccc::device_common traccc::cuda
traccc::options traccc_examples_cuda )

traccc_add_executable( throughput_mt_cuda "throughput_mt.cpp"
LINK_LIBRARIES TBB::tbb vecmem::core vecmem::cuda detray::detectors detray::io
traccc::io traccc::performance
LINK_LIBRARIES indicators::indicators TBB::tbb vecmem::core vecmem::cuda
detray::detectors detray::io traccc::io traccc::performance
traccc::core traccc::device_common traccc::cuda
traccc::options traccc_examples_cuda )
8 changes: 4 additions & 4 deletions examples/run/sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ target_link_libraries( traccc_examples_sycl
traccc::core traccc::device_common traccc::sycl )

traccc_add_executable( throughput_st_sycl "throughput_st.cpp"
LINK_LIBRARIES vecmem::core vecmem::sycl detray::detectors detray::io
traccc::io traccc::performance
LINK_LIBRARIES indicators::indicators vecmem::core vecmem::sycl
detray::detectors detray::io traccc::io traccc::performance
traccc::core traccc::device_common traccc::sycl
traccc::options traccc_examples_sycl )

traccc_add_executable( throughput_mt_sycl "throughput_mt.cpp"
LINK_LIBRARIES TBB::tbb vecmem::core vecmem::sycl detray::detectors detray::io
traccc::io traccc::performance
LINK_LIBRARIES indicators::indicators TBB::tbb vecmem::core vecmem::sycl
detray::detectors detray::io traccc::io traccc::performance
traccc::core traccc::device_common traccc::sycl
traccc::options traccc_examples_sycl )

0 comments on commit 22b0da1

Please sign in to comment.