Skip to content

Commit 43d3f65

Browse files
authored
Track Finding Cleanup, main branch (2025.01.07.) (#808)
* Common sense cleanup in the device track finding. Introduced the globalIndex_t typedef for the unsigned int type. Switched all track finding functions to using it instead of std::size_t. Removed all unnecessary templating from functions that were never updated after the track finding configuration became a simple standalone struct. Removed some unnecessary const declarations from the payload structs, and added some extra const declarations in some of the function bodies. * CUDA updates for the common track finding changes. * Reduce the number of parallel tests in GitLab CI. Running too many CUDA tests in parallel requires a *lot* of memory. This will hopefully make the tests a bit more reliable. * globalIndex_t -> global_index_t
1 parent dab51f1 commit 43d3f65

19 files changed

+177
-126
lines changed

.gitlab-ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TRACCC library, part of the ACTS project (R&D line)
22
#
3-
# (c) 2022-2024 CERN for the benefit of the ACTS project
3+
# (c) 2022-2025 CERN for the benefit of the ACTS project
44
#
55
# Mozilla Public License Version 2.0
66

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

1920
# Build job template.
2021
.build_template: &build_job
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* traccc library, part of the ACTS project (R&D line)
3+
*
4+
* (c) 2025 CERN for the benefit of the ACTS project
5+
*
6+
* Mozilla Public License Version 2.0
7+
*/
8+
9+
#pragma once
10+
11+
namespace traccc::device {
12+
13+
/// Type for passing "global indices" to device functions
14+
using global_index_t = unsigned int;
15+
16+
} // namespace traccc::device

device/common/include/traccc/finding/device/apply_interaction.hpp

+17-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
/** TRACCC library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2023 CERN for the benefit of the ACTS project
3+
* (c) 2023-2025 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
77

88
#pragma once
99

10+
// Local include(s).
11+
#include "traccc/device/global_index.hpp"
12+
1013
// Project include(s).
11-
#include "detray/navigation/navigator.hpp"
12-
#include "detray/propagator/actors/pointwise_material_interactor.hpp"
1314
#include "traccc/definitions/qualifiers.hpp"
15+
#include "traccc/edm/track_parameters.hpp"
1416
#include "traccc/finding/finding_config.hpp"
15-
#include "traccc/utils/particle.hpp"
17+
18+
// VecMem include(s).
19+
#include <vecmem/containers/data/vector_view.hpp>
1620

1721
namespace traccc::device {
22+
23+
/// (Event Data) Payload for the @c traccc::device::apply_interaction function
1824
template <typename detector_t>
1925
struct apply_interaction_payload {
2026
/**
@@ -25,7 +31,7 @@ struct apply_interaction_payload {
2531
/**
2632
* @brief Total number of input parameters (including non-live ones)
2733
*/
28-
const int n_params;
34+
unsigned int n_params;
2935

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

42-
/// Function applying the Pre material interaction to tracks spawned by bound
43-
/// track parameters
48+
/// Function applying the material interaction to tracks spawned described by
49+
/// bound track parameters
4450
///
4551
/// @param[in] globalIndex The index of the current thread
4652
/// @param[in] cfg Track finding config object
4753
/// @param[inout] payload The function call payload
54+
///
4855
template <typename detector_t>
4956
TRACCC_DEVICE inline void apply_interaction(
50-
std::size_t globalIndex, const finding_config& cfg,
57+
global_index_t globalIndex, const finding_config& cfg,
5158
const apply_interaction_payload<detector_t>& payload);
59+
5260
} // namespace traccc::device
5361

62+
// Include the implementation.
5463
#include "./impl/apply_interaction.ipp"

device/common/include/traccc/finding/device/build_tracks.hpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
/** TRACCC library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2023 CERN for the benefit of the ACTS project
3+
* (c) 2023-2024 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
77

88
#pragma once
99

10+
// Local include(s).
11+
#include "traccc/device/global_index.hpp"
12+
1013
// Project include(s).
1114
#include "traccc/definitions/qualifiers.hpp"
1215
#include "traccc/edm/measurement.hpp"
1316
#include "traccc/edm/track_candidate.hpp"
1417
#include "traccc/edm/track_parameters.hpp"
1518
#include "traccc/finding/candidate_link.hpp"
19+
#include "traccc/finding/finding_config.hpp"
20+
21+
// VecMem include(s).
22+
#include <vecmem/containers/data/jagged_vector_view.hpp>
23+
#include <vecmem/containers/data/vector_view.hpp>
1624

1725
namespace traccc::device {
26+
27+
/// (Event Data) Payload for the @c traccc::device::build_tracks function
1828
struct build_tracks_payload {
1929
/**
2030
* @brief View object to the vector of measurements
@@ -64,11 +74,12 @@ struct build_tracks_payload {
6474
/// @param[in] globalIndex The index of the current thread
6575
/// @param[in] cfg Track finding config object
6676
/// @param[inout] payload The function call payload
67-
template <typename config_t>
68-
TRACCC_DEVICE inline void build_tracks(std::size_t globalIndex,
69-
const config_t cfg,
77+
///
78+
TRACCC_DEVICE inline void build_tracks(global_index_t globalIndex,
79+
const finding_config& cfg,
7080
const build_tracks_payload& payload);
7181

7282
} // namespace traccc::device
7383

84+
// Include the implementation.
7485
#include "./impl/build_tracks.ipp"

device/common/include/traccc/finding/device/fill_sort_keys.hpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
/** TRACCC library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2024 CERN for the benefit of the ACTS project
3+
* (c) 2024-2025 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
77

88
#pragma once
99

10+
// Local include(s).
11+
#include "traccc/device/global_index.hpp"
12+
1013
// Project include(s).
1114
#include "traccc/edm/device/sort_key.hpp"
12-
#include "traccc/edm/track_candidate.hpp"
15+
#include "traccc/edm/track_parameters.hpp"
16+
17+
// VecMem include(s).
18+
#include <vecmem/containers/data/vector_view.hpp>
1319

1420
namespace traccc::device {
21+
22+
/// (Event Data) Payload for the @c traccc::device::fill_sort_keys function
1523
struct fill_sort_keys_payload {
1624
/**
1725
* @brief View object to the vector of bound track parameters
@@ -34,8 +42,11 @@ struct fill_sort_keys_payload {
3442
///
3543
/// @param[in] globalIndex The index of the current thread
3644
/// @param[inout] payload The function call payload
45+
///
3746
TRACCC_HOST_DEVICE inline void fill_sort_keys(
38-
std::size_t globalIndex, const fill_sort_keys_payload& payload);
47+
global_index_t globalIndex, const fill_sort_keys_payload& payload);
48+
3949
} // namespace traccc::device
4050

51+
// Include the implementation.
4152
#include "./impl/fill_sort_keys.ipp"

device/common/include/traccc/finding/device/find_tracks.hpp

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** TRACCC library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2023-2024 CERN for the benefit of the ACTS project
3+
* (c) 2023-2025 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
@@ -14,12 +14,18 @@
1414
#include "traccc/device/concepts/thread_id.hpp"
1515
#include "traccc/edm/measurement.hpp"
1616
#include "traccc/edm/track_parameters.hpp"
17-
#include "traccc/edm/track_state.hpp"
1817
#include "traccc/finding/candidate_link.hpp"
1918
#include "traccc/finding/finding_config.hpp"
20-
#include "traccc/fitting/kalman_filter/gain_matrix_updater.hpp"
19+
20+
// VecMem include(s).
21+
#include <vecmem/containers/data/vector_view.hpp>
22+
23+
// System include(s).
24+
#include <utility>
2125

2226
namespace traccc::device {
27+
28+
/// (Global Event Data) Payload for the @c traccc::device::find_tracks function
2329
template <typename detector_t>
2430
struct find_tracks_payload {
2531
/**
@@ -48,7 +54,7 @@ struct find_tracks_payload {
4854
/**
4955
* @brief The total number of input parameters
5056
*/
51-
const unsigned int n_in_params;
57+
unsigned int n_in_params;
5258

5359
/**
5460
* @brief View object to the vector of barcodes for each measurement
@@ -69,12 +75,12 @@ struct find_tracks_payload {
6975
/**
7076
* @brief The current step identifier
7177
*/
72-
const unsigned int step;
78+
unsigned int step;
7379

7480
/**
7581
* @brief The maximum number of new tracks to find
7682
*/
77-
const unsigned int n_max_candidates;
83+
unsigned int n_max_candidates;
7884

7985
/**
8086
* @brief View object to the output track parameter vector
@@ -98,6 +104,7 @@ struct find_tracks_payload {
98104
unsigned int* n_total_candidates;
99105
};
100106

107+
/// (Shared Event Data) Payload for the @c traccc::device::find_tracks function
101108
struct find_tracks_shared_payload {
102109
/**
103110
* @brief Shared-memory vector with the number of measurements found per
@@ -129,12 +136,15 @@ struct find_tracks_shared_payload {
129136
/// @param[in] cfg Track finding config object
130137
/// @param[inout] payload The global memory payload
131138
/// @param[inout] shared_payload The shared memory payload
132-
template <concepts::thread_id1 thread_id_t, concepts::barrier barrier_t,
133-
typename detector_t, typename config_t>
139+
///
140+
template <typename detector_t, concepts::thread_id1 thread_id_t,
141+
concepts::barrier barrier_t>
134142
TRACCC_DEVICE inline void find_tracks(
135-
thread_id_t& thread_id, barrier_t& barrier, const config_t cfg,
143+
thread_id_t& thread_id, barrier_t& barrier, const finding_config& cfg,
136144
const find_tracks_payload<detector_t>& payload,
137145
const find_tracks_shared_payload& shared_payload);
146+
138147
} // namespace traccc::device
139148

149+
// Include the implementation.
140150
#include "./impl/find_tracks.ipp"

device/common/include/traccc/finding/device/impl/apply_interaction.ipp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
/** TRACCC library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2023 CERN for the benefit of the ACTS project
3+
* (c) 2023-2025 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
77

88
#pragma once
99

1010
// Project include(s).
11-
#include "detray/navigation/navigator.hpp"
12-
#include "detray/propagator/actors/pointwise_material_interactor.hpp"
13-
#include "traccc/definitions/qualifiers.hpp"
14-
#include "traccc/finding/finding_config.hpp"
1511
#include "traccc/utils/particle.hpp"
1612

13+
// Detray include(s).
14+
#include <detray/navigation/navigator.hpp>
15+
#include <detray/propagator/actors/pointwise_material_interactor.hpp>
16+
1717
namespace traccc::device {
1818

1919
template <typename detector_t>
2020
TRACCC_DEVICE inline void apply_interaction(
21-
std::size_t globalIndex, const finding_config& cfg,
21+
const global_index_t globalIndex, const finding_config& cfg,
2222
const apply_interaction_payload<detector_t>& payload) {
2323

2424
// Type definitions

device/common/include/traccc/finding/device/impl/build_tracks.ipp

+8-16
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,29 @@
11
/** TRACCC library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2023 CERN for the benefit of the ACTS project
3+
* (c) 2023-2025 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
77

88
#pragma once
99

10-
// Project include(s).
11-
#include "traccc/definitions/qualifiers.hpp"
12-
#include "traccc/edm/measurement.hpp"
13-
#include "traccc/edm/track_candidate.hpp"
14-
#include "traccc/edm/track_parameters.hpp"
15-
#include "traccc/finding/candidate_link.hpp"
16-
1710
namespace traccc::device {
1811

19-
template <typename config_t>
20-
TRACCC_DEVICE inline void build_tracks(std::size_t globalIndex,
21-
const config_t cfg,
12+
TRACCC_DEVICE inline void build_tracks(const global_index_t globalIndex,
13+
const finding_config& cfg,
2214
const build_tracks_payload& payload) {
2315

24-
measurement_collection_types::const_device measurements(
16+
const measurement_collection_types::const_device measurements(
2517
payload.measurements_view);
2618

27-
bound_track_parameters_collection_types::const_device seeds(
19+
const bound_track_parameters_collection_types::const_device seeds(
2820
payload.seeds_view);
2921

30-
vecmem::jagged_device_vector<const candidate_link> links(
22+
const vecmem::jagged_device_vector<const candidate_link> links(
3123
payload.links_view);
3224

33-
vecmem::device_vector<const typename candidate_link::link_index_type> tips(
34-
payload.tips_view);
25+
const vecmem::device_vector<const typename candidate_link::link_index_type>
26+
tips(payload.tips_view);
3527

3628
track_candidate_container_types::device track_candidates(
3729
payload.track_candidates_view);
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
/** TRACCC library, part of the ACTS project (R&D line)
22
*
3-
* (c) 2024 CERN for the benefit of the ACTS project
3+
* (c) 2024-2025 CERN for the benefit of the ACTS project
44
*
55
* Mozilla Public License Version 2.0
66
*/
77

88
#pragma once
99

10-
// Project include(s).
11-
#include "traccc/edm/device/sort_key.hpp"
12-
#include "traccc/edm/track_candidate.hpp"
13-
1410
namespace traccc::device {
1511

1612
TRACCC_HOST_DEVICE inline void fill_sort_keys(
17-
std::size_t globalIndex, const fill_sort_keys_payload& payload) {
13+
const global_index_t globalIndex, const fill_sort_keys_payload& payload) {
1814

19-
bound_track_parameters_collection_types::const_device params(
15+
const bound_track_parameters_collection_types::const_device params(
2016
payload.params_view);
2117

2218
// Keys
@@ -29,10 +25,8 @@ TRACCC_HOST_DEVICE inline void fill_sort_keys(
2925
return;
3026
}
3127

32-
keys_device.at(static_cast<unsigned int>(globalIndex)) =
33-
device::get_sort_key(params.at(static_cast<unsigned int>(globalIndex)));
34-
ids_device.at(static_cast<unsigned int>(globalIndex)) =
35-
static_cast<unsigned int>(globalIndex);
28+
keys_device.at(globalIndex) = device::get_sort_key(params.at(globalIndex));
29+
ids_device.at(globalIndex) = globalIndex;
3630
}
3731

3832
} // namespace traccc::device

0 commit comments

Comments
 (0)