MUDA
Loading...
Searching...
No Matches
memory.h
1#pragma once
2#include <muda/launch/launch_base.h>
3#include <muda/tools/version.h>
4
5namespace muda
6{
7class Memory : public LaunchBase<Memory>
8{
9 public:
10 MUDA_HOST Memory(cudaStream_t stream = nullptr)
11 : LaunchBase(stream){};
12
13 // Memory1D
14 template <typename T>
15 MUDA_HOST Memory& alloc_1d(T** ptr, size_t byte_size, bool async = DEFAULT_ASYNC_ALLOC_FREE);
16 template <typename T>
17 MUDA_HOST Memory& alloc(T** ptr, size_t byte_size, bool async = DEFAULT_ASYNC_ALLOC_FREE);
18 MUDA_HOST Memory& free(void* ptr, bool async = DEFAULT_ASYNC_ALLOC_FREE);
19 MUDA_HOST Memory& copy(void* dst, const void* src, size_t byte_size, cudaMemcpyKind kind);
20 MUDA_HOST Memory& transfer(void* dst, const void* src, size_t byte_size);
21 MUDA_HOST Memory& download(void* dst, const void* src, size_t byte_size);
22 MUDA_HOST Memory& upload(void* dst, const void* src, size_t byte_size);
23 MUDA_HOST Memory& set(void* data, size_t byte_size, char value = 0);
24
25 // Memory2D
26 template <typename T>
27 MUDA_HOST Memory& alloc_2d(T** ptr,
28 size_t* pitch,
29 size_t width_bytes,
30 size_t height,
31 bool async = DEFAULT_ASYNC_ALLOC_FREE);
32 template <typename T>
33 MUDA_HOST Memory& alloc(T** ptr,
34 size_t* pitch,
35 size_t width_bytes,
36 size_t height,
37 bool async = DEFAULT_ASYNC_ALLOC_FREE);
38 MUDA_HOST Memory& copy(void* dst,
39 size_t dst_pitch,
40 const void* src,
41 size_t src_pitch,
42 size_t width_bytes,
43 size_t height,
44 cudaMemcpyKind kind);
45 MUDA_HOST Memory& transfer(void* dst,
46 size_t dst_pitch,
47 const void* src,
48 size_t src_pitch,
49 size_t width_bytes,
50 size_t height);
51 MUDA_HOST Memory& download(void* dst,
52 size_t dst_pitch,
53 const void* src,
54 size_t src_pitch,
55 size_t width_bytes,
56 size_t height);
57 MUDA_HOST Memory& upload(void* dst,
58 size_t dst_pitch,
59 const void* src,
60 size_t src_pitch,
61 size_t width_bytes,
62 size_t height);
63 MUDA_HOST Memory& set(void* data, size_t pitch, size_t width_bytes, size_t height, char value = 0);
64
65 // Memory3D
66 MUDA_HOST Memory& alloc_3d(cudaPitchedPtr* pitched_ptr,
67 const cudaExtent& extent,
68 bool async = DEFAULT_ASYNC_ALLOC_FREE);
69 MUDA_HOST Memory& alloc(cudaPitchedPtr* pitched_ptr,
70 const cudaExtent& extent,
71 bool async = DEFAULT_ASYNC_ALLOC_FREE);
72 MUDA_HOST Memory& free(cudaPitchedPtr pitched_ptr, bool async = DEFAULT_ASYNC_ALLOC_FREE);
73 MUDA_HOST Memory& copy(const cudaMemcpy3DParms& parms);
74 MUDA_HOST Memory& transfer(cudaMemcpy3DParms parms);
75 MUDA_HOST Memory& download(cudaMemcpy3DParms parms);
76 MUDA_HOST Memory& upload(cudaMemcpy3DParms parms);
77 MUDA_HOST Memory& set(cudaPitchedPtr pitched_ptr, cudaExtent extent, char value = 0);
78};
79
80} // namespace muda
81
82#include "details/memory.inl"
Definition launch_base.h:86
Definition memory.h:8