-
Notifications
You must be signed in to change notification settings - Fork 22
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
Memory leak when running GPU broadcast in a loop #327
Comments
Works for me, I never get an OOM and it doesn't exceed 3GB of memory use. Do note that Julia uses a GC, so it's expected to see memory usage rise quite a bit until it falls again. Can you post a backtrace of an OOM? |
When I run this, memory usage falls very little after running the loop, but stays high at around 7GB. The loop actually completes without an error, but the OOM error arises when doing any other GPU operation afterwards. So the above example code should have been (sorry!):
Where the final line triggers the following error:
|
That still doesn't error here. What happens if you call |
I tried running Running
This keeps memery use at reasonable levels and prevents any OOM errors later. Memory use also doesn't depend on the number of outer loops anymore. After some experimenting I found out calling |
That's all very weird. I can't reproduce this no matter how long I tried, or how many kernels I compiled and launched. Maybe this is related to Windows? I don't currently have WSL set-up, so won't be able to try this straight away. If you have the time, you could consider running the code for a while and writing a heap snapshot, using the new 1.9 functionality: JuliaLang/julia#46862. You can then open the snapshot in Chrome. If it's a Julia object memory leak, we should be able to spot it there. If we're leaking GPU memory however, we'll have to annotate our |
All right, I just ran both again (killing the REPL in between) and took a heap snapshots of both. I looked at them quickly and don't really see an obvious difference, but I don't really know what I am supposed to be looking for. If this helps at all: I am on Windows 10, using the standard installation of WSL2 (Ubuntu). I use VS Code, but running it directly form Ubuntu doesn't change anything. The files are too big to upload here, so I uploaded them here instead: https://file.io/xgRlcuitBSPP |
I need to run GPU operations inside a loop, where the output of one iteration is used in the next one.
However, even very simple GPU broadcasts result in a memory leak and eventually I get OutOfMemoryError().
I am using oneAPI v.1.2.2 on WSL2 with Ubuntu on a Windows 10.
A very simple example that reproduces this is:
Is there something I am missing here?
I can see the GPU memory fill up in the Task Manager:
The text was updated successfully, but these errors were encountered: