-
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
AbstractIrrational
does not play nice with CUDA
#73
Comments
What exactly is the problem here? IrrationalConstants works in exactly the same way as the irrational constants in Base, so I wonder if the same problem can be provoked with e.g. I'm very surprised that CUDA cares about the BigFloat methods if clearly only the Float32 constant is needed. Generally, I'm hesistant to remove IrrationalConstants since it is generally useful and used in Base and throughout the ecosystem, so it seems this problem should be fixed in a different way. |
Let me try to summon the CUDA experts. |
I spoke with Tim Besard; it seems there is no easy way to do this as long as |
|
I figured out what's going on: The fallback definitions of the comparison operators (https://github.com/JuliaLang/julia/blob/6e2e6d00258b930f5909d576f2b3510ffa49c4bf/base/irrationals.jl#L96 and surrounding lines) are based not on I wonder if we should extend the |
IrrationalConstants
doesn't play nice with CUDA AbstractIrrational
does not play nice with CUDA
As suspected, the error is not IrrationalConstants specific: For instance, julia> using CUDA, IrrationalConstants
julia> log1mexp_cuda(x::Real) = twoπ*exp(x) < π ? log1p(-exp(x)) : log(-expm1(x))
log1mexp_cuda (generic function with 1 method)
julia> log1mexp_cuda.(CuVector([-1f0, -2f0, -3f0]))
... errors as well. I updated the title of the issue to reflect this. |
Oh I see! I was scratching my head looking at the |
Sure, it will be present in basically all code paths that involve comparisons of |
The general issue still exists but should maybe raised upstream. The case in the OP was fixed by #75. |
Okay, then I'll close this for now. I'll raise this upstream some time. |
One addition: I ran into the same problem starting with Julia 1.9 (1.8 works fine) and opened an issue on the CUDA project which was moved to the GPUCompiler project: JuliaGPU/GPUCompiler.jl#384 |
Hi, it seems that many of the functions are not compatible with
CUDA.jl
out of the box due to dynamic precision (?). Here's a MWE:Simply changing the definition of
log1mexp
to the following fixes the issue:Do we really need
IrrationalConstants
here?The text was updated successfully, but these errors were encountered: