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

Add Indicators, main branch (2024.11.23.) #780

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,21 @@ if( TRACCC_SETUP_BENCHMARKS )
endif()
endif()

# Set up indicators.
option( TRACCC_SETUP_INDICATORS
"Set up the indicators target(s) explicitly" ${TRACCC_BUILD_EXAMPLES} )
option( TRACCC_USE_SYSTEM_INDICATORS
"Pick up an existing installation of indicators from the build environment"
${TRACCC_USE_SYSTEM_LIBS} )
if( TRACCC_SETUP_INDICATORS )
if( TRACCC_USE_SYSTEM_INDICATORS )
find_package( indicators REQUIRED )
else()
add_subdirectory( extern/indicators )
endif()
endif()


option( TRACCC_ENABLE_NVTX_PROFILING
"Use instrument functions to enable fine grained profiling" FALSE )

Expand Down
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 )
42 changes: 42 additions & 0 deletions extern/indicators/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# TRACCC library, part of the ACTS project (R&D line)
#
# (c) 2024 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

# CMake include(s).
cmake_minimum_required( VERSION 3.14 )
include( FetchContent )

# Silence FetchContent warnings with CMake >=3.24.
if( POLICY CMP0135 )
cmake_policy( SET CMP0135 NEW )
endif()

# Tell the user what's happening.
message( STATUS "Building indicators as part of the TRACCC project" )

# Declare where to get indicators from.
set( TRACCC_INDICATORS_SOURCE
"URL;https://github.com/p-ranav/indicators/archive/refs/tags/v2.3.tar.gz;URL_MD5;317d2658fbb45d9d192f88ae0f1c9e9d"
CACHE STRING "Source for indicators, when built as part of this project" )
mark_as_advanced( TRACCC_INDICATORS_SOURCE )
FetchContent_Declare( Indicators ${TRACCC_INDICATORS_SOURCE} )

# Configure the indicators build.
set( INDICATORS_BUILD_TESTS FALSE CACHE BOOL
"Turn off the indicators tests build" )
set( INDICATORS_SAMPLES FALSE CACHE BOOL
"Turn off the indicators samples build" )
set( INDICATORS_DEMO FALSE CACHE BOOL
"Turn off the indicators demo build" )

# Get it into the current directory.
FetchContent_MakeAvailable( Indicators )

# Treat the indicators headers as "system headers", to avoid getting warnings
# from them.
get_target_property( _incDirs indicators INTERFACE_INCLUDE_DIRECTORIES )
target_include_directories( indicators
SYSTEM INTERFACE ${_incDirs} )
unset( _incDirs )
4 changes: 4 additions & 0 deletions extern/indicators/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Build recipe for p-ranav/indicators

This package downloads the https://github.com/p-ranav/indicators project,
to be used in the test executables of the repository.
Loading