Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adding a way to clear GPU memory#722

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
montanalow merged 6 commits intopostgresml:masterfromjsaied99:clear_gpu_cache
Jun 10, 2023

Conversation

@jsaied99
Copy link
Contributor

Adding a way of clearing GPU memory by doingSELECT pgml.clear_gpu_cache();. One can also pass amemory_usage parameter which will add a filter to whether or not to clear GPU memory if utilization is greater than the passed value. For instance, if you want to clear only if GPU memory utilization is > 50%, you can do the following:

select pgml.clear_gpu_cache(memory_usage => 50);

I also wanted to implement the general clear_cache, but it requires a bit more, and I think clearing GPU should be okay for the first pass.

Copy link
Contributor

@montanalowmontanalow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This looks good to me. 2 nits.

  1. We should start including all this wonderful PR example/documentation as crate docs over API functions. i.e. /// blah blah blah
  2. I think we should use a f32 for the memory limit argument since a fraction between [0:1]

@jsaied99
Copy link
ContributorAuthor

@montanalow ,

  1. torch.cuda.memory_usageTorch Documentation returns a int.
  2. Makes sense to me, I'll add docs starting for this PR. Not that familiar with the format for the crate docs, but shouldn't be an issue.

@montanalow
Copy link
Contributor

I appreciate you beginning the great documentation crusade with this function. For the argument type, all of our other APIs follow more scikit-esque floating point numbers. Torch is the most common backend, maybe the only one that matters these days, but I think floating point is still the better API for relative percentages, and I think consistency is generally important.

@jsaied99
Copy link
ContributorAuthor

Got it. I agree with consistency. No worries. I will change it tof32 and make the proper adjustments in the code.

@montanalowmontanalow merged commit07ee41c intopostgresml:masterJun 10, 2023
SilasMarvin pushed a commit that referenced this pull requestOct 5, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@montanalowmontanalowmontanalow approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@jsaied99@montanalow

[8]ページ先頭

©2009-2025 Movatter.jp