bartorch.empty_cuda_memcache

bartorch.empty_cuda_memcache#

bartorch.empty_cuda_memcache()#

Hand the device memory BART’s cache holds back to the driver.

The cache keeps what an operator freed for its next application, which makes an iterative solve’s allocations cheap; between stages that run elsewhere – a solve, then a network – it holds memory nothing uses. Clearing it there frees that memory without slowing the solve. A no-op without CUDA.

Examples

>>> x = optim.CG(maxiter=3, device="cuda").inverse(b, A, x)
>>> bartorch.empty_cuda_memcache()