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.
75 76 77 78 79 80 81 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 75
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.
62 63 64 65 66 67 68 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 62
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.
88 89 90 91 92 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 88
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.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 97
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.
141 142 143 144 145 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 141
static VALUE
rb_memory_pool_free_bytes(VALUE self)
{
return SIZET2NUM(pool.GetFreeBytes());
}
|
.n_free_blocks ⇒ Integer
Count the total number of free blocks.
119 120 121 122 123 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 119
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.
152 153 154 155 156 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 152
static VALUE
rb_memory_pool_total_bytes(VALUE self)
{
return SIZET2NUM(pool.GetTotalBytes());
}
|
.used_bytes ⇒ Integer
Get the total number of bytes used.
130 131 132 133 134 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 130
static VALUE
rb_memory_pool_used_bytes(VALUE self)
{
return SIZET2NUM(pool.GetUsedBytes());
}
|