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
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"files.associations": {
"*.hip": "cpp",
"*.sycl": "cpp",
"*.ipp": "cpp"
"*.ipp": "cpp",
"*.cu.in": "cpp"
Comment on lines +5 to +6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change.

},
"sonarlint.connectedMode.project": {
"connectionId": "acts-project",
Expand Down
4 changes: 4 additions & 0 deletions core/include/traccc/edm/track_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ struct track_container {
};

struct view {
/// Default constructor
view() = default;
/// Constructor from a buffer
TRACCC_HOST_DEVICE
view(const buffer& b)
Expand All @@ -95,6 +97,8 @@ struct track_container {
};

struct const_view {
/// Default constructor
const_view() = default;
/// Constructor from a buffer
TRACCC_HOST_DEVICE
const_view(const buffer& b)
Expand Down
5 changes: 4 additions & 1 deletion core/include/traccc/geometry/move_only_any.hpp
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) 2024 CERN for the benefit of the ACTS project
* (c) 2024-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand Down Expand Up @@ -113,6 +113,9 @@ class move_only_any {
"Value for `traccc::move_only_any` requested, but no value "
"exists.");
}
if (!is<obj_t>()) {
throw std::bad_any_cast();
}

Comment on lines +116 to 119

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change.

return *static_cast<obj_t *>(m_obj);
}
Expand Down
1 change: 0 additions & 1 deletion device/alpaka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ traccc_add_alpaka_library( traccc_alpaka alpaka TYPE SHARED
# Track fitting algorithm(s).
"include/traccc/alpaka/fitting/kalman_fitting_algorithm.hpp"
"src/fitting/kalman_fitting_algorithm.cpp"
"src/fitting/kalman_fitting.hpp"
)

# Set up Thrust specifically for the traccc::alpaka library.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2025 CERN for the benefit of the ACTS project
* (c) 2025-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Library include(s).
#include "traccc/alpaka/utils/algorithm_base.hpp"
#include "traccc/alpaka/utils/queue.hpp"

// Project include(s).
#include "traccc/bfield/magnetic_field.hpp"
#include "traccc/edm/track_container.hpp"
#include "traccc/fitting/fitting_config.hpp"
#include "traccc/geometry/detector.hpp"
#include "traccc/geometry/detector_buffer.hpp"
#include "traccc/utils/algorithm.hpp"
#include "traccc/utils/memory_resource.hpp"
#include "traccc/utils/messaging.hpp"

// VecMem include(s).
#include <vecmem/utils/copy.hpp>

// System include(s).
#include <functional>
#include "traccc/fitting/device/kalman_fitting_algorithm.hpp"

namespace traccc::alpaka {

/// Kalman filter based track fitting algorithm
class kalman_fitting_algorithm
: public algorithm<edm::track_container<default_algebra>::buffer(
const detector_buffer&, const magnetic_field&,
const edm::track_container<default_algebra>::const_view&)>,
public messaging {
/// Kalman filter based track fitting algorithm using Alpaka
class kalman_fitting_algorithm : public device::kalman_fitting_algorithm,
public alpaka::algorithm_base {

public:
/// Configuration type
using config_type = fitting_config;

/// Constructor with the algorithm's configuration
///
/// @param config The configuration object
Expand All @@ -49,31 +31,63 @@ class kalman_fitting_algorithm
///
kalman_fitting_algorithm(
const config_type& config, const traccc::memory_resource& mr,
const vecmem::copy& copy, queue& q,
const vecmem::copy& copy, alpaka::queue& q,
std::unique_ptr<const Logger> logger = getDummyLogger().clone());

/// Execute the algorithm
private:
/// @name Function(s) implemented from @c device::kalman_fitting_algorithm
/// @{

/// Prepare a buffer with the index order with which to fit the tracks
///
/// @param det The detector object
/// @param bfield The magnetic field object
/// @param track_candidates All track candidates to fit
/// @param[in] tracks The tracks to be fitted
/// @param[out] track_sort_keys Buffer storing temporary sorting keys
/// @param[out] track_indices The buffer to write the fitting order into
///
/// @return A container of the fitted track states
void prepare_track_fit_order(
const edm::track_collection<default_algebra>::const_view& tracks,
vecmem::data::vector_view<device::sort_key>& track_sort_keys,
vecmem::data::vector_view<unsigned int>& track_indices) const override;

/// Kernel to prepare the fitting payloads
///
/// @param payload The payload for the kernel(s)
///
output_type operator()(
const detector_buffer& det, const magnetic_field& bfield,
const edm::track_container<default_algebra>::const_view&
track_candidates) const override;
void fit_prelude_kernel(
const device::fit_prelude_payload& payload) const override;

private:
/// Algorithm configuration
config_type m_config;
/// Memory resource used by the algorithm
traccc::memory_resource m_mr;
/// Copy object used by the algorithm
std::reference_wrapper<const vecmem::copy> m_copy;
/// Queue wrapper
std::reference_wrapper<queue> m_queue;
/// Function preparing the fitting payload
///
/// @param det The detector buffer to prepare the payload for
/// @param field The magnetic field to prepare the payload for
/// @param n_surfaces The number of surfaces for each track to be
/// fitted
/// @param payload The (non-templated) payload for the kernel(s)
///
/// @return The prepared payload for the fitting kernel(s)
///
fit_payload prepare_fit_payload(
const detector_buffer& det, const magnetic_field& field,
const std::vector<unsigned int>& n_surfaces,
const device::fit_payload& payload) const override;

/// Function launching the "forward fitting" kernel(s)
///
/// @param config The fitting configuration
/// @param payload The payload for the fitting kernel(s)
///
void fit_forward_kernel(const fitting_config& config,
const fit_payload& payload) const override;

/// Function launching the "backward fitting" kernel(s)
///
/// @param config The fitting configuration
/// @param payload The payload for the fitting kernel(s)
///
void fit_backward_kernel(const fitting_config& config,
const fit_payload& payload) const override;

/// @}

}; // class kalman_fitting_algorithm

Expand Down
Loading
Loading