sugarme / gotch

Go binding for Pytorch C++ API (libtorch)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to drop gpu cache when drop the tensor?

ZonghaoWang opened this issue · comments

Hi.
When I create a tensor on GPU, and Drop it, but the memory not free when I use nvidia-smi until the process end?

@ZonghaoWang ,

Pytorch provides somes Python APIs such as torch.cuda.empty_cache but not available in C++ APIs. There's a way to do it in C++ as mention here. It would be nice to have one in gotch, not priority though.

In addition, Pytorch documentation mentions that even if you delete GPU memory cache, you won't increase memory available for Pytorch.

Feel free to contribute if you come up with any idea otherwise I am closing #47 and might revisite when C++ API available. Thanks.