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
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,25 @@ if( TRACCC_SETUP_INDICATORS )
endif()
endif()

# Set up stdexec.
option( TRACCC_SETUP_STDEXEC
"Set up the stdexec target(s) explicitly" TRUE )
if (TRACCC_USE_SYSTEM_LIBS OR TRACCC_USE_SPACK_LIBS)
set(TRACCC_USE_SYSTEM_STDEXEC_DEFAULT ON)
else()
set(TRACCC_USE_SYSTEM_STDEXEC_DEFAULT OFF)
endif()
option( TRACCC_USE_SYSTEM_STDEXEC
"Pick up an existing installation of stdexec from the build environment"
${TRACCC_USE_SYSTEM_STDEXEC_DEFAULT} )
unset(TRACCC_USE_SYSTEM_STDEXEC_DEFAULT)
if( TRACCC_SETUP_STDEXEC )
if( TRACCC_USE_SYSTEM_STDEXEC )
find_package( stdexec REQUIRED )
else()
add_subdirectory( extern/stdexec )
endif()
endif()

option( TRACCC_ENABLE_NVTX_PROFILING
"Use instrument functions to enable fine grained profiling" FALSE )
Expand Down
4 changes: 3 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ traccc_add_library( traccc_core core TYPE SHARED
"include/traccc/utils/logging.hpp"
"include/traccc/utils/prob.hpp"
"src/utils/logging.cpp"
# Execution.
"include/traccc/execution/task.hpp"
# Clusterization algorithmic code.
"include/traccc/clusterization/details/sparse_ccl.hpp"
"include/traccc/clusterization/impl/sparse_ccl.ipp"
Expand Down Expand Up @@ -138,7 +140,7 @@ traccc_add_library( traccc_core core TYPE SHARED
"src/ambiguity_resolution/legacy/greedy_ambiguity_resolution_algorithm.cpp")
target_link_libraries( traccc_core
PUBLIC Eigen3::Eigen vecmem::core covfie::core detray::core detray::detectors
traccc::algebra Acts::Core )
traccc::algebra Acts::Core STDEXEC::stdexec )

# Prevent Eigen from getting confused when building code for a
# CUDA or HIP backend with SYCL.
Expand Down
10 changes: 10 additions & 0 deletions core/include/traccc/execution/task.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

// Stdexec include(s).
#include <exec/task.hpp>

namespace traccc {

template <typename T>
using task = exec::task<T>;
}
4 changes: 4 additions & 0 deletions device/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ traccc_add_library( traccc_device_common device_common
"include/traccc/clusterization/device/ccl_kernel.hpp"
"include/traccc/clusterization/device/sorting_index_filler.hpp"
"include/traccc/clusterization/device/clusterization_algorithm.hpp"
"include/traccc/clusterization/device/clusterization_kernel_payload.hpp"
"src/clusterization/clusterization_algorithm.cpp"
# Spacepoint binning function(s).
"include/traccc/seeding/device/count_grid_capacities.hpp"
Expand All @@ -60,10 +61,13 @@ traccc_add_library( traccc_device_common device_common
"include/traccc/seeding/device/select_seeds.hpp"
"include/traccc/seeding/device/impl/select_seeds.ipp"
"include/traccc/seeding/device/triplet_seeding_algorithm.hpp"
"include/traccc/seeding/device/triplet_seeding_kernel_payloads.hpp"
"src/seeding/triplet_seeding_algorithm.cpp"
"include/traccc/seeding/device/silicon_pixel_spacepoint_formation_algorithm.hpp"
"include/traccc/seeding/device/silicon_pixel_spacepoint_formation_kernel_payload.hpp"
"src/seeding/silicon_pixel_spacepoint_formation_algorithm.cpp"
"include/traccc/seeding/device/seed_parameter_estimation_algorithm.hpp"
"include/traccc/seeding/device/seed_parameter_estimation_kernel_payload.hpp"
"src/seeding/seed_parameter_estimation_algorithm.cpp"
# Track parameters estimation function(s).
"include/traccc/seeding/device/estimate_track_params.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

// Local include(s).
#include "traccc/clusterization/device/ccl_kernel_definitions.hpp"
#include "traccc/clusterization/device/clusterization_kernel_payload.hpp"
#include "traccc/clusterization/device/tags.hpp"
#include "traccc/device/algorithm_base.hpp"
#include "traccc/execution/task.hpp"

// Project include(s).
#include "traccc/clusterization/clustering_config.hpp"
Expand Down Expand Up @@ -41,16 +43,18 @@ namespace traccc::device {
/// synchronisation statement is required before destroying the buffer.
///
class clusterization_algorithm
: public algorithm<edm::measurement_collection<default_algebra>::buffer(
const edm::silicon_cell_collection::const_view&,
const silicon_detector_description::const_view&)>,
public algorithm<edm::measurement_collection<default_algebra>::buffer(
const edm::silicon_cell_collection::const_view&,
const silicon_detector_description::const_view&,
clustering_discard_disjoint_set&&)>,
: public algorithm<
task<edm::measurement_collection<default_algebra>::buffer>(
const edm::silicon_cell_collection::const_view&,
const silicon_detector_description::const_view&)>,
public algorithm<
task<edm::measurement_collection<default_algebra>::buffer>(
const edm::silicon_cell_collection::const_view&,
const silicon_detector_description::const_view&,
clustering_discard_disjoint_set&&)>,
public algorithm<
std::pair<edm::measurement_collection<default_algebra>::buffer,
edm::silicon_cluster_collection::buffer>(
task<std::pair<edm::measurement_collection<default_algebra>::buffer,
edm::silicon_cluster_collection::buffer>>(
const edm::silicon_cell_collection::const_view&,
const silicon_detector_description::const_view&,
clustering_keep_disjoint_set&&)>,
Expand Down Expand Up @@ -81,18 +85,18 @@ class clusterization_algorithm
/// @return a measurement collection (buffer)
///
/// @{
edm::measurement_collection<default_algebra>::buffer operator()(
task<edm::measurement_collection<default_algebra>::buffer> operator()(
const edm::silicon_cell_collection::const_view& cells,
const silicon_detector_description::const_view& det_descr)
const override;

edm::measurement_collection<default_algebra>::buffer operator()(
task<edm::measurement_collection<default_algebra>::buffer> operator()(
const edm::silicon_cell_collection::const_view& cells,
const silicon_detector_description::const_view& det_descr,
clustering_discard_disjoint_set&&) const override;

std::pair<edm::measurement_collection<default_algebra>::buffer,
edm::silicon_cluster_collection::buffer>
task<std::pair<edm::measurement_collection<default_algebra>::buffer,
edm::silicon_cluster_collection::buffer>>
operator()(const edm::silicon_cell_collection::const_view& cells,
const silicon_detector_description::const_view& det_descr,
clustering_keep_disjoint_set&&) const override;
Expand All @@ -111,34 +115,7 @@ class clusterization_algorithm
const edm::silicon_cell_collection::const_view& cells) const = 0;

/// Payload for the @c ccl_kernel function
struct ccl_kernel_payload {
/// Number of cells in the event
unsigned int n_cells;
/// The clustering configuration
const config_type& config;
/// All cells in an event
const edm::silicon_cell_collection::const_view& cells;
/// The detector description
const silicon_detector_description::const_view& det_descr;
/// The measurement collection to fill
edm::measurement_collection<default_algebra>::view& measurements;
/// Buffer for linking cells to measurements
vecmem::data::vector_view<unsigned int>& cell_links;
/// Buffer for backup of the first element links
vecmem::data::vector_view<details::index_t>& f_backup;
/// Buffer for backup of the group first element links
vecmem::data::vector_view<details::index_t>& gf_backup;
/// Buffer for backup of the adjacency matrix (counts)
vecmem::data::vector_view<unsigned char>& adjc_backup;
/// Buffer for backup of the adjacency matrix (values)
vecmem::data::vector_view<details::index_t>& adjv_backup;
/// Mutex for the backup structures
unsigned int* backup_mutex;
/// Buffer for the disjoint set data structure
vecmem::data::vector_view<unsigned int>& disjoint_set;
/// Buffer for the sizes of the clusters
vecmem::data::vector_view<unsigned int>& cluster_sizes;
};
using ccl_kernel_payload = clusterization_ccl_kernel_payload;

/// Main CCL kernel launcher
///
Expand All @@ -159,13 +136,13 @@ class clusterization_algorithm

/// @}

/// Possibly suspend execution until all asynchronous operations are done
virtual void await(vecmem::abstract_event& event) const = 0;
/// Suspend execution until all asynchronous operations are done
virtual task<void> await(vecmem::abstract_event& event) const = 0;

private:
/// Main algorithmic implementation of the clusterization algorithm
std::pair<edm::measurement_collection<default_algebra>::buffer,
std::optional<edm::silicon_cluster_collection::buffer>>
task<std::pair<edm::measurement_collection<default_algebra>::buffer,
std::optional<edm::silicon_cluster_collection::buffer>>>
execute_impl(const edm::silicon_cell_collection::const_view& cells,
const silicon_detector_description::const_view& det_descr,
bool keep_disjoint_set) const;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2022-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/clusterization/clustering_config.hpp"
#include "traccc/clusterization/device/ccl_kernel_definitions.hpp"
#include "traccc/edm/measurement_collection.hpp"
#include "traccc/edm/silicon_cell_collection.hpp"
#include "traccc/geometry/silicon_detector_description.hpp"

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

namespace traccc::device {

/// Payload for the @c traccc::device::clusterization_algorithm::ccl_kernel
/// function.
struct clusterization_ccl_kernel_payload {
/// Number of cells in the event
unsigned int n_cells;
/// The clustering configuration
const clustering_config& config;
/// All cells in an event
const edm::silicon_cell_collection::const_view& cells;
/// The detector description
const silicon_detector_description::const_view& det_descr;
/// The measurement collection to fill
edm::measurement_collection<default_algebra>::view& measurements;
/// Buffer for linking cells to measurements
vecmem::data::vector_view<unsigned int>& cell_links;
/// Buffer for backup of the first element links
vecmem::data::vector_view<details::index_t>& f_backup;
/// Buffer for backup of the group first element links
vecmem::data::vector_view<details::index_t>& gf_backup;
/// Buffer for backup of the adjacency matrix (counts)
vecmem::data::vector_view<unsigned char>& adjc_backup;
/// Buffer for backup of the adjacency matrix (values)
vecmem::data::vector_view<details::index_t>& adjv_backup;
/// Mutex for the backup structures
unsigned int* backup_mutex;
/// Buffer for the disjoint set data structure
vecmem::data::vector_view<unsigned int>& disjoint_set;
/// Buffer for the sizes of the clusters
vecmem::data::vector_view<unsigned int>& cluster_sizes;
};

} // namespace traccc::device
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

// Local include(s).
#include "traccc/device/algorithm_base.hpp"
#include "traccc/execution/task.hpp"
#include "traccc/seeding/device/seed_parameter_estimation_kernel_payload.hpp"

// Project include(s)
#include "traccc/bfield/magnetic_field.hpp"
Expand All @@ -29,7 +31,7 @@ namespace traccc::device {
/// synchronisation statement is required before destroying this buffer.
///
struct seed_parameter_estimation_algorithm
: public algorithm<bound_track_parameters_collection_types::buffer(
: public algorithm<task<bound_track_parameters_collection_types::buffer>(
const magnetic_field&,
const edm::measurement_collection<default_algebra>::const_view&,
const edm::spacepoint_collection::const_view&,
Expand Down Expand Up @@ -59,7 +61,8 @@ struct seed_parameter_estimation_algorithm
/// @param measurements All measurements of the event
/// @param spacepoints All spacepoints of the event
/// @param seeds The reconstructed track seeds of the event
/// @return A vector of bound track parameters for the seeds
/// @return A task returning a vector of bound track parameters for the
/// seeds
///
output_type operator()(
const magnetic_field& bfield,
Expand All @@ -73,35 +76,20 @@ struct seed_parameter_estimation_algorithm
/// @{

/// Payload for the @c estimate_seed_params_kernel function
struct estimate_seed_params_kernel_payload {
/// The number of seeds
edm::seed_collection::const_view::size_type n_seeds;
/// The track parameter estimation configuration
const track_params_estimation_config& config;
/// The magnetic field object
const magnetic_field& bfield;
/// All measurements of the event
const edm::measurement_collection<default_algebra>::const_view&
measurements;
/// All spacepoints of the event
const edm::spacepoint_collection::const_view& spacepoints;
/// The reconstructed track seeds of the event
const edm::seed_collection::const_view& seeds;
/// The output buffer for the bound track parameters
bound_track_parameters_collection_types::view& params;
};
using estimate_seed_params_kernel_payload =
struct traccc::device::estimate_seed_params_kernel_payload;

/// Seed parameter estimation kernel launcher
///
/// @param payload The payload for the kernel
///
virtual void estimate_seed_params_kernel(
const struct estimate_seed_params_kernel_payload& payload) const = 0;
const estimate_seed_params_kernel_payload& payload) const = 0;

/// @}

/// Possibly suspend execution until all asynchronous operations are done
virtual void await(vecmem::abstract_event& event) const = 0;
/// Suspend execution until all asynchronous operations are done
virtual task<void> await(vecmem::abstract_event& event) const = 0;

private:
/// Internal data type
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2026 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s)
#include "traccc/bfield/magnetic_field.hpp"
#include "traccc/edm/measurement_collection.hpp"
#include "traccc/edm/seed_collection.hpp"
#include "traccc/edm/spacepoint_collection.hpp"
#include "traccc/edm/track_parameters.hpp"
#include "traccc/seeding/detail/track_params_estimation_config.hpp"

namespace traccc::device {

/// Payload for the
/// @c seed_parameter_estimation_algorithm::estimate_seed_params_kernel function
struct estimate_seed_params_kernel_payload {
/// The number of seeds
edm::seed_collection::const_view::size_type n_seeds;
/// The track parameter estimation configuration
const track_params_estimation_config& config;
/// The magnetic field object
const magnetic_field& bfield;
/// All measurements of the event
const edm::measurement_collection<default_algebra>::const_view&
measurements;
/// All spacepoints of the event
const edm::spacepoint_collection::const_view& spacepoints;
/// The reconstructed track seeds of the event
const edm::seed_collection::const_view& seeds;
/// The output buffer for the bound track parameters
bound_track_parameters_collection_types::view& params;
};

} // namespace traccc::device
Loading