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.
157 158 159 160 161 162 163 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 157 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.
144 145 146 147 148 149 150 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 144 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.
170 171 172 173 174 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 170 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.
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 179 static VALUE rb_memory_pool_free_all_blocks(int argc, VALUE* argv, VALUE self) { // TODO(sonots): FIX if we create a Stream object cudaStream_t stream_ptr = (argc < 1) ? 0 : (cudaStream_t)NUM2SIZET(argv[0]); cudaError_t status = cudaSuccess; try { if (argc < 1) { pool.FreeAllBlocks(); } else { pool.FreeAllBlocks(stream_ptr); } } catch (const cumo::internal::CUDARuntimeError& e) { status = e.status(); } catch (...) { status = cudaErrorUnknown; } cumo_cuda_runtime_check_status(status); return Qnil; } |
.free_bytes ⇒ Integer
Get the total number of bytes acquired but not used in the pool.
228 229 230 231 232 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 228 static VALUE rb_memory_pool_free_bytes(VALUE self) { return SIZET2NUM(pool.GetFreeBytes()); } |
.n_free_blocks ⇒ Integer
Count the total number of free blocks.
206 207 208 209 210 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 206 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.
239 240 241 242 243 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 239 static VALUE rb_memory_pool_total_bytes(VALUE self) { return SIZET2NUM(pool.GetTotalBytes()); } |
.used_bytes ⇒ Integer
Get the total number of bytes used.
217 218 219 220 221 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 217 static VALUE rb_memory_pool_used_bytes(VALUE self) { return SIZET2NUM(pool.GetUsedBytes()); } |