-
Notifications
You must be signed in to change notification settings - Fork 84
unsafe_free!
is not thread-safe
#503
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
Comments
Where are threads being used here? FWIW, GPUArray objects are not thread safe (neither are operations on Base.Array objects, or Dicts, etc). If you're using the same object in parallel, you should guard it with a lock. Operations on the (possibly shared) DataRef that's pointed to array objects is supposed to be thread safe. |
Since this happens in the finalizer I though the other thread is where the GC runs. |
There are no threads involved here. The problem is that during execution of the manual free, a finalizer is kicked off. I think we just need to switch the order of setting |
Can you check if #503 works? |
Strangely I can't reproduce this issue anymore. I was using 1.10 beta back then and now I'm on the released version. |
I have encountered the following error several times both with CUDA.jl and AMDGPU.jl.
I guess
GPUArrays.unsafe_free!
is not thread safe.Doesn't cause big issues, since this happens in the finalizer, but still...
MWE that produces it sometimes:
The text was updated successfully, but these errors were encountered: