DFT-EFE
 
Loading...
Searching...
No Matches
MemoryTransfer.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2021. *
3 * The Regents of the University of Michigan and DFT-EFE developers. *
4 * *
5 * This file is part of the DFT-EFE code. *
6 * *
7 * DFT-EFE is free software: you can redistribute it and/or modify *
8 * it under the terms of the Lesser GNU General Public License as *
9 * published by the Free Software Foundation, either version 3 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * DFT-EFE is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15 * See the Lesser GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License at the top level of DFT-EFE distribution. If not, see *
19 * <https://www.gnu.org/licenses/>. *
20 ******************************************************************************/
21
22/*
23 * @author Ian C. Lin.
24 */
25
26#ifndef dftefeMemoryTransfer_h
27#define dftefeMemoryTransfer_h
28
30#include <utils/TypeConfig.h>
31
32namespace dftefe
33{
34 namespace utils
35 {
36 template <MemorySpace memorySpaceDst, MemorySpace memorySpaceSrc>
38 {
39 public:
46 template <typename ValueType>
47 static void
48 copy(size_type size, ValueType *dst, const ValueType *src);
49 };
50
51 template <>
53 {
54 public:
55 template <typename ValueType>
56 static void
57 copy(size_type size, ValueType *dst, const ValueType *src);
58 };
59
60#ifdef DFTEFE_WITH_DEVICE
61 template <>
63 {
64 public:
65 template <typename ValueType>
66 static void
67 copy(size_type size, ValueType *dst, const ValueType *src);
68 };
69
70 template <>
71 class MemoryTransfer<MemorySpace::HOST, MemorySpace::DEVICE>
72 {
73 public:
74 template <typename ValueType>
75 static void
76 copy(size_type size, ValueType *dst, const ValueType *src);
77 };
78
79 template <>
80 class MemoryTransfer<MemorySpace::HOST_PINNED, MemorySpace::HOST>
81 {
82 public:
83 template <typename ValueType>
84 static void
85 copy(size_type size, ValueType *dst, const ValueType *src);
86 };
87
88 template <>
90 {
91 public:
92 template <typename ValueType>
93 static void
94 copy(size_type size, ValueType *dst, const ValueType *src);
95 };
96
97 template <>
98 class MemoryTransfer<MemorySpace::HOST_PINNED, MemorySpace::DEVICE>
99 {
100 public:
101 template <typename ValueType>
102 static void
103 copy(size_type size, ValueType *dst, const ValueType *src);
104 };
105
106 template <>
107 class MemoryTransfer<MemorySpace::DEVICE, MemorySpace::HOST>
108 {
109 public:
110 template <typename ValueType>
111 static void
112 copy(size_type size, ValueType *dst, const ValueType *src);
113 };
114
115 template <>
116 class MemoryTransfer<MemorySpace::DEVICE, MemorySpace::HOST_PINNED>
117 {
118 public:
119 template <typename ValueType>
120 static void
121 copy(size_type size, ValueType *dst, const ValueType *src);
122 };
123
124 template <>
125 class MemoryTransfer<MemorySpace::DEVICE, MemorySpace::DEVICE>
126 {
127 public:
128 template <typename ValueType>
129 static void
130 copy(size_type size, ValueType *dst, const ValueType *src);
131 };
132#endif // DFTEFE_WITH_DEVICE
133 } // namespace utils
134} // namespace dftefe
135
136#include "MemoryTransfer.t.cpp"
137
138#endif // dftefeMemoryTransfer_h
Definition: MemoryTransfer.h:38
static void copy(size_type size, ValueType *dst, const ValueType *src)
Copy array from the memory space of source to the memory space of destination.
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8