Memory management
Core interface:
CuArrays.alloc
— Functionalloc(sz)
Allocate a number of bytes sz
from the memory pool. Returns a CuPtr{Nothing}
; may throw a OutOfGPUMemoryError
if the allocation request cannot be satisfied.
CuArrays.free
— Functionfree(sz)
Releases a buffer pointed to by ptr
to the memory pool.
CuArrays.OutOfGPUMemoryError
— TypeOutOfGPUMemoryError()
An operation allocated too much GPU memory for either the system or the memory pool to handle properly.
Functionality to work with external allocations:
CuArrays.reclaim
— Functionreclaim([sz=typemax(Int)])
Reclaims sz
bytes of cached memory. Use this to free GPU memory before calling into functionality that does not use the CuArrays memory pool. Returns the number of bytes actually reclaimed.
Missing docstring for CuArrays.extalloc
. Check Documenter's build log for details.
Utilities
CuArrays.@allocated
— Macro@allocated
A macro to evaluate an expression, discarding the resulting value, instead returning the total number of bytes allocated during evaluation of the expression.
CuArrays.@time
— Macro@time ex
Run expression ex
and report on execution time and GPU/CPU memory behavior. The GPU is synchronized right before and after executing ex
to exclude any external effects.
CuArrays.memory_status
— Functionmemory_status([io=stdout])
Report to io
on the memory status of the current GPU and the active memory pool.
Debug timers
CuArrays.enable_timings
— Methodenable_timings()
Enable the recording of debug timings.
CuArrays.alloc_timings
— Methodalloc_timings()
Show the timings of the CUDA allocator. Assumes CuArrays.enable_timings()
has been called.
CuArrays.pool_timings
— Methodpool_timings()
Show the timings of the currently active memory pool. Assumes CuArrays.enable_timings()
has been called.
CuArrays.reset_timers!
— Methodreset_timers!()
Reset all debug timers. This is automatically called at initialization time,