You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting a compile time error with the following short program:
#################
#GPU parallel
using PyCall, Printf
using oneAPI
cv2 = pyimport("cv2")
function gpu_parallel_paint!(pixels, t, n)
x = get_global_id(0) - 1
y = get_global_id(1) - 1
c = -0.8f0 + cos(t) * 0.2f0im
z = (y/n - 1 + (x/n - 0.5f0)im) * 2.0f0
iterations = 0
while sqrt(abs2(z)) < 20 && iterations < 50
z = z*z + c
iterations += 1
end @inbounds pixels[x][y] = 1.0f0 - iterations * 0.02f0
return nothing
end
frames = 1000
n=320
pixels=oneAPI.fill(0.0f0, n, 2*n)
ti = 0.0f0
for i = 1:frames
t = i0.03f0
global ti += @Elapsed@oneapi items=(n, 2n) gpu_parallel_paint!(pixels, t, n)
cv2.imshow("Julia Set", pixels)
cv2.waitKey(1)
end
fps = Int(floor(frames/ti))
println("FPS: ", fps)
cv2.destroyAllWindows()
################
Detailed error message says the kernel function returns a value of 'Union{}' even though I put "return nothing" in the kernel. I am new to Julia language, so it could be a mistake on my part.
Thanks,
Peng.
ERROR: LoadError: GPU compilation of kernel gpu_parallel_paint!(oneDeviceArray{Float32,2,1}, Float32, Int64) failed
KernelError: kernel returns a value of type Union{}
Make sure your kernel function ends in return, return nothing or nothing.
If the returned value is of type Union{}, your Julia code probably throws an exception.
Inspect the code with @device_code_warntype for more details.
Stacktrace:
[1] check_method(::GPUCompiler.CompilerJob) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/validation.jl:18
[2] macro expansion at /home/peng/.julia/packages/TimerOutputs/dVnaw/src/TimerOutput.jl:206 [inlined]
[3] codegen(::Symbol, ::GPUCompiler.CompilerJob; libraries::Bool, deferred_codegen::Bool, optimize::Bool, strip::Bool, validate::Bool, only_entry::Bool) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/driver.jl:63
[4] compile(::Symbol, ::GPUCompiler.CompilerJob; libraries::Bool, deferred_codegen::Bool, optimize::Bool, strip::Bool, validate::Bool, only_entry::Bool) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/driver.jl:39
[5] compile at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/driver.jl:35 [inlined]
[6] #zefunction_compile#42 at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:123 [inlined]
[7] zefunction_compile(::GPUCompiler.FunctionSpec{typeof(gpu_parallel_paint!),Tuple{oneDeviceArray{Float32,2,1},Float32,Int64}}) at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:120
[8] check_cache(::Dict{UInt64,Any}, ::Any, ::Any, ::GPUCompiler.FunctionSpec{typeof(gpu_parallel_paint!),Tuple{oneDeviceArray{Float32,2,1},Float32,Int64}}, ::UInt64; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/cache.jl:40
[9] gpu_parallel_paint! at /home/peng/workspace/sycl-coding/Julia-Set/JuliaLang/fractal_gpu.jl:7 [inlined]
[10] cached_compilation(::Dict{UInt64,Any}, ::typeof(oneAPI.zefunction_compile), ::typeof(oneAPI.zefunction_link), ::GPUCompiler.FunctionSpec{typeof(gpu_parallel_paint!),Tuple{oneDeviceArray{Float32,2,1},Float32,Int64}}; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/cache.jl:0
[11] cached_compilation(::Dict{UInt64,Any}, ::Function, ::Function, ::GPUCompiler.FunctionSpec{typeof(gpu_parallel_paint!),Tuple{oneDeviceArray{Float32,2,1},Float32,Int64}}) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/cache.jl:65
[12] zefunction(::Function, ::Type{T} where T; name::Nothing, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:113
[13] zefunction(::Function, ::Type{T} where T) at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:111
[14] macro expansion at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:34 [inlined]
[15] macro expansion at ./timing.jl:233 [inlined]
[16] top-level scope at /home/peng/workspace/sycl-coding/Julia-Set/JuliaLang/fractal_gpu.jl:27
[17] include(::Function, ::Module, ::String) at ./Base.jl:380
[18] include(::Module, ::String) at ./Base.jl:368
[19] exec_options(::Base.JLOptions) at ./client.jl:296
[20] _start() at ./client.jl:506
The text was updated successfully, but these errors were encountered:
I am getting a compile time error with the following short program:
#################
#GPU parallel
using PyCall, Printf
using oneAPI
cv2 = pyimport("cv2")
function gpu_parallel_paint!(pixels, t, n)
x = get_global_id(0) - 1
y = get_global_id(1) - 1
c = -0.8f0 + cos(t) * 0.2f0im
z = (y/n - 1 + (x/n - 0.5f0)im) * 2.0f0
iterations = 0
while sqrt(abs2(z)) < 20 && iterations < 50
z = z*z + c
iterations += 1
end
@inbounds pixels[x][y] = 1.0f0 - iterations * 0.02f0
return nothing
end
frames = 1000
n=320
pixels=oneAPI.fill(0.0f0, n, 2*n)
ti = 0.0f0
for i = 1:frames
t = i0.03f0
global ti += @Elapsed @oneapi items=(n, 2n) gpu_parallel_paint!(pixels, t, n)
cv2.imshow("Julia Set", pixels)
cv2.waitKey(1)
end
fps = Int(floor(frames/ti))
println("FPS: ", fps)
cv2.destroyAllWindows()
################
Detailed error message says the kernel function returns a value of 'Union{}' even though I put "return nothing" in the kernel. I am new to Julia language, so it could be a mistake on my part.
Thanks,
Peng.
ERROR: LoadError: GPU compilation of kernel gpu_parallel_paint!(oneDeviceArray{Float32,2,1}, Float32, Int64) failed
KernelError: kernel returns a value of type
Union{}
Make sure your kernel function ends in
return
,return nothing
ornothing
.If the returned value is of type
Union{}
, your Julia code probably throws an exception.Inspect the code with
@device_code_warntype
for more details.Stacktrace:
[1] check_method(::GPUCompiler.CompilerJob) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/validation.jl:18
[2] macro expansion at /home/peng/.julia/packages/TimerOutputs/dVnaw/src/TimerOutput.jl:206 [inlined]
[3] codegen(::Symbol, ::GPUCompiler.CompilerJob; libraries::Bool, deferred_codegen::Bool, optimize::Bool, strip::Bool, validate::Bool, only_entry::Bool) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/driver.jl:63
[4] compile(::Symbol, ::GPUCompiler.CompilerJob; libraries::Bool, deferred_codegen::Bool, optimize::Bool, strip::Bool, validate::Bool, only_entry::Bool) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/driver.jl:39
[5] compile at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/driver.jl:35 [inlined]
[6] #zefunction_compile#42 at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:123 [inlined]
[7] zefunction_compile(::GPUCompiler.FunctionSpec{typeof(gpu_parallel_paint!),Tuple{oneDeviceArray{Float32,2,1},Float32,Int64}}) at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:120
[8] check_cache(::Dict{UInt64,Any}, ::Any, ::Any, ::GPUCompiler.FunctionSpec{typeof(gpu_parallel_paint!),Tuple{oneDeviceArray{Float32,2,1},Float32,Int64}}, ::UInt64; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/cache.jl:40
[9] gpu_parallel_paint! at /home/peng/workspace/sycl-coding/Julia-Set/JuliaLang/fractal_gpu.jl:7 [inlined]
[10] cached_compilation(::Dict{UInt64,Any}, ::typeof(oneAPI.zefunction_compile), ::typeof(oneAPI.zefunction_link), ::GPUCompiler.FunctionSpec{typeof(gpu_parallel_paint!),Tuple{oneDeviceArray{Float32,2,1},Float32,Int64}}; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/cache.jl:0
[11] cached_compilation(::Dict{UInt64,Any}, ::Function, ::Function, ::GPUCompiler.FunctionSpec{typeof(gpu_parallel_paint!),Tuple{oneDeviceArray{Float32,2,1},Float32,Int64}}) at /home/peng/.julia/packages/GPUCompiler/ze8Ok/src/cache.jl:65
[12] zefunction(::Function, ::Type{T} where T; name::Nothing, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:113
[13] zefunction(::Function, ::Type{T} where T) at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:111
[14] macro expansion at /home/peng/.julia/packages/oneAPI/Hn0Ia/src/compiler/execution.jl:34 [inlined]
[15] macro expansion at ./timing.jl:233 [inlined]
[16] top-level scope at /home/peng/workspace/sycl-coding/Julia-Set/JuliaLang/fractal_gpu.jl:27
[17] include(::Function, ::Module, ::String) at ./Base.jl:380
[18] include(::Module, ::String) at ./Base.jl:368
[19] exec_options(::Base.JLOptions) at ./client.jl:296
[20] _start() at ./client.jl:506
The text was updated successfully, but these errors were encountered: