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
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 ⇒ Object
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? ⇒ Object
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
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 ⇒ Object
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 ⇒ Object
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 ⇒ Object
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 ⇒ Object
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());
}
|