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

Track Finding Cleanup, main branch (2025.01.07.) #808

Merged
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
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
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-2024 CERN for the benefit of the ACTS project
# (c) 2022-2025 CERN for the benefit of the ACTS project
#
# Mozilla Public License Version 2.0

Expand All @@ -15,6 +15,7 @@ stages:
- git clone $CLONE_URL src
- git -C src checkout $HEAD_SHA
- source ./src/.github/ci_setup.sh ${TRACCC_BUILD_TYPE}
- export CTEST_PARALLEL_LEVEL=2

# Build job template.
.build_template: &build_job
Expand Down
16 changes: 16 additions & 0 deletions device/common/include/traccc/device/global_index.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* 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

namespace traccc::device {

/// Type for passing "global indices" to device functions
using global_index_t = unsigned int;

} // namespace traccc::device
25 changes: 17 additions & 8 deletions device/common/include/traccc/finding/device/apply_interaction.hpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2023 CERN for the benefit of the ACTS project
* (c) 2023-2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Local include(s).
#include "traccc/device/global_index.hpp"

// Project include(s).
#include "detray/navigation/navigator.hpp"
#include "detray/propagator/actors/pointwise_material_interactor.hpp"
#include "traccc/definitions/qualifiers.hpp"
#include "traccc/edm/track_parameters.hpp"
#include "traccc/finding/finding_config.hpp"
#include "traccc/utils/particle.hpp"

// VecMem include(s).
#include <vecmem/containers/data/vector_view.hpp>

namespace traccc::device {

/// (Event Data) Payload for the @c traccc::device::apply_interaction function
template <typename detector_t>
struct apply_interaction_payload {
/**
Expand All @@ -25,7 +31,7 @@ struct apply_interaction_payload {
/**
* @brief Total number of input parameters (including non-live ones)
*/
const int n_params;
unsigned int n_params;

/**
* @brief View object to the vector of bound track parameters
Expand All @@ -39,16 +45,19 @@ struct apply_interaction_payload {
vecmem::data::vector_view<const unsigned int> params_liveness_view;
};

/// Function applying the Pre material interaction to tracks spawned by bound
/// track parameters
/// Function applying the material interaction to tracks spawned described by
/// bound track parameters
///
/// @param[in] globalIndex The index of the current thread
/// @param[in] cfg Track finding config object
/// @param[inout] payload The function call payload
///
template <typename detector_t>
TRACCC_DEVICE inline void apply_interaction(
std::size_t globalIndex, const finding_config& cfg,
global_index_t globalIndex, const finding_config& cfg,
const apply_interaction_payload<detector_t>& payload);

} // namespace traccc::device

// Include the implementation.
#include "./impl/apply_interaction.ipp"
19 changes: 15 additions & 4 deletions device/common/include/traccc/finding/device/build_tracks.hpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2023 CERN for the benefit of the ACTS project
* (c) 2023-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Local include(s).
#include "traccc/device/global_index.hpp"

// Project include(s).
#include "traccc/definitions/qualifiers.hpp"
#include "traccc/edm/measurement.hpp"
#include "traccc/edm/track_candidate.hpp"
#include "traccc/edm/track_parameters.hpp"
#include "traccc/finding/candidate_link.hpp"
#include "traccc/finding/finding_config.hpp"

// VecMem include(s).
#include <vecmem/containers/data/jagged_vector_view.hpp>
#include <vecmem/containers/data/vector_view.hpp>

namespace traccc::device {

/// (Event Data) Payload for the @c traccc::device::build_tracks function
struct build_tracks_payload {
/**
* @brief View object to the vector of measurements
Expand Down Expand Up @@ -64,11 +74,12 @@ struct build_tracks_payload {
/// @param[in] globalIndex The index of the current thread
/// @param[in] cfg Track finding config object
/// @param[inout] payload The function call payload
template <typename config_t>
TRACCC_DEVICE inline void build_tracks(std::size_t globalIndex,
const config_t cfg,
///
TRACCC_DEVICE inline void build_tracks(global_index_t globalIndex,
const finding_config& cfg,
const build_tracks_payload& payload);

} // namespace traccc::device

// Include the implementation.
#include "./impl/build_tracks.ipp"
17 changes: 14 additions & 3 deletions device/common/include/traccc/finding/device/fill_sort_keys.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024 CERN for the benefit of the ACTS project
* (c) 2024-2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Local include(s).
#include "traccc/device/global_index.hpp"

// Project include(s).
#include "traccc/edm/device/sort_key.hpp"
#include "traccc/edm/track_candidate.hpp"
#include "traccc/edm/track_parameters.hpp"

// VecMem include(s).
#include <vecmem/containers/data/vector_view.hpp>

namespace traccc::device {

/// (Event Data) Payload for the @c traccc::device::fill_sort_keys function
struct fill_sort_keys_payload {
/**
* @brief View object to the vector of bound track parameters
Expand All @@ -34,8 +42,11 @@ struct fill_sort_keys_payload {
///
/// @param[in] globalIndex The index of the current thread
/// @param[inout] payload The function call payload
///
TRACCC_HOST_DEVICE inline void fill_sort_keys(
std::size_t globalIndex, const fill_sort_keys_payload& payload);
global_index_t globalIndex, const fill_sort_keys_payload& payload);

} // namespace traccc::device

// Include the implementation.
#include "./impl/fill_sort_keys.ipp"
28 changes: 19 additions & 9 deletions device/common/include/traccc/finding/device/find_tracks.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) 2023-2024 CERN for the benefit of the ACTS project
* (c) 2023-2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -14,12 +14,18 @@
#include "traccc/device/concepts/thread_id.hpp"
#include "traccc/edm/measurement.hpp"
#include "traccc/edm/track_parameters.hpp"
#include "traccc/edm/track_state.hpp"
#include "traccc/finding/candidate_link.hpp"
#include "traccc/finding/finding_config.hpp"
#include "traccc/fitting/kalman_filter/gain_matrix_updater.hpp"

// VecMem include(s).
#include <vecmem/containers/data/vector_view.hpp>

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

namespace traccc::device {

/// (Global Event Data) Payload for the @c traccc::device::find_tracks function
template <typename detector_t>
struct find_tracks_payload {
/**
Expand Down Expand Up @@ -48,7 +54,7 @@ struct find_tracks_payload {
/**
* @brief The total number of input parameters
*/
const unsigned int n_in_params;
unsigned int n_in_params;
stephenswat marked this conversation as resolved.
Show resolved Hide resolved

/**
* @brief View object to the vector of barcodes for each measurement
Expand All @@ -69,12 +75,12 @@ struct find_tracks_payload {
/**
* @brief The current step identifier
*/
const unsigned int step;
unsigned int step;

/**
* @brief The maximum number of new tracks to find
*/
const unsigned int n_max_candidates;
unsigned int n_max_candidates;

/**
* @brief View object to the output track parameter vector
Expand All @@ -98,6 +104,7 @@ struct find_tracks_payload {
unsigned int* n_total_candidates;
};

/// (Shared Event Data) Payload for the @c traccc::device::find_tracks function
struct find_tracks_shared_payload {
/**
* @brief Shared-memory vector with the number of measurements found per
Expand Down Expand Up @@ -129,12 +136,15 @@ struct find_tracks_shared_payload {
/// @param[in] cfg Track finding config object
/// @param[inout] payload The global memory payload
/// @param[inout] shared_payload The shared memory payload
template <concepts::thread_id1 thread_id_t, concepts::barrier barrier_t,
typename detector_t, typename config_t>
///
template <typename detector_t, concepts::thread_id1 thread_id_t,
concepts::barrier barrier_t>
TRACCC_DEVICE inline void find_tracks(
thread_id_t& thread_id, barrier_t& barrier, const config_t cfg,
thread_id_t& thread_id, barrier_t& barrier, const finding_config& cfg,
const find_tracks_payload<detector_t>& payload,
const find_tracks_shared_payload& shared_payload);

} // namespace traccc::device

// Include the implementation.
#include "./impl/find_tracks.ipp"
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2023 CERN for the benefit of the ACTS project
* (c) 2023-2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "detray/navigation/navigator.hpp"
#include "detray/propagator/actors/pointwise_material_interactor.hpp"
#include "traccc/definitions/qualifiers.hpp"
#include "traccc/finding/finding_config.hpp"
#include "traccc/utils/particle.hpp"

// Detray include(s).
#include <detray/navigation/navigator.hpp>
#include <detray/propagator/actors/pointwise_material_interactor.hpp>

namespace traccc::device {

template <typename detector_t>
TRACCC_DEVICE inline void apply_interaction(
std::size_t globalIndex, const finding_config& cfg,
const global_index_t globalIndex, const finding_config& cfg,
const apply_interaction_payload<detector_t>& payload) {

// Type definitions
Expand Down
24 changes: 8 additions & 16 deletions device/common/include/traccc/finding/device/impl/build_tracks.ipp
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2023 CERN for the benefit of the ACTS project
* (c) 2023-2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/definitions/qualifiers.hpp"
#include "traccc/edm/measurement.hpp"
#include "traccc/edm/track_candidate.hpp"
#include "traccc/edm/track_parameters.hpp"
#include "traccc/finding/candidate_link.hpp"

namespace traccc::device {

template <typename config_t>
TRACCC_DEVICE inline void build_tracks(std::size_t globalIndex,
const config_t cfg,
TRACCC_DEVICE inline void build_tracks(const global_index_t globalIndex,
const finding_config& cfg,
const build_tracks_payload& payload) {

measurement_collection_types::const_device measurements(
const measurement_collection_types::const_device measurements(
payload.measurements_view);

bound_track_parameters_collection_types::const_device seeds(
const bound_track_parameters_collection_types::const_device seeds(
payload.seeds_view);

vecmem::jagged_device_vector<const candidate_link> links(
const vecmem::jagged_device_vector<const candidate_link> links(
payload.links_view);

vecmem::device_vector<const typename candidate_link::link_index_type> tips(
payload.tips_view);
const vecmem::device_vector<const typename candidate_link::link_index_type>
tips(payload.tips_view);

track_candidate_container_types::device track_candidates(
payload.track_candidates_view);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2024 CERN for the benefit of the ACTS project
* (c) 2024-2025 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/edm/device/sort_key.hpp"
#include "traccc/edm/track_candidate.hpp"

namespace traccc::device {

TRACCC_HOST_DEVICE inline void fill_sort_keys(
std::size_t globalIndex, const fill_sort_keys_payload& payload) {
const global_index_t globalIndex, const fill_sort_keys_payload& payload) {

bound_track_parameters_collection_types::const_device params(
const bound_track_parameters_collection_types::const_device params(
payload.params_view);

// Keys
Expand All @@ -29,10 +25,8 @@ TRACCC_HOST_DEVICE inline void fill_sort_keys(
return;
}

keys_device.at(static_cast<unsigned int>(globalIndex)) =
device::get_sort_key(params.at(static_cast<unsigned int>(globalIndex)));
ids_device.at(static_cast<unsigned int>(globalIndex)) =
static_cast<unsigned int>(globalIndex);
keys_device.at(globalIndex) = device::get_sort_key(params.at(globalIndex));
ids_device.at(globalIndex) = globalIndex;
}

} // namespace traccc::device
Loading
Loading