torch.cuda.empty_cache — PyTorch 1.10.1 documentation
pytorch.org › torchtorch.cuda.empty_cache() [source] Releases all unoccupied cached memory currently held by the caching allocator so that those can be used in other GPU application and visible in nvidia-smi. Note. empty_cache () doesn’t increase the amount of GPU memory available for PyTorch. However, it may help reduce fragmentation of GPU memory in certain ...
Unable to empty cuda cache - PyTorch Forums
discuss.pytorch.org › t › unable-to-empty-cuda-cacheOct 16, 2020 · I’m trying to free some GPU memory so that other processes can use it. I tried to do that by executing torch.cuda.empty_cache() after deleting the tensor but for some reason it doesn’t seem to work. I wrote this small script to replicate the problem os.environ['CUDA_VISIBLE_DEVICES'] = '0' showUtilization() t = torch.zeros((1, 2**6, 2**6)).to(f'cuda') showUtilization() del t torch.cuda ...