EIC 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 // System include(s).
12 #include <cstddef>
13 #include <memory>
14 
15 namespace Acts {
16 namespace Cuda {
17 
20 namespace Details {
21 
24  public:
26  void operator()(void* ptr);
27 
28 }; // class DeviceArrayDeleter
29 
32  public:
34  void operator()(void* ptr);
35 
36 }; // class HostArrayDeleter
37 
38 } // namespace Details
39 
41 template <typename T>
42 using device_array = std::unique_ptr<T, Details::DeviceArrayDeleter>;
43 
45 template <typename T>
46 device_array<T> make_device_array(std::size_t size);
47 
49 template <typename T>
50 using host_array = std::unique_ptr<T, Details::HostArrayDeleter>;
51 
53 template <typename T>
54 host_array<T> make_host_array(std::size_t size);
55 
57 template <typename T>
58 void copyToDevice(device_array<T>& dev, const host_array<T>& host,
59  std::size_t arraySize);
60 
62 template <typename T>
63 void copyToHost(host_array<T>& host, const device_array<T>& dev,
64  std::size_t arraySize);
65 
66 } // namespace Cuda
67 } // namespace Acts