Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Arrays.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Arrays.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 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 http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
11 // CUDA plugin include(s).
13 
14 // System include(s).
15 #include <cstddef>
16 #include <memory>
17 
18 namespace Acts {
19 namespace Cuda {
20 
23 namespace Details {
24 
27  public:
29  void operator()(void* ptr);
30 
31 }; // class DeviceArrayDeleter
32 
35  public:
37  void operator()(void* ptr);
38 
39 }; // class HostArrayDeleter
40 
41 } // namespace Details
42 
44 template <typename T>
45 using device_array = std::unique_ptr<T, Details::DeviceArrayDeleter>;
46 
48 template <typename T>
50 
52 template <typename T>
53 using host_array = std::unique_ptr<T, Details::HostArrayDeleter>;
54 
56 template <typename T>
58 
60 template <typename T>
61 void copyToDevice(device_array<T>& dev, const host_array<T>& host,
62  std::size_t arraySize);
63 
65 template <typename T>
66 void copyToDevice(device_array<T>& dev, const host_array<T>& host,
67  std::size_t arraySize, const StreamWrapper& stream);
68 
70 template <typename T>
71 void copyToHost(host_array<T>& host, const device_array<T>& dev,
72  std::size_t arraySize);
73 
75 template <typename T>
76 void copyToHost(host_array<T>& host, const device_array<T>& dev,
77  std::size_t arraySize, const StreamWrapper& stream);
78 
79 } // namespace Cuda
80 } // namespace Acts