Skip to content

Commit 4b8ea9f

Browse files
committed
making IAlg Traccc chain
1 parent 5feec70 commit 4b8ea9f

13 files changed

Lines changed: 742 additions & 397 deletions

File tree

Examples/Algorithms/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ add_subdirectory_if(GeneratorsPythia8 ACTS_BUILD_EXAMPLES_PYTHIA8)
66
add_subdirectory(MaterialMapping)
77
add_subdirectory(Printers)
88
add_subdirectory(Propagation)
9-
add_subdirectory_if(Traccc ACTS_BUILD_PLUGIN_TRACCC)
9+
add_subdirectory_if(Traccc ACTS_BUILD_PLUGIN_TRACCC AND ACTS_ENABLE_CUDA)
10+
add_subdirectory_if(Detray ACTS_BUILD_PLUGIN_DETRAY)
1011
add_subdirectory(TrackFinding)
1112
add_subdirectory_if(TrackFindingGnn ACTS_BUILD_EXAMPLES_GNN)
1213
add_subdirectory_if(TrackFindingML ACTS_BUILD_PLUGIN_ONNX)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
acts_add_library(ExamplesDetray INTERFACE)
2+
3+
target_include_directories(
4+
ActsExamplesDetray
5+
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
6+
)
7+
8+
target_link_libraries(
9+
ActsExamplesDetray
10+
INTERFACE
11+
Acts::ExamplesFramework
12+
Acts::ExamplesPropagation
13+
Acts::PluginDetray
14+
Acts::PluginCovfie
15+
)
16+
17+
acts_compile_headers(ExamplesDetray GLOB "include/**/*.hpp")

Examples/Algorithms/Traccc/include/ActsExamples/Traccc/DetrayPropagator.hpp renamed to Examples/Algorithms/Detray/include/Detray/DetrayPropagator.hpp

File renamed without changes.

Examples/Algorithms/Traccc/include/ActsExamples/Traccc/DetrayStore.hpp renamed to Examples/Algorithms/Detray/include/Detray/DetrayStore.hpp

File renamed without changes.

Examples/Algorithms/Traccc/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
acts_add_library(ExamplesTraccc INTERFACE)
1+
acts_add_library(ExamplesTraccc
2+
src/TracccChain.cpp
3+
src/TracccSeqAlg.cpp
4+
)
25

36
target_include_directories(
47
ActsExamplesTraccc
5-
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
8+
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
69
)
710

811
target_link_libraries(
912
ActsExamplesTraccc
10-
INTERFACE
13+
PUBLIC
1114
Acts::ExamplesFramework
1215
Acts::ExamplesPropagation
1316
Acts::PluginDetray
1417
Acts::PluginCovfie
1518
traccc::io
1619
traccc::core
1720
$<$<BOOL:${ACTS_ENABLE_CUDA}>:traccc::cuda>
21+
$<$<BOOL:${ACTS_ENABLE_CUDA}>:traccc::device_common>
1822
$<$<BOOL:${ACTS_ENABLE_CUDA}>:vecmem::cuda>
1923
)
2024

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
// This file is part of the ACTS project.
2+
//
3+
// Copyright (C) 2016 CERN for the benefit of the ACTS project
4+
//
5+
// This Source Code Form is subject to the terms of the Mozilla Public
6+
// License, v. 2.0. If a copy of the MPL was not distributed with this
7+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8+
9+
#pragma once
10+
11+
#include <memory>
12+
#include <string>
13+
14+
#include <vecmem/memory/cuda/device_memory_resource.hpp>
15+
#include <vecmem/memory/cuda/host_memory_resource.hpp>
16+
#include <vecmem/memory/host_memory_resource.hpp>
17+
#include <vecmem/utils/cuda/async_copy.hpp>
18+
#include <vecmem/utils/copy.hpp>
19+
20+
#include "traccc/ambiguity_resolution/greedy_ambiguity_resolution_algorithm.hpp"
21+
#include "traccc/clusterization/clustering_config.hpp"
22+
#include "traccc/cuda/ambiguity_resolution/greedy_ambiguity_resolution_algorithm.hpp"
23+
#include "traccc/cuda/clusterization/clusterization_algorithm.hpp"
24+
#include "traccc/cuda/clusterization/measurement_sorting_algorithm.hpp"
25+
#include "traccc/cuda/finding/combinatorial_kalman_filter_algorithm.hpp"
26+
#include "traccc/cuda/fitting/kalman_fitting_algorithm.hpp"
27+
#include "traccc/cuda/seeding/seed_parameter_estimation_algorithm.hpp"
28+
#include "traccc/cuda/seeding/silicon_pixel_spacepoint_formation_algorithm.hpp"
29+
#include "traccc/cuda/seeding/triplet_seeding_algorithm.hpp"
30+
#include "traccc/cuda/utils/make_magnetic_field.hpp"
31+
#include "traccc/cuda/utils/stream.hpp"
32+
#include "traccc/device/container_d2h_copy_alg.hpp"
33+
#include "traccc/edm/silicon_cell_collection.hpp"
34+
#include "traccc/edm/track_collection.hpp"
35+
#include "traccc/edm/track_parameters.hpp"
36+
#include "traccc/geometry/detector.hpp"
37+
#include "traccc/geometry/detector_buffer.hpp"
38+
#include "traccc/geometry/detector_conditions_description.hpp"
39+
#include "traccc/geometry/detector_design_description.hpp"
40+
#include "traccc/geometry/host_detector.hpp"
41+
#include "traccc/io/read_cells.hpp"
42+
#include "traccc/io/read_detector.hpp"
43+
#include "traccc/io/read_detector_description.hpp"
44+
#include "traccc/io/read_magnetic_field.hpp"
45+
#include "traccc/seeding/detail/seeding_config.hpp"
46+
#include "traccc/seeding/detail/track_params_estimation_config.hpp"
47+
#include "traccc/utils/propagation.hpp"
48+
49+
namespace ActsExamples {
50+
51+
/// Holds all GPU/host objects that must outlive the per-event calls.
52+
/// Constructed once at algorithm initialisation, reused for every event.
53+
struct TracccChain {
54+
vecmem::host_memory_resource host_mr;
55+
vecmem::cuda::host_memory_resource cuda_host_mr;
56+
vecmem::cuda::device_memory_resource device_mr;
57+
traccc::memory_resource mr;
58+
traccc::cuda::stream stream;
59+
vecmem::cuda::async_copy copy;
60+
vecmem::copy host_copy;
61+
62+
traccc::detector_design_description::host host_det_descr;
63+
traccc::detector_conditions_description::host host_det_cond;
64+
65+
traccc::detector_design_description::buffer device_det_descr;
66+
traccc::detector_conditions_description::buffer device_det_cond;
67+
68+
traccc::host_detector host_detector;
69+
traccc::detector_buffer device_detector;
70+
71+
traccc::magnetic_field host_field;
72+
traccc::magnetic_field device_field;
73+
74+
traccc::seedfinder_config seedfinder_cfg;
75+
traccc::seedfilter_config seedfilter_cfg;
76+
traccc::spacepoint_grid_config spacepoint_grid_cfg;
77+
traccc::track_params_estimation_config track_params_cfg;
78+
traccc::finding_config finding_cfg;
79+
traccc::fitting_config fitting_cfg;
80+
traccc::host::greedy_ambiguity_resolution_algorithm::config_type
81+
resolution_cfg;
82+
83+
traccc::cuda::clusterization_algorithm ca_cuda;
84+
traccc::cuda::measurement_sorting_algorithm ms_cuda;
85+
traccc::cuda::silicon_pixel_spacepoint_formation_algorithm sf_cuda;
86+
traccc::cuda::triplet_seeding_algorithm sa_cuda;
87+
traccc::cuda::seed_parameter_estimation_algorithm tp_cuda;
88+
traccc::cuda::combinatorial_kalman_filter_algorithm finding_cuda;
89+
traccc::cuda::greedy_ambiguity_resolution_algorithm resolution_cuda;
90+
traccc::cuda::kalman_fitting_algorithm fitting_cuda;
91+
92+
TracccChain(const std::string& detector_file,
93+
const std::string& digitization_file,
94+
const std::string& conditions_file,
95+
const std::string& material_file,
96+
const std::string& grid_file,
97+
const std::string& bfield_file);
98+
};
99+
100+
/// Per-event output counters.
101+
struct EventResult {
102+
std::size_t n_cells = 0;
103+
std::size_t n_measurements = 0;
104+
std::size_t n_spacepoints = 0;
105+
std::size_t n_seeds = 0;
106+
std::size_t n_found_tracks = 0;
107+
std::size_t n_resolved_tracks = 0;
108+
std::size_t n_fitted_tracks = 0;
109+
};
110+
111+
EventResult processEvent(std::shared_ptr<TracccChain> chain,
112+
const std::string& data_directory,
113+
std::size_t event_id);
114+
115+
} // namespace ActsExamples
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// This file is part of the ACTS project.
2+
//
3+
// Copyright (C) 2016 CERN for the benefit of the ACTS project
4+
//
5+
// This Source Code Form is subject to the terms of the Mozilla Public
6+
// License, v. 2.0. If a copy of the MPL was not distributed with this
7+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8+
9+
#pragma once
10+
11+
#include "Acts/Utilities/Logger.hpp"
12+
#include "ActsExamples/Framework/IAlgorithm.hpp"
13+
#include "ActsExamples/Framework/ProcessCode.hpp"
14+
15+
#include <memory>
16+
#include <string>
17+
18+
// Forward-declare to keep CUDA/traccc headers out of this header.
19+
namespace ActsExamples {
20+
struct TracccChain;
21+
}
22+
23+
namespace ActsExamples {
24+
25+
class TracccSeqAlgorithm final : public IAlgorithm {
26+
public:
27+
struct Config {
28+
/// Path to the detector geometry file
29+
std::string detectorFile;
30+
/// Path to the digitization config file
31+
std::string digitizationFile;
32+
/// Path to the detector conditions file (optional)
33+
std::string conditionsFile;
34+
/// Path to the material file (optional)
35+
std::string materialFile;
36+
/// Path to the grid file (optional)
37+
std::string gridFile;
38+
/// Path to the magnetic field file
39+
std::string bfieldFile;
40+
/// Directory containing per-event cell CSV files
41+
std::string dataDirectory;
42+
};
43+
44+
explicit TracccSeqAlgorithm(
45+
const Config& cfg,
46+
std::unique_ptr<const Acts::Logger> logger = nullptr);
47+
48+
ProcessCode execute(const AlgorithmContext& ctx) const override;
49+
ProcessCode finalize() override;
50+
51+
const Config& config() const { return m_cfg; }
52+
53+
private:
54+
Config m_cfg;
55+
std::shared_ptr<TracccChain> m_chain;
56+
};
57+
58+
} // namespace ActsExamples

0 commit comments

Comments
 (0)