From f3c0e1370ab6f85ee7dc490d553449fa5826661a Mon Sep 17 00:00:00 2001 From: Stephen Nicholas Swatman Date: Tue, 25 Jun 2024 16:37:03 +0200 Subject: [PATCH] UpdatE --- core/include/traccc/edm/spacepoint.hpp | 2 + device/cuda/CMakeLists.txt | 1 - .../cuda/seeding2/kernels/kd_tree_kernel.hpp | 7 +- .../seeding2/kernels/seed_finding_kernel.hpp | 10 +- .../seeding2/kernels/write_output_kernel.hpp | 26 --- .../traccc/cuda/seeding2/seed_finding.hpp | 23 ++- .../cuda/seeding2/types/internal_sp.hpp | 35 ---- .../traccc/cuda/utils/device_traits.hpp | 56 ------ .../src/seeding2/kernels/kd_tree_kernel.cu | 164 ++++++++---------- .../seeding2/kernels/seed_finding_kernel.cu | 139 +++++++-------- .../seeding2/kernels/write_output_kernel.cu | 82 --------- device/cuda/src/seeding2/seed_finding2.cu | 79 ++------- 12 files changed, 182 insertions(+), 442 deletions(-) delete mode 100644 device/cuda/include/traccc/cuda/seeding2/kernels/write_output_kernel.hpp delete mode 100644 device/cuda/include/traccc/cuda/seeding2/types/internal_sp.hpp delete mode 100644 device/cuda/include/traccc/cuda/utils/device_traits.hpp delete mode 100644 device/cuda/src/seeding2/kernels/write_output_kernel.cu diff --git a/core/include/traccc/edm/spacepoint.hpp b/core/include/traccc/edm/spacepoint.hpp index 4814629248..add6bc1f08 100644 --- a/core/include/traccc/edm/spacepoint.hpp +++ b/core/include/traccc/edm/spacepoint.hpp @@ -42,6 +42,8 @@ struct spacepoint { scalar radius() const { return std::sqrt(global[0] * global[0] + global[1] * global[1]); } + TRACCC_HOST_DEVICE + scalar phi() const { return std::atan2(y(), x()); } }; /// Comparison / ordering operator for spacepoints diff --git a/device/cuda/CMakeLists.txt b/device/cuda/CMakeLists.txt index 0e7067222f..784495698a 100644 --- a/device/cuda/CMakeLists.txt +++ b/device/cuda/CMakeLists.txt @@ -43,7 +43,6 @@ traccc_add_library( traccc_cuda cuda TYPE SHARED "src/seeding2/seed_finding2.cu" "src/seeding2/kernels/seed_finding_kernel.cu" "src/seeding2/kernels/kd_tree_kernel.cu" - "src/seeding2/kernels/write_output_kernel.cu" # Clusterization "include/traccc/cuda/clusterization/clusterization_algorithm.hpp" "src/clusterization/clusterization_algorithm.cu" diff --git a/device/cuda/include/traccc/cuda/seeding2/kernels/kd_tree_kernel.hpp b/device/cuda/include/traccc/cuda/seeding2/kernels/kd_tree_kernel.hpp index 4ce1325af7..63afb2f3ac 100644 --- a/device/cuda/include/traccc/cuda/seeding2/kernels/kd_tree_kernel.hpp +++ b/device/cuda/include/traccc/cuda/seeding2/kernels/kd_tree_kernel.hpp @@ -7,10 +7,10 @@ #pragma once -#include #include #include #include +#include #include namespace traccc::cuda { @@ -19,6 +19,7 @@ namespace traccc::cuda { * * @return A pair containing the k-d tree nodes as well as the number of nodes. */ -std::tuple create_kd_tree( - vecmem::memory_resource&, internal_sp_owning_t&&, uint32_t); +std::tuple> +create_kd_tree(vecmem::memory_resource&, vecmem::copy& copy, + const spacepoint_collection_types::const_view&); } // namespace traccc::cuda diff --git a/device/cuda/include/traccc/cuda/seeding2/kernels/seed_finding_kernel.hpp b/device/cuda/include/traccc/cuda/seeding2/kernels/seed_finding_kernel.hpp index 464b4dd2af..a23cc37d56 100644 --- a/device/cuda/include/traccc/cuda/seeding2/kernels/seed_finding_kernel.hpp +++ b/device/cuda/include/traccc/cuda/seeding2/kernels/seed_finding_kernel.hpp @@ -7,12 +7,12 @@ #pragma once -#include #include -#include #include +#include #include #include +#include namespace traccc::cuda { /** @@ -21,7 +21,7 @@ namespace traccc::cuda { * @return A pair containing the list of internal seeds as well as the number * of seeds. */ -std::pair, uint32_t> run_seeding( - seedfinder_config, seedfilter_config, vecmem::memory_resource&, - internal_sp_t, kd_tree_t); +seed_collection_types::buffer run_seeding( + seedfinder_config, seedfilter_config, vecmem::memory_resource &, + vecmem::copy &, const spacepoint_collection_types::const_view &, kd_tree_t); } // namespace traccc::cuda diff --git a/device/cuda/include/traccc/cuda/seeding2/kernels/write_output_kernel.hpp b/device/cuda/include/traccc/cuda/seeding2/kernels/write_output_kernel.hpp deleted file mode 100644 index 0bddf482d0..0000000000 --- a/device/cuda/include/traccc/cuda/seeding2/kernels/write_output_kernel.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/** TRACCC library, part of the ACTS project (R&D line) - * - * (c) 2022 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace traccc::cuda { -/** - * @brief Kernel to write output data back into traccc's EDM. - * - * @return A vector buffer containing the output seeds. - */ -alt_seed_collection_types::buffer write_output(const traccc::memory_resource &, - uint32_t, const internal_sp_t, - const alt_seed *const); -} // namespace traccc::cuda diff --git a/device/cuda/include/traccc/cuda/seeding2/seed_finding.hpp b/device/cuda/include/traccc/cuda/seeding2/seed_finding.hpp index a350a73730..119a18188d 100644 --- a/device/cuda/include/traccc/cuda/seeding2/seed_finding.hpp +++ b/device/cuda/include/traccc/cuda/seeding2/seed_finding.hpp @@ -7,29 +7,40 @@ #pragma once -#include +#include #include #include #include #include #include +#include + +#include "traccc/cuda/utils/stream.hpp" namespace traccc::cuda { /** * @brief Alternative seed finding algorithm, using orthogonal range search * implemented through a k-d tree. */ -class seed_finding2 : public algorithm { public: - seed_finding2(const traccc::memory_resource& mr); + seed_finding2(const seedfinder_config& config, + const seedfilter_config& filter_config, + const traccc::memory_resource& mr, vecmem::copy& copy, + stream& str); output_type operator()( const spacepoint_collection_types::const_view& sps) const override; private: - traccc::memory_resource m_output_mr; - seedfinder_config m_finder_conf; - seedfilter_config m_filter_conf; + traccc::memory_resource m_mr; + vecmem::copy& m_copy; + stream& m_stream; + + seedfinder_config m_seedfinder_config; + seedfilter_config m_seedfilter_config; + + int m_warp_size; }; } // namespace traccc::cuda diff --git a/device/cuda/include/traccc/cuda/seeding2/types/internal_sp.hpp b/device/cuda/include/traccc/cuda/seeding2/types/internal_sp.hpp deleted file mode 100644 index 94b375ff4d..0000000000 --- a/device/cuda/include/traccc/cuda/seeding2/types/internal_sp.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/** TRACCC library, part of the ACTS project (R&D line) - * - * (c) 2022 CERN for the benefit of the ACTS project - * - * Mozilla Public License Version 2.0 - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace traccc::cuda { -template