Module: Cumo::CUDA::MemoryPool
- Defined in:
- ext/cumo/cuda/memory_pool.cpp
Class Method Summary collapse
-
.disable ⇒ Boolean
Disable memory pool.
-
.enable ⇒ Boolean
Enable memory pool.
-
.enabled? ⇒ Boolean
Returns whether memory pool is enabled or not.
-
.free_all_blocks(*args) ⇒ Object
Free all non-split chunks in all arenas.
-
.free_bytes ⇒ Integer
Get the total number of bytes acquired but not used in the pool.
-
.n_free_blocks ⇒ Integer
Count the total number of free blocks.
-
.total_bytes ⇒ Integer
Get the total number of bytes acquired in the pool.
-
.used_bytes ⇒ Integer
Get the total number of bytes used.
Class Method Details
.disable ⇒ Boolean
Disable memory pool.
83 84 85 86 87 88 89 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 83 static VALUE rb_memory_pool_disable(VALUE self) { VALUE ret = (memory_pool_enabled ? Qtrue : Qfalse); memory_pool_enabled = false; return ret; } |
.enable ⇒ Boolean
Enable memory pool.
70 71 72 73 74 75 76 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 70 static VALUE rb_memory_pool_enable(VALUE self) { VALUE ret = (memory_pool_enabled ? Qtrue : Qfalse); memory_pool_enabled = true; return ret; } |
.enabled? ⇒ Boolean
Returns whether memory pool is enabled or not.
96 97 98 99 100 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 96 static VALUE rb_memory_pool_enabled_p(VALUE self) { return (memory_pool_enabled ? Qtrue : Qfalse); } |
.free_all_blocks(*args) ⇒ Object
Free all non-split chunks in all arenas.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 105 static VALUE rb_memory_pool_free_all_blocks(int argc, VALUE* argv, VALUE self) { try { if (argc < 1) { pool.FreeAllBlocks(); } else { // TODO(sonots): FIX if we create a Stream object cudaStream_t stream_ptr = (cudaStream_t)NUM2SIZET(argv[0]); pool.FreeAllBlocks(stream_ptr); } } catch (const cumo::internal::CUDARuntimeError& e) { cumo_cuda_runtime_check_status(e.status()); } return Qnil; } |
.free_bytes ⇒ Integer
Get the total number of bytes acquired but not used in the pool.
149 150 151 152 153 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 149 static VALUE rb_memory_pool_free_bytes(VALUE self) { return SIZET2NUM(pool.GetFreeBytes()); } |
.n_free_blocks ⇒ Integer
Count the total number of free blocks.
127 128 129 130 131 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 127 static VALUE rb_memory_pool_n_free_blocks(VALUE self) { return SIZET2NUM(pool.GetNumFreeBlocks()); } |
.total_bytes ⇒ Integer
Get the total number of bytes acquired in the pool.
160 161 162 163 164 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 160 static VALUE rb_memory_pool_total_bytes(VALUE self) { return SIZET2NUM(pool.GetTotalBytes()); } |
.used_bytes ⇒ Integer
Get the total number of bytes used.
138 139 140 141 142 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 138 static VALUE rb_memory_pool_used_bytes(VALUE self) { return SIZET2NUM(pool.GetUsedBytes()); } |