Skip to content
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

fix complex adaptive norms on GPU #347

Merged
merged 2 commits into from
Oct 7, 2019
Merged

fix complex adaptive norms on GPU #347

merged 2 commits into from
Oct 7, 2019

Conversation

ChrisRackauckas
Copy link
Member

No description provided.

@ChrisRackauckas
Copy link
Member Author

SciML/DifferentialEquations.jl#460

Now it works, but still throws the error. MWE:

using CuArrays
f(u,nothing,t) = 1/2 .*u
u0 = cu(rand(32,32).+ 1im*rand(32,32));
using OrdinaryDiffEq
prob = ODEProblem(f,u0,(0.0,1.0))
sol = solve(prob,Tsit5())
┌ Warning: calls to Base intrinsics might be GPU incompatible
│   exception =
│    You called hypot(x::T, y::T) where T<:Number in Base.Math at math.jl:541, maybe you intended to call hypot(x::Float64, y::Float64) 
in CUDAnative at C:\Users\accou\.julia\packages\CUDAnative\UWBIY\src\device\cuda\math.jl:291 instead?
│    Stacktrace:
│     [1] hypot at math.jl:541
│     [2] #23 at C:\Users\accou\.julia\packages\GPUArrays\fLiQ1\src\broadcast.jl:49
└ @ CUDAnative C:\Users\accou\.julia\packages\CUDAnative\UWBIY\src\compiler\irgen.jl:116

@maleadt maybe that warning doesn't need to exist?

@maleadt
Copy link
Contributor

maleadt commented Oct 7, 2019

@maleadt maybe that warning doesn't need to exist?

We assume Base intrinsics are incompatible if there's a CUDAnative alternative, and in this case CUDAnative.hypot exists. Does Base.hypot just work on the GPU? If so, maybe we should add a whitelist of supported intrinsics to CUDAnative.

@ChrisRackauckas
Copy link
Member Author

Yeah, it looks like it just needs to be whitelisted:

using CuArrays, LinearAlgebra
x = rand(Float32) + rand(Float32)*im
norm.(cu([x])) == norm.([x])
hypot.(cu([real(x)]),cu([imag(x)])) == hypot.([real(x)],[imag(x)])

@ChrisRackauckas ChrisRackauckas merged commit c8d96ca into master Oct 7, 2019
@ChrisRackauckas ChrisRackauckas deleted the complex_gpu branch October 7, 2019 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants