vecmem 1.26.0
Loading...
Searching...
No Matches
async_copy.hpp
1/*
2 * VecMem project, part of the ACTS project (R&D line)
3 *
4 * (c) 2021-2026 CERN for the benefit of the ACTS project
5 *
6 * Mozilla Public License Version 2.0
7 */
8#pragma once
9
10// VecMem include(s).
11#include "vecmem/utils/copy.hpp"
12#include "vecmem/utils/cuda/stream_wrapper.hpp"
13#include "vecmem/vecmem_cuda_export.hpp"
14
15// System include(s).
16#include <memory>
17
18namespace vecmem::cuda {
19
33class async_copy : public vecmem::copy {
34
35public:
41 explicit async_copy(const stream_wrapper& stream);
52 async_copy(const stream_wrapper& stream, unsigned int event_flags);
59
63
67 void do_copy(std::size_t size, const void* from, void* to,
68 type::copy_type cptype) const final;
71 void do_memset(std::size_t size, void* ptr, int value) const final;
75
79 std::unique_ptr<impl> m_impl;
80
81}; // class async_copy
82
83} // namespace vecmem::cuda
An allocator class that wraps a memory resource.
Definition allocator.hpp:37
Class implementing (synchronous) host <-> device memory copies.
Definition copy.hpp:45
std::unique_ptr< abstract_event > event_type
Event type used by the copy class.
Definition copy.hpp:73
data::vector_buffer< std::remove_cv_t< TYPE > > to(const data::vector_view< TYPE > &data, memory_resource &resource, type::copy_type cptype=type::unknown) const
Copy a 1-dimensional vector to the specified memory resource.
Definition copy.ipp:66
Specialisation of vecmem::copy for CUDA.
Definition async_copy.hpp:33
VECMEM_CUDA_EXPORT event_type create_event() const final
Create an event for synchronization.
Definition async_copy.cpp:202
VECMEM_CUDA_EXPORT async_copy(async_copy &&) noexcept
Move constructor.
VECMEM_CUDA_EXPORT void do_memset(std::size_t size, void *ptr, int value) const final
Fill a memory area using CUDA asynchronously.
Definition async_copy.cpp:181
VECMEM_CUDA_EXPORT void do_copy(std::size_t size, const void *from, void *to, type::copy_type cptype) const final
Perform an asynchronous memory copy using CUDA.
Definition async_copy.cpp:154
Wrapper class for cudaStream_t.
Definition stream_wrapper.hpp:24
Namespace holding types that work on/with CUDA.
Definition cuda_device_atomic_ref.hpp:19
Wrapper struct around the copy_type enumeration.
Definition copy.hpp:54
Definition async_copy.cpp:126