MUDA
Loading...
Searching...
No Matches
memory_node.h
1#pragma once
2#include <muda/graph/graph_base.h>
3
4namespace muda
5{
6#ifdef MUDA_WITH_GRAPH_MEMORY_ALLOC_FREE
7class MemAllocNode : public GraphNode
8{
9 void* m_dptr;
10
11 public:
12 using this_type = MemAllocNode;
13 friend class Graph;
14};
15
16template <typename T>
17class MemAllocNodeParms : public NodeParms
18{
19 cudaMemAllocNodeParams m_parms;
20
21 public:
22 using this_type = MemAllocNodeParms;
23 friend class graph;
24 friend class std::shared_ptr<this_type>;
25 friend class std::unique_ptr<this_type>;
26 friend class std::weak_ptr<this_type>;
27
28 MemAllocNodeParms(size_t size)
29 : m_parms({})
30 {
31 m_parms.poolProps.allocType = cudaMemAllocationTypePinned;
32 cudaGetDevice(&m_parms.poolProps.location.id);
33 m_parms.poolProps.location.type = cudaMemLocationTypeDevice;
34 m_parms.bytesize = size * sizeof(T);
35 }
36
37 cudaMemAllocNodeParams* getRaw() { return &m_parms; }
38 const cudaMemAllocNodeParams* getRaw() const { return &m_parms; }
39};
40
41class MemFreeNode : public GraphNode
42{
43 public:
44 using this_type = MemFreeNode;
45 friend class Graph;
46};
47#endif
48
49class MemcpyNode : public GraphNode
50{
51 public:
52 using this_type = MemcpyNode;
53 friend class Graph;
54};
55
56class MemsetNode : public GraphNode
57{
58 public:
59 using this_type = MemsetNode;
60 friend class Graph;
61};
62} // namespace muda
Definition graph.h:18
Definition graph_base.h:27
Definition memory_node.h:50
Definition memory_node.h:57