Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support empty_cuda_cache #888

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wenhaozhao
Copy link

@wenhaozhao wenhaozhao commented Sep 5, 2024

Added empty_cuda_cache method to release GPU cache.

tch::torch_sys::c10_cuda::empty_cuda_cache();

Implemented the same functionality as torch.cuda.empty_cache() in pytorch.

Example

pub fn free_gpu_memory() {
    #[cfg(not(target_os = "macos"))]
    {
        use tch::torch_sys;
        torch_sys::c10_cuda::empty_cuda_cache();
    }
}

wenhaozhao added 2 commits September 5, 2024 14:15
(cherry picked from commit 78008d966b81c740c0857dc88c1eeec97e27ebc7)
(cherry picked from commit 9a36e619c5af7b111689c712e5c4f4d763e74a20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant