oneflow.cuda.empty_cache

oneflow.cuda.empty_cache()None

Releases all unoccupied cached memory currently held by the caching allocators of all OneFlow streams so those can be re-allocated in OneFlow streams or other GPU application and visible in nvidia-smi.

Note

empty_cache() may enable one stream to release memory and then freed memory can be used by another stream. It may also help reduce fragmentation of GPU memory in certain cases.