JuliaGPU / JuliaGPU/oneAPI.jl

Memory leak when running GPU broadcast in a loop

Open
#327 6 comments 0 reactions 0 assignees View on GitHub
bug libraries performance
Dominant language
Julia
Stars
215
Forks
37
Avg merge
10h 47m
Merged PRs (30d)
14

Description

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:

```
using oneAPI

gpu_array = oneAPI.zeros(Float32, 10_000_000)

for j in 1:5_000
gpu_array .+= 1
end
```

Is there something I am missing here?

I can see the GPU memory fill up in the Task Manager:
![billede](https://github.com/JuliaGPU/oneAPI.jl/assets/124562211/e63bd540-f22d-4417-88cf-ce0675933758)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the provided Julia reproducer on oneAPI 1.2.2 and observing GPU memory during repeated `.+=` operations. Trace the GPU broadcast path and its allocation or lifetime behavior in oneAPI.jl. Done means the loop no longer continually increases GPU memory until OutOfMemoryError().

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.