DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
MemoryTransfer.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16
17/*
18 * @author Ian C. Lin, Sambit Das
19 */
20
21#ifndef dftfeMemoryTransfer_h
22#define dftfeMemoryTransfer_h
23
24#include <MemorySpaceType.h>
25#include <TypeConfig.h>
26
27namespace dftfe
28{
29 namespace utils
30 {
31 template <MemorySpace memorySpaceDst, MemorySpace memorySpaceSrc>
33 {
34 public:
35 /**
36 * @brief Copy array from the memory space of source to the memory space of destination
37 * @param size the length of the array
38 * @param dst pointer to the destination
39 * @param src pointer to the source
40 */
41 template <typename ValueType>
42 static void
43 copy(std::size_t size, ValueType *dst, const ValueType *src);
44 };
45
46 template <>
48 {
49 public:
50 template <typename ValueType>
51 static void
52 copy(std::size_t size, ValueType *dst, const ValueType *src);
53 };
54
55#ifdef DFTFE_WITH_DEVICE
56 template <>
58 {
59 public:
60 template <typename ValueType>
61 static void
62 copy(std::size_t size, ValueType *dst, const ValueType *src);
63 };
64
65 template <>
66 class MemoryTransfer<MemorySpace::HOST, MemorySpace::DEVICE>
67 {
68 public:
69 template <typename ValueType>
70 static void
71 copy(std::size_t size, ValueType *dst, const ValueType *src);
72 };
73
74 template <>
75 class MemoryTransfer<MemorySpace::HOST_PINNED, MemorySpace::HOST>
76 {
77 public:
78 template <typename ValueType>
79 static void
80 copy(std::size_t size, ValueType *dst, const ValueType *src);
81 };
82
83 template <>
85 {
86 public:
87 template <typename ValueType>
88 static void
89 copy(std::size_t size, ValueType *dst, const ValueType *src);
90 };
91
92 template <>
94 {
95 public:
96 template <typename ValueType>
97 static void
98 copy(std::size_t size, ValueType *dst, const ValueType *src);
99 };
100
101 template <>
103 {
104 public:
105 template <typename ValueType>
106 static void
107 copy(std::size_t size, ValueType *dst, const ValueType *src);
108 };
109
110 template <>
112 {
113 public:
114 template <typename ValueType>
115 static void
116 copy(std::size_t size, ValueType *dst, const ValueType *src);
117 };
118
119 template <>
121 {
122 public:
123 template <typename ValueType>
124 static void
125 copy(std::size_t size, ValueType *dst, const ValueType *src);
126 };
127#endif // DFTFE_WITH_DEVICE
128 } // namespace utils
129} // namespace dftfe
130
131#include "MemoryTransfer.t.cc"
132
133#endif // dftfeMemoryTransfer_h
Definition MemoryTransfer.h:33
static void copy(std::size_t size, ValueType *dst, const ValueType *src)
Copy array from the memory space of source to the memory space of destination.
Definition Cell.h:36
MemorySpace
Definition MemorySpaceType.h:33
@ HOST
Definition MemorySpaceType.h:34
@ HOST_PINNED
Definition MemorySpaceType.h:35
@ DEVICE
Definition MemorySpaceType.h:36
Definition pseudoPotentialToDftfeConverter.cc:34