Skip to content
Open
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
1 change: 1 addition & 0 deletions examples/options/include/traccc/options/track_seeding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma once

// Project include(s).
#include "traccc/definitions/primitives.hpp"
#include "traccc/options/details/config_provider.hpp"
#include "traccc/options/details/interface.hpp"
#include "traccc/options/details/value_array.hpp"
Expand Down
7 changes: 5 additions & 2 deletions examples/run/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ include( traccc-compiler-options-cpp )

# Create the common library.
add_library(traccc_examples_common STATIC
"common/device_backend.hpp"
"common/device_track_finding_validation.hpp"
"common/device_track_finding_validation.ipp"
"common/make_magnetic_field.hpp"
"common/make_magnetic_field.cpp"
"common/print_fitted_tracks_statistics.hpp"
Expand All @@ -18,8 +21,8 @@ add_library(traccc_examples_common STATIC
"common/throughput_st.hpp"
"common/throughput_st.ipp")
target_link_libraries(traccc_examples_common
PUBLIC traccc::core traccc::options
PRIVATE traccc::io)
PUBLIC vecmem::core traccc::core traccc::options traccc::io
traccc::performance )

# Add all the subdirectories that can be built.
add_subdirectory(cpu)
Expand Down
30 changes: 20 additions & 10 deletions examples/run/alpaka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,35 @@ endif()
set(LIBRARIES vecmem::core traccc::io traccc::performance
traccc::core traccc::device_common traccc::alpaka
traccc::options traccc_examples_common ${EXTRA_LIBS})
set(DETRAY detray::io detray::detectors)

traccc_add_executable( seq_example_alpaka "seq_example_alpaka.cpp"
LINK_LIBRARIES ${LIBRARIES} ${DETRAY} )
traccc_add_executable( seeding_example_alpaka "seeding_example_alpaka.cpp"
LINK_LIBRARIES ${LIBRARIES} )

#
# Set up the "throughput applications".
# Set up the library used by the applications.
#
add_library( traccc_examples_alpaka STATIC
"device_backend.hpp"
"device_backend.cpp"
"full_chain_algorithm.hpp"
"full_chain_algorithm.cpp" )
target_link_libraries( traccc_examples_alpaka
PUBLIC vecmem::core detray::core detray::detectors
traccc::core traccc::device_common traccc::alpaka traccc_examples_common ${EXTRA_LIBS})
traccc::core traccc::device_common traccc::alpaka traccc_examples_common
${EXTRA_LIBS} )

#
# Set up the applications.
#
traccc_add_executable( throughput_st_alpaka "throughput_st.cpp"
LINK_LIBRARIES indicators::indicators ${LIBRARIES} ${DETRAY} traccc_examples_alpaka )
LINK_LIBRARIES indicators::indicators traccc_examples_common
traccc_examples_alpaka )

traccc_add_executable( throughput_mt_alpaka "throughput_mt.cpp"
LINK_LIBRARIES TBB::tbb indicators::indicators ${LIBRARIES} ${DETRAY} traccc_examples_alpaka )
LINK_LIBRARIES TBB::tbb indicators::indicators traccc_examples_common
traccc_examples_alpaka )

traccc_add_executable( track_finding_validation_alpaka
"track_finding_validation.cpp"
LINK_LIBRARIES traccc_examples_common traccc_examples_alpaka )

traccc_add_executable( reconstruction_validation_alpaka
"reconstruction_validation.cpp"
LINK_LIBRARIES traccc_examples_common traccc_examples_alpaka )
156 changes: 156 additions & 0 deletions examples/run/alpaka/device_backend.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

// Local include(s).
#include "device_backend.hpp"

// Project include(s).
#include "traccc/alpaka/clusterization/clusterization_algorithm.hpp"
#include "traccc/alpaka/clusterization/measurement_sorting_algorithm.hpp"
#include "traccc/alpaka/finding/combinatorial_kalman_filter_algorithm.hpp"
#include "traccc/alpaka/fitting/kalman_fitting_algorithm.hpp"
#include "traccc/alpaka/seeding/seeding_algorithm.hpp"
#include "traccc/alpaka/seeding/spacepoint_formation_algorithm.hpp"
#include "traccc/alpaka/seeding/track_params_estimation.hpp"
#include "traccc/alpaka/utils/queue.hpp"
#include "traccc/alpaka/utils/vecmem_objects.hpp"

namespace traccc::alpaka {

struct device_backend::impl {

/// Alpaka queue to use
queue m_queue;
/// VecMem objects to use
vecmem_objects m_vo{m_queue};

/// Traccc memory resource
memory_resource m_mr{m_vo.device_mr(), &(m_vo.host_mr())};

}; // struct device_backend::impl

device_backend::device_backend(std::unique_ptr<const Logger> logger)
: messaging(std::move(logger)), m_impl{std::make_unique<impl>()} {}

device_backend::~device_backend() = default;

vecmem::copy& device_backend::copy() const {

return m_impl->m_vo.async_copy();
}

memory_resource& device_backend::mr() const {

return m_impl->m_mr;
}

void device_backend::synchronize() const {

m_impl->m_queue.synchronize();
}

magnetic_field device_backend::make_magnetic_field(const magnetic_field& bfield,
bool) const {

return bfield;
}

std::unique_ptr<algorithm<edm::measurement_collection<default_algebra>::buffer(
const edm::silicon_cell_collection::const_view&,
const silicon_detector_description::const_view&)>>
device_backend::make_clusterization_algorithm(
const clustering_config& config) const {

TRACCC_VERBOSE("Constructing alpaka::clusterization_algorithm");
return std::make_unique<alpaka::clusterization_algorithm>(
m_impl->m_mr, m_impl->m_vo.async_copy(), m_impl->m_queue, config,
logger().clone("alpaka::clusterization_algorithm"));
}

std::unique_ptr<algorithm<edm::measurement_collection<default_algebra>::buffer(
const edm::measurement_collection<default_algebra>::const_view&)>>
device_backend::make_measurement_sorting_algorithm() const {

TRACCC_VERBOSE("Constructing alpaka::measurement_sorting_algorithm");
return std::make_unique<alpaka::measurement_sorting_algorithm>(
m_impl->m_mr, m_impl->m_vo.async_copy(), m_impl->m_queue,
logger().clone("alpaka::measurement_sorting_algorithm"));
}

std::unique_ptr<algorithm<edm::spacepoint_collection::buffer(
const detector_buffer&,
const edm::measurement_collection<default_algebra>::const_view&)>>
device_backend::make_spacepoint_formation_algorithm() const {

TRACCC_VERBOSE("Constructing alpaka::spacepoint_formation_algorithm");
return std::make_unique<alpaka::spacepoint_formation_algorithm>(
m_impl->m_mr, m_impl->m_vo.async_copy(), m_impl->m_queue,
logger().clone("alpaka::spacepoint_formation_algorithm"));
}

std::unique_ptr<algorithm<edm::seed_collection::buffer(
const edm::spacepoint_collection::const_view&)>>
device_backend::make_seeding_algorithm(
const seedfinder_config& finder_config,
const spacepoint_grid_config& grid_config,
const seedfilter_config& filter_config) const {

TRACCC_VERBOSE("Constructing alpaka::seeding_algorithm");
return std::make_unique<alpaka::seeding_algorithm>(
finder_config, grid_config, filter_config, m_impl->m_mr,
m_impl->m_vo.async_copy(), m_impl->m_queue,
logger().clone("alpaka::seeding_algorithm"));
}

std::unique_ptr<algorithm<bound_track_parameters_collection_types::buffer(
const edm::measurement_collection<default_algebra>::const_view&,
const edm::spacepoint_collection::const_view&,
const edm::seed_collection::const_view&, const vector3&)>>
device_backend::make_track_params_estimation_algorithm(
const track_params_estimation_config& config) const {

TRACCC_VERBOSE("Constructing alpaka::track_params_estimation");
return std::make_unique<alpaka::track_params_estimation>(
config, m_impl->m_mr, m_impl->m_vo.async_copy(), m_impl->m_queue,
logger().clone("alpaka::track_params_estimation"));
}

std::unique_ptr<algorithm<edm::track_container<default_algebra>::buffer(
const detector_buffer&, const magnetic_field&,
const edm::measurement_collection<default_algebra>::const_view&,
const bound_track_parameters_collection_types::const_view&)>>
device_backend::make_finding_algorithm(const finding_config& config) const {

TRACCC_VERBOSE(
"Constructing alpaka::combinatorial_kalman_filter_algorithm");
return std::make_unique<alpaka::combinatorial_kalman_filter_algorithm>(
config, m_impl->m_mr, m_impl->m_vo.async_copy(), m_impl->m_queue,
logger().clone("alpaka::combinatorial_kalman_filter_algorithm"));
}

std::unique_ptr<algorithm<edm::track_container<default_algebra>::buffer(
const edm::track_container<default_algebra>::const_view&)>>
device_backend::make_ambiguity_resolution_algorithm(
const ambiguity_resolution_config&) const {

TRACCC_DEBUG(
"No ambiguity resolution algorithm implemented for the Alpaka backend");
return {};
}

std::unique_ptr<algorithm<edm::track_container<default_algebra>::buffer(
const detector_buffer&, const magnetic_field&,
const edm::track_container<default_algebra>::const_view&)>>
device_backend::make_fitting_algorithm(const fitting_config& config) const {

TRACCC_VERBOSE("Constructing alpaka::kalman_fitting_algorithm");
return std::make_unique<alpaka::kalman_fitting_algorithm>(
config, m_impl->m_mr, m_impl->m_vo.async_copy(), m_impl->m_queue,
logger().clone("alpaka::kalman_fitting_algorithm"));
}

} // namespace traccc::alpaka
114 changes: 114 additions & 0 deletions examples/run/alpaka/device_backend.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "../common/device_backend.hpp"
#include "traccc/utils/messaging.hpp"

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

namespace traccc::alpaka {

/// Alpaka Device Backend
class device_backend : public traccc::device_backend, public messaging {

public:
/// Constructor
///
/// @param logger The logger to use
///
device_backend(

Check failure on line 27 in examples/run/alpaka/device_backend.hpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add the "explicit" keyword to this constructor.

See more on https://sonarcloud.io/project/issues?id=acts-project_traccc&issues=AZql9ixRcctR24lBaT4R&open=AZql9ixRcctR24lBaT4R&pullRequest=1204
std::unique_ptr<const Logger> logger = getDummyLogger().clone());
/// Destructor
~device_backend();

Check warning on line 30 in examples/run/alpaka/device_backend.hpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Annotate this function with "override" or "final".

See more on https://sonarcloud.io/project/issues?id=acts-project_traccc&issues=AZql9ixRcctR24lBaT4S&open=AZql9ixRcctR24lBaT4S&pullRequest=1204

/// @name Function(s) implemented from @c traccc::device_backend
/// @{

/// Access a copy object for the used device
vecmem::copy& copy() const override;

/// Get the memory resource(s) used by the algorithms
memory_resource& mr() const override;

/// Wait for the used device to finish all scheduled operations
void synchronize() const override;

/// Set up the magnetic field for the device
magnetic_field make_magnetic_field(
const magnetic_field& bfield,
bool texture_memory = false) const override;

/// Construct a clusterization algorithm instance
std::unique_ptr<
algorithm<edm::measurement_collection<default_algebra>::buffer(
const edm::silicon_cell_collection::const_view&,
const silicon_detector_description::const_view&)>>
make_clusterization_algorithm(
const clustering_config& config) const override;

/// Construct a measurement sorting algorithm instance
std::unique_ptr<
algorithm<edm::measurement_collection<default_algebra>::buffer(
const edm::measurement_collection<default_algebra>::const_view&)>>
make_measurement_sorting_algorithm() const override;

/// Construct a spacepoint formation algorithm instance
std::unique_ptr<algorithm<edm::spacepoint_collection::buffer(
const detector_buffer&,
const edm::measurement_collection<default_algebra>::const_view&)>>
make_spacepoint_formation_algorithm() const override;

/// Construct a seeding algorithm instance
std::unique_ptr<algorithm<edm::seed_collection::buffer(
const edm::spacepoint_collection::const_view&)>>
make_seeding_algorithm(
const seedfinder_config& finder_config,
const spacepoint_grid_config& grid_config,
const seedfilter_config& filter_config) const override;

/// Construct a track parameter estimation algorithm instance
std::unique_ptr<algorithm<bound_track_parameters_collection_types::buffer(
const edm::measurement_collection<default_algebra>::const_view&,
const edm::spacepoint_collection::const_view&,
const edm::seed_collection::const_view&, const vector3&)>>
make_track_params_estimation_algorithm(
const track_params_estimation_config& config) const override;

/// Construct a track finding algorithm instance
std::unique_ptr<algorithm<edm::track_container<default_algebra>::buffer(
const detector_buffer&, const magnetic_field&,
const edm::measurement_collection<default_algebra>::const_view&,
const bound_track_parameters_collection_types::const_view&)>>
make_finding_algorithm(const finding_config& config) const override;

/// Construct an ambiguity resolution algorithm instance
std::unique_ptr<algorithm<edm::track_container<default_algebra>::buffer(
const edm::track_container<default_algebra>::const_view&)>>
make_ambiguity_resolution_algorithm(
const ambiguity_resolution_config& config) const override;

/// Construct a track fitting algorithm instance
std::unique_ptr<algorithm<edm::track_container<default_algebra>::buffer(
const detector_buffer&, const magnetic_field&,
const edm::track_container<default_algebra>::const_view&)>>
make_fitting_algorithm(const fitting_config& config) const override;

/// @}

private:
/// Implementation class
struct impl;
/// PIMPL data object
std::unique_ptr<impl> m_impl;

}; // class device_backend

} // namespace traccc::alpaka
20 changes: 20 additions & 0 deletions examples/run/alpaka/reconstruction_validation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

// Project include(s).
#include "../common/device_reconstruction_validation.hpp"

// Local include(s).
#include "device_backend.hpp"

int main(int argc, char* argv[]) {

return traccc::device_reconstruction_validation<
traccc::alpaka::device_backend>("reconstruction_validation_alpaka",
"Alpaka Reconstruction Validation",
argc, argv);
}
Loading
Loading