-
Notifications
You must be signed in to change notification settings - Fork 57
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
Freed reference problem when combining cuTENSOR and Zygote #169
Comments
Hi hxjz233, I looked into this for a bit, firstly: The freed reference is actually interesting, and it's something that I overlooked. We try to offload some of the memory pressure of the GPU by inserting |
Ok, I think at the very least that first PR should fix the freed reference errors. Do you mind testing it out, and letting me know if it resolves the issues? |
Thanks for the quick fix! It works quite well for the freed reference problem (and is eventually enabling my whole cuda+tensoroperation+zygote project, when using real numbers). |
Hi there, it's been a while and I find the former fix on the To reproduce, please use Error message
|
I guess that the original issue reporter is not able to reopen an issue if formerly closed by the contributers. Please feel free to let me know if the problem is reproducible on your side, and maybe reopen the issue if you feel it necessary. Many thanks! @lkdvos |
Hi @hxjz233, my apologies, it seems like this previous message went under my radar. I'll try and get some time to investigate this week, in the meantime I re-opened the issue so it's less likely that I'll miss it 😉 Should I forget, definitely don't hesitate to ping me once more! |
I started playing around with this a bit, and I actually don't know what is going on here, but I think it's worth opening an issue with either CUDA or Zygote, as the issue is not actually TensorOperations-related. The following code produces the same error: A = CUDA.rand(ComplexF64, 2, 2)
function f(A)
normcoeff = maximum(abs.(A))
A = A / normcoeff
return maximum(abs.(A))
end
gradient(f, A)[1] I don't know enough of the inner workings of Zygote nor CUDA to know where to point you to, but I hope they will be able to help you further. |
Thanks for testing out! Probably be a CUDA or Zygote issue. My purpose was to write a line that would put a soft ceiling on a tensor which should be iteratively updated ( It can be a bit surprising for a beginner like me to see that finding a max element is not computationally cheaper than finding the squared norm, both for CPU and GPU. But anyway, many thanks for the inspiration on trying out other normalizations! Closing this issue because this is indeed not TensorOperations-related. If you feel that there is anything about those normalization functions that is worth mentioning I would surely appreciate it! |
I tested a bit further on a GPU version for my TensorOperations + Zygote code on CPU, and currently I meet new problem, giving me either Freed reference or nonbits exception when running the program. For most of the case demonstrated here,
@tensor
passes and@cutensor
gives me some error. Here you can have an example to the problem. Also I explained a bit on why I used a weird scalar function, but it's not that important for the case. Nevertheless, You can comment on those scalar functions if the behaviors intrigue youExample code
Version Info
I am looking for help on what can be done to resolve the freed reference or non_bitstype issue
The text was updated successfully, but these errors were encountered: