I have problem with executing Julia function:
function biotSavartCalculation(x,y,z,Segment,I,SegmentsOnElement,segmentlength,Bx,By,Bz)
xIndex=(blockIdx().x-1) * blockDim().x + threadIdx().x
yIndex=(blockIdx().y-1) * blockDim().y + threadIdx().y
zIndex=(blockIdx().z-1) * blockDim().z + threadIdx().z
offset=xIndex+(yIndex-1)*blockDim().x*gridDim().x+(zIndex-1)*blockDim().x*gridDim().x*blockDim().y*gridDim().y
for j=1:segmentlength
if variant[j]==1.0f0
for i=1:SegmentsOnElement-1
L=Segment[i+SegmentsOnElement*2+1,j]-Segment[i+SegmentsOnElement*2+1,j]
δx=x[xIndex]-Segment[i,j]
δy=y[yIndex]-Segment[i+SegmentsOnElement,j]
q=δx*δx+δy*δy
integral=0.0f0
try
integral = quadgk(u -> ((u-z)^2+q)^(-3/2), 0, L, rtol=1f-8)[1]
catch
end
Bx[offset]+=I[j]*integral*δy
By[offset]+=I[j]*integral*δx
end
else
...
return nothing
end
The error comunicate is:
ERROR: LoadError: CUDAnative.InvalidIRError(CUDAnative.CompilerJob(BiotSavartCalculation.biotSavartCalculation, Tuple{CuDeviceArray{Float32,1,CUDAnative.AS.Global},CuDeviceArray{Float32,1,CUDAnative.AS.Global},CuDeviceArray{Float32,1,CUDAnative.AS.Global},CuDeviceArray{Float32,2,CUDAnative.AS.Global},CuDeviceArray{Complex{Float32},2,CUDAnative.AS.Global},Int64,Int64,CuDeviceArray{Float32,3,CUDAnative.AS.Global},CuDeviceArray{Float32,3,CUDAnative.AS.Global},CuDeviceArray{Float32,3,CUDAnative.AS.Global}}, v"6.1.0", true, nothing, nothing, nothing, nothing, nothing), Tuple{String,Array{Base.StackTraces.StackFrame,1},Any}[("call to the Julia runtime", [biotSavartCalculation at BiotSavartCalculation.jl:22], "jl_excstack_state"), ("call to the Julia runtime", [biotSavartCalculation at BiotSavartCalculation.jl:22], "jl_enter_handler"), ("call to the Julia runtime", [biotSavartCalculation at BiotSavartCalculation.jl:22], "jl_setjmp"), ("call to the Julia runtime", [biotSavartCalculation at BiotSavartCalculation.jl:23], "jl_pop_handler"), ("call to the Julia runtime", [biotSavartCalculation at BiotSavartCalculation.jl:23], "jl_restore_excstack"), ("call through a literal pointer", [Type at boot.jl:433, Type at complex.jl:37, convert at number.jl:7, macro expansion at base.jl:43, macro expansion at pointer.jl:167, unsafe_store! at pointer.jl:167, setindex! at array.jl:84, biotSavartCalculation at BiotSavartCalculation.jl:26], :jl_symbol_n), ("call through a literal pointer", [Type at boot.jl:433, Type at complex.jl:37, convert at number.jl:7, macro expansion at base.jl:43, macro expansion at pointer.jl:167, unsafe_store! at pointer.jl:167, setindex! at array.jl:84, biotSavartCalculation at BiotSavartCalculation.jl:27], :jl_symbol_n), ("call to the Julia runtime", [biotSavartCalculation at BiotSavartCalculation.jl:51], "jl_excstack_state"), ("call to the Julia runtime", [biotSavartCalculation at BiotSavartCalculation.jl:51], "jl_enter_handler"), ("call to the Julia runtime", [biotSavartCalculation at BiotSavartCalculation.jl:51], "jl_setjmp") … ("dynamic function invocation", [#quadgk#20 at adapt.jl:151, #quadgk at none:0, biotSavartCalculation at BiotSavartCalculation.jl:52], (::getfield(QuadGK, Symbol("#kw##quadgk")))(::Any, ::typeof(QuadGK.quadgk), f, a::T, b::T, c::T...) where T in QuadGK), ("call to the Julia runtime", [print_to_string at io.jl:113,
multiple call sites at unknown:0], "jl_f_tuple"), ("call to the Julia runtime", [getindex at tuple.jl:24, iterate at tuple.jl:43, iterate at tuple.jl:43, print_to_string at io.jl:122, multiple call sites at unknown:0], "jl_f_getfield"), ("dynamic function invocation", [print_to_string at io.jl:123, multiple call sites at unknown:0], print), ("call through a literal pointer", [_growend! at array.jl:812, resize! at array.jl:1004, print_to_string at io.jl:125, multiple call sites at unknown:0], :jl_array_grow_end), ("call through a literal pointer", [_deleteend! at array.jl:821, resize! at array.jl:1009, print_to_string at io.jl:125, multiple call sites at unknown:0], :jl_array_del_end), ("call through a literal pointer", [Type at string.jl:39, print_to_string at io.jl:125, multiple call
sites at unknown:0], :jl_array_to_string), ("call through a literal pointer", [_string_n at string.jl:60, StringVector at iobuffer.jl:31, #IOBuffer#316 at iobuffer.jl:114, Type at none:0, print_to_string at io.jl:121, multiple call sites at unknown:0], :jl_alloc_string), ("call through a literal pointer", [unsafe_wrap at string.jl:71, StringVector at iobuffer.jl:31, #IOBuffer#316 at iobuffer.jl:114, Type at none:0, print_to_string at io.jl:121, multiple call sites at unknown:0], :jl_string_to_array), ("call through a literal pointer", [fill! at array.jl:365, #IOBuffer#316 at iobuffer.jl:121, Type at none:0, print_to_string at io.jl:121, multiple call sites at unknown:0], :memset)])
All the "call to the Julia runtime"
reffering to line 23-27 that is:
try
integral = quadgk(u -> ((u-z)^2+q)^(-3/2), 0, L, rtol=1f-8)[1]
catch
end
Bx[offset]+=I[j]*integral*δy
By[offset]+=I[j]*integral*δx