8000 Add function to free GPU memory by Infernaught · Pull Request #3643 · ludwig-ai/ludwig · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add function to free GPU memory #3643

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

Merged
merged 2 commits into from
Sep 20, 2023
Merged

Add function to free GPU memory #3643

merged 2 commits into from
Sep 20, 2023

Conversation

Infernaught
Copy link
Contributor
@Infernaught Infernaught commented Sep 19, 2023

Used this discussion page as a reference: https://discuss.pytorch.org/t/how-can-we-release-gpu-memory-cache/14530/27

Added a function to LudwigModel to free GPU memory. Compared to the function in the discussion page, I did not move the individual parameters in a loop but instead just moved the entire model to CPU (this is clearer logic to read and results in a small amount of extra GPU memory freed), and I did not call del or gc.collect() (these two calls did not seem to impact GPU memory).

Credit to @justinxzhao for writing and testing the code.

@github-actions
Copy link

Unit Test Results

  4 files  ±0    4 suites  ±0   35m 14s ⏱️ + 1m 36s
31 tests ±0  26 ✔️ ±0    5 💤 ±0  0 ±0 
62 runs  ±0  52 ✔️ ±0  10 💤 ±0  0 ±0 

Results for commit d171255. ± Comparison against base commit c24deca.

@justinxzhao justinxzhao merged commit d095af8 into master Sep 20, 2023
@justinxzhao justinxzhao deleted the clear_gpu branch September 20, 2023 18:47
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.

2 participants
0