Skip to content

Commit

Permalink
Merge branch 'main' into sycl_queue_wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
StewMH authored Nov 27, 2024
2 parents 11734a5 + 99a341e commit aae6ccf
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 7 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,13 @@ if( TRACCC_SETUP_BENCHMARKS )
endif()

# Set up indicators.
set( _indicatorsDefault FALSE )
if( TRACCC_BUILD_EXAMPLES OR TRACCC_BUILD_IO )
set( _indicatorsDefault TRUE )
endif()
option( TRACCC_SETUP_INDICATORS
"Set up the indicators target(s) explicitly" ${TRACCC_BUILD_EXAMPLES} )
"Set up the indicators target(s) explicitly" ${_indicatorsDefault} )
unset( _indicatorsDefault )
option( TRACCC_USE_SYSTEM_INDICATORS
"Pick up an existing installation of indicators from the build environment"
${TRACCC_USE_SYSTEM_LIBS} )
Expand Down
5 changes: 3 additions & 2 deletions device/sycl/src/utils/make_prefix_sum_buff.sycl
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ vecmem::data::vector_buffer<device::prefix_sum_element_t> make_prefix_sum_buff(
h.parallel_for<kernels::fill_prefix_sum>(
::sycl::nd_range<1>(((sizes_sum_view.size() / 32) + 1) * 32,
32),
[sizes_sum_view, prefix_sum_view](::sycl::id<1> idx) {
device::fill_prefix_sum(idx, sizes_sum_view,
[sizes_sum_view,
prefix_sum_view](const ::sycl::nd_item<1> idx) {
device::fill_prefix_sum(idx.get_global_id(), sizes_sum_view,
prefix_sum_view);
});
})
Expand Down
9 changes: 6 additions & 3 deletions performance/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) 2022-2023 CERN for the benefit of the ACTS project
# (c) 2022-2024 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

Expand Down Expand Up @@ -36,7 +36,7 @@ traccc_add_library( traccc_performance performance TYPE SHARED
"include/traccc/utils/ranges.hpp"
"include/traccc/utils/helpers.hpp"
"src/utils/helpers.hpp"
"src/utils/helpers.cpp"
"src/utils/helpers.cpp"
# Value/object comparison code.
"include/traccc/performance/details/is_same_angle.hpp"
"src/performance/details/is_same_angle.cpp"
Expand All @@ -53,6 +53,8 @@ traccc_add_library( traccc_performance performance TYPE SHARED
"include/traccc/performance/impl/comparator_factory.ipp"
"include/traccc/performance/impl/seed_comparator_factory.ipp"
"src/performance/details/comparator_factory.cpp"
"include/traccc/performance/details/comparison_progress.hpp"
"src/performance/details/comparison_progress.cpp"
# Collection/container comparison code.
"include/traccc/performance/collection_comparator.hpp"
"include/traccc/performance/impl/collection_comparator.ipp"
Expand All @@ -66,7 +68,8 @@ traccc_add_library( traccc_performance performance TYPE SHARED
"include/traccc/performance/throughput.hpp"
"src/performance/throughput.cpp" )
target_link_libraries( traccc_performance
PUBLIC traccc::core traccc::io covfie::core detray::test_utils )
PUBLIC traccc::core traccc::io covfie::core detray::test_utils
PRIVATE indicators::indicators )

# Use ROOT in traccc::performance, if requested.
if( TRACCC_USE_ROOT )
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/** 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
*/

#pragma once

// System include(s).
#include <iostream>
#include <memory>
#include <string_view>

namespace traccc::details {

/// Internal data used by @c comparison_progress
struct comparison_progress_data;

/// Class for tracking the progress of a comparison operation
///
/// It's really just a wrapper around the indicators::progress_bar class.
/// It's here to not expose a public dependency on the indicators library.
///
class comparison_progress {

public:
/// Constructor with the total number of steps
comparison_progress(std::size_t steps, std::ostream& out = std::cout,
std::string_view description = "Running comparison ");
/// Destructor
~comparison_progress();

/// Mark one step done with the progress
void tick();

private:
/// Opaque internal data
std::unique_ptr<comparison_progress_data> m_data;

}; // class comparison_progress

} // namespace traccc::details
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2022 CERN for the benefit of the ACTS project
* (c) 2022-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Library include(s).
#include "traccc/performance/details/comparison_progress.hpp"
#include "traccc/performance/details/is_same_object.hpp"

// Project include(s).
Expand Down Expand Up @@ -52,6 +53,10 @@ void collection_comparator<TYPE>::operator()(
<< " (" << m_lhs_type << "), " << rhs_coll.size() << " ("
<< m_rhs_type << ")\n";

// Create a progress bar.
details::comparison_progress progress{
lhs_coll.size() * m_uncertainties.size(), m_out.get()};

// Calculate the agreements at various uncertainties.
std::vector<scalar> agreements;
agreements.reserve(m_uncertainties.size());
Expand All @@ -66,6 +71,7 @@ void collection_comparator<TYPE>::operator()(
obj, uncertainty)) != rhs_coll.end()) {
++matched;
}
progress.tick();
}
// Calculate the agreement value.
agreements.push_back(
Expand Down
44 changes: 44 additions & 0 deletions performance/src/performance/details/comparison_progress.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/** 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
*/

// Local include(s).
#include "traccc/performance/details/comparison_progress.hpp"

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

namespace traccc::details {

struct comparison_progress_data {

/// Progress bar used internally
std::unique_ptr<indicators::ProgressBar> m_bar;

}; // struct comparison_progress_data

comparison_progress::comparison_progress(std::size_t steps, std::ostream& out,
std::string_view description)
: m_data(std::make_unique<comparison_progress_data>()) {

// Set up the progress bar.
m_data->m_bar = std::make_unique<indicators::ProgressBar>(
indicators::option::BarWidth{50},
indicators::option::PrefixText{description.data()},
indicators::option::ShowPercentage{true},
indicators::option::ShowRemainingTime{true},
indicators::option::MaxProgress{steps},
indicators::option::Stream{out});
}

comparison_progress::~comparison_progress() = default;

void comparison_progress::tick() {

m_data->m_bar->tick();
}

} // namespace traccc::details

0 comments on commit aae6ccf

Please sign in to comment.