Module: Cumo::CUDA::MemoryPool
- Defined in:
- ext/cumo/cuda/memory_pool.cpp
Class Method Summary collapse
- .disable ⇒ Object
- .enable ⇒ Object
- .enabled? ⇒ Object
- .free_all_blocks(*args) ⇒ Object
- .free_bytes ⇒ Object
- .n_free_blocks ⇒ Object
- .total_bytes ⇒ Object
- .used_bytes ⇒ Object
Class Method Details
.disable ⇒ Object
88 89 90 91 92 93 94 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 88
static VALUE
rb_memory_pool_disable(VALUE self)
{
VALUE ret = (memory_pool_enabled ? Qtrue : Qfalse);
memory_pool_enabled = false;
return ret;
}
|
.enable ⇒ Object
75 76 77 78 79 80 81 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 75
static VALUE
rb_memory_pool_enable(VALUE self)
{
VALUE ret = (memory_pool_enabled ? Qtrue : Qfalse);
memory_pool_enabled = true;
return ret;
}
|
.enabled? ⇒ Object
101 102 103 104 105 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 101
static VALUE
rb_memory_pool_enabled_p(VALUE self)
{
return (memory_pool_enabled ? Qtrue : Qfalse);
}
|
.free_all_blocks(*args) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 110
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 ⇒ Object
154 155 156 157 158 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 154
static VALUE
rb_memory_pool_free_bytes(VALUE self)
{
return SIZET2NUM(pool.GetFreeBytes());
}
|
.n_free_blocks ⇒ Object
132 133 134 135 136 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 132
static VALUE
rb_memory_pool_n_free_blocks(VALUE self)
{
return SIZET2NUM(pool.GetNumFreeBlocks());
}
|
.total_bytes ⇒ Object
165 166 167 168 169 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 165
static VALUE
rb_memory_pool_total_bytes(VALUE self)
{
return SIZET2NUM(pool.GetTotalBytes());
}
|
.used_bytes ⇒ Object
143 144 145 146 147 |
# File 'ext/cumo/cuda/memory_pool.cpp', line 143
static VALUE
rb_memory_pool_used_bytes(VALUE self)
{
return SIZET2NUM(pool.GetUsedBytes());
}
|