Skip to content

Commit

Permalink
Merge pull request #345 from guilhermeAlmeida1/wipAsyncCudaSeeding
Browse files Browse the repository at this point in the history
Make CUDA chain use asynchronous copies and kernel launches throughout
  • Loading branch information
stephenswat authored Mar 17, 2023
2 parents 1856c2a + 419d0b8 commit 5b5b6c1
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 121 deletions.
17 changes: 13 additions & 4 deletions device/cuda/include/traccc/cuda/seeding/seed_finding.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2022 CERN for the benefit of the ACTS project
* (c) 2021-2023 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/cuda/utils/stream.hpp"
#include "traccc/edm/alt_seed.hpp"
#include "traccc/edm/spacepoint.hpp"
#include "traccc/seeding/detail/seeding_config.hpp"
Expand All @@ -34,10 +35,14 @@ class seed_finding : public algorithm<alt_seed_collection_types::buffer(
/// @param config is seed finder configuration parameters
/// @param filter_config is seed filter configuration parameters
/// @param sp_grid spacepoint grid
/// @param mr vecmem memory resource
/// @param mr The memory resource(s) to use in the algorithm
/// @param copy The copy object to use for copying data between device
/// and host memory blocks
/// @param str The CUDA stream to perform the operations in
seed_finding(const seedfinder_config& config,
const seedfilter_config& filter_config,
const traccc::memory_resource& mr);
const traccc::memory_resource& mr, vecmem::copy& copy,
stream& str);

/// Callable operator for the seed finding
///
Expand All @@ -53,7 +58,11 @@ class seed_finding : public algorithm<alt_seed_collection_types::buffer(
seedfinder_config m_seedfinder_config;
seedfilter_config m_seedfilter_config;
traccc::memory_resource m_mr;
std::unique_ptr<vecmem::copy> m_copy;

/// The copy object to use
vecmem::copy& m_copy;
/// The CUDA stream to use
stream& m_stream;
};

} // namespace traccc::cuda
12 changes: 9 additions & 3 deletions device/cuda/include/traccc/cuda/seeding/seeding_algorithm.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) 2021-2022 CERN for the benefit of the ACTS project
* (c) 2021-2023 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -10,14 +10,15 @@
// Library include(s).
#include "traccc/cuda/seeding/seed_finding.hpp"
#include "traccc/cuda/seeding/spacepoint_binning.hpp"
#include "traccc/cuda/utils/stream.hpp"

// Project include(s).
#include "traccc/edm/alt_seed.hpp"
#include "traccc/edm/spacepoint.hpp"
#include "traccc/utils/algorithm.hpp"

// VecMem include(s).
#include <vecmem/memory/memory_resource.hpp>
#include <vecmem/utils/copy.hpp>

// traccc library include(s).
#include "traccc/utils/memory_resource.hpp"
Expand All @@ -32,8 +33,13 @@ class seeding_algorithm : public algorithm<alt_seed_collection_types::buffer(
/// Constructor for the seed finding algorithm
///
/// @param mr The memory resource to use
/// @param mr The memory resource(s) to use in the algorithm
/// @param copy The copy object to use for copying data between device
/// and host memory blocks
/// @param str The CUDA stream to perform the operations in
///
seeding_algorithm(const traccc::memory_resource& mr);
seeding_algorithm(const traccc::memory_resource& mr, vecmem::copy& copy,
stream& str);

/// Operator executing the algorithm.
///
Expand Down
12 changes: 9 additions & 3 deletions device/cuda/include/traccc/cuda/seeding/spacepoint_binning.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2022 CERN for the benefit of the ACTS project
* (c) 2021-2023 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s).
#include "traccc/cuda/utils/stream.hpp"
#include "traccc/edm/spacepoint.hpp"
#include "traccc/seeding/detail/seeding_config.hpp"
#include "traccc/seeding/detail/spacepoint_grid.hpp"
Expand All @@ -32,7 +33,8 @@ class spacepoint_binning
/// Constructor for the algorithm
spacepoint_binning(const seedfinder_config& config,
const spacepoint_grid_config& grid_config,
const traccc::memory_resource& mr);
const traccc::memory_resource& mr, vecmem::copy& copy,
stream& str);

/// Function executing the algorithm with a a view of spacepoints
sp_grid_buffer operator()(const spacepoint_collection_types::const_view&
Expand All @@ -43,7 +45,11 @@ class spacepoint_binning
seedfinder_config m_config;
std::pair<sp_grid::axis_p0_type, sp_grid::axis_p1_type> m_axes;
traccc::memory_resource m_mr;
std::unique_ptr<vecmem::copy> m_copy;

/// The copy object to use
vecmem::copy& m_copy;
/// The CUDA stream to use
stream& m_stream;

}; // class spacepoint_binning

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2022 CERN for the benefit of the ACTS project
* (c) 2021-2023 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/

#pragma once

// Project include(s)
#include "traccc/cuda/utils/stream.hpp"
#include "traccc/edm/alt_seed.hpp"
#include "traccc/edm/spacepoint.hpp"
#include "traccc/edm/track_parameters.hpp"
Expand All @@ -30,7 +31,11 @@ struct track_params_estimation
/// Constructor for track_params_estimation
///
/// @param mr is the memory resource
track_params_estimation(const traccc::memory_resource& mr);
/// @param copy The copy object to use for copying data between device
/// and host memory blocks
/// @param str The CUDA stream to perform the operations in
track_params_estimation(const traccc::memory_resource& mr,
vecmem::copy& copy, stream& str);

/// Callable operator for track_params_esitmation
///
Expand All @@ -45,8 +50,10 @@ struct track_params_estimation
private:
/// Memory resource used by the algorithm
traccc::memory_resource m_mr;
/// Copy object used by the algorithm
std::unique_ptr<vecmem::copy> m_copy;
/// The copy object to use
vecmem::copy& m_copy;
/// The CUDA stream to use
stream& m_stream;
};

} // namespace cuda
Expand Down
Loading

0 comments on commit 5b5b6c1

Please sign in to comment.