question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dear jax team,

I’d like to use jax alongside other tools running on GPU in the same pipeline. Is there a possibility to “encapsulate” the usage of jax/XLA so that the GPU is freed afterwards? Even if I would have to copy over the DeviceArrays into numpy manually.

Maybe something like:

with jax.Block():
    result = some_jitted_fun(a, b, c)
    result = onp.copy(result)

I can imagine the (design of) handling of objects and their GPU memory is not straightforward, if not practically impossible. Could I at least tell jax to use the GPU only incrementally instead of filling the memory completely on import?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

8reactions
altosaarcommented, Feb 16, 2022

Any update on this?

5reactions
skyecommented, Feb 19, 2021

If you’d like to delete all on-device buffers, you can now reach directly into the underlying C++ internals like this:

backend = jax.lib.xla_bridge.get_backend()
for buf in backend.live_buffers(): buf.delete()

You’ll get errors about trying to use a deleted buffer if you try to use an existing references to these buffers. Note these APIs are still subject to change as well!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I flush GPU memory using CUDA (physical reset is ...
Quitting applications seems to free the memory they use. Quit everything you don't need, or quit applications one-by-one to see how much memory...
Read more >
7 Tested Methods to Fix Your GPU Memory is Full Message
1. Adjust paging file settings for the game drive · 2. Update the graphics driver · 3. Use the 3GB switch · 4....
Read more >
Your GPU memory is full? Try these fixes to resolve it! - YouTube
Your GPU memory is full? Try these fixes to resolve it!This video will show you how to do it!Try the following solutions to...
Read more >
How to Clear GPU Memory Windows 11 - YouTube
How to Clear GPU Memory Windows 11 Search Google for - hows.tech windows commands The page has complete list of Windows Commands.
Read more >
How to flush / garbage collect GPU memory - Windows 10
1 Answer 1 · Open Windows Powershell ISE and copy paste the following code into it. {. #Disable the GPU · Replace "GPU...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found