Hi, I’m receiving runtime errors from julia when playing with the following simple code
>
> julia> using CUDA, SpecialFunctions
>
> julia> function cutest(x::Float64,f::Float64)
> c=besselj0(f);
> return x+c
> end
> cutest (generic function with 1 method)
>
> julia> x=CuVector(rand(10));
>
> julia> y=cutest.(x,1.0);
>
> julia> y
> 10-element CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}:
> 1.2543758351300334
> 1.6969145783025747
> 0.772833790043381
> 1.5466838680623587
> 0.9814961041987019
> 1.3892472218597938
> 1.5766825893406144
> 1.3715270039175633
> 1.070043997005175
> 1.4994660984390684
>
> julia> function cutest(x::Float64,f::ComplexF64)
> c=besselj0(f);
> return x+c
> end
> cutest (generic function with 2 methods)
>
> julia> y=cutest.(x,1.0+0.0im);
> ERROR: InvalidIRError: compiling kernel #broadcast_kernel#17(CUDA.CuKernelContext, CuDeviceVector{ComplexF64, 1}, Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(cutest), Tuple{Base.Broadcast.Extruded{CuDeviceVector{Float64, 1}, Tuple{Bool}, Tuple{Int64}}, ComplexF64}}, Int64) resulted in invalid LLVM IR
> Reason: unsupported call to the Julia runtime (call to jl_lazy_load_and_lookup)
It looks like the besselj0
function is giving some trouble when argument is complex. If I replace it with, e.g., exp
, there is no error. How do I avoid this error? Thanks in advance.