DFT-EFE
 
Loading...
Searching...
No Matches
MemoryManager.h
Go to the documentation of this file.
1#ifndef dftefeMemoryManager_h
2#define dftefeMemoryManager_h
3
4#include "TypeConfig.h"
5#include "MemorySpaceType.h"
6
7namespace dftefe
8{
9 namespace utils
10 {
11 //
12 // MemoryManager
13 //
14 template <typename ValueType, MemorySpace memorySpace>
16 {
17 public:
18 static void
19 allocate(size_type size, ValueType **ptr);
20
21 static void
22 deallocate(ValueType *ptr);
23
24 static void
25 set(size_type size, ValueType *ptr, ValueType val);
26 };
27
28 template <typename ValueType>
29 class MemoryManager<ValueType, MemorySpace::HOST>
30 {
31 public:
32 static void
33 allocate(size_type size, ValueType **ptr);
34
35 static void
36 deallocate(ValueType *ptr);
37
38 static void
39 set(size_type size, ValueType *ptr, ValueType val);
40 };
41
42#ifdef DFTEFE_WITH_DEVICE
43 template <typename ValueType>
44 class MemoryManager<ValueType, MemorySpace::HOST_PINNED>
45 {
46 public:
47 static void
48 allocate(size_type size, ValueType **ptr);
49
50 static void
51 deallocate(ValueType *ptr);
52
53 static void
54 set(size_type size, ValueType *ptr, ValueType val);
55 };
56
57
58 template <typename ValueType>
59 class MemoryManager<ValueType, MemorySpace::DEVICE>
60 {
61 public:
62 static void
63 allocate(size_type size, ValueType **ptr);
64
65 static void
66 deallocate(ValueType *ptr);
67
68 static void
69 set(size_type size, ValueType *ptr, ValueType val);
70 };
71#endif // DFTEFE_WITH_DEVICE
72 } // namespace utils
73
74} // namespace dftefe
75
76#include "MemoryManager.t.cpp"
77
78#endif
Definition: MemoryManager.h:16
static void allocate(size_type size, ValueType **ptr)
static void set(size_type size, ValueType *ptr, ValueType val)
static void deallocate(ValueType *ptr)
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8