Julia 1.9.0-DEV.239 with CUDA CuArray

Hello, I would like to ask if the following error regarding CuArray is Julia version specific. I was able to run the following basic CuArray test with Julia 1.8.0-Dev.1370, but when I tried with the latest release of Julia 1.9.0-DEV.239, it gave the following error. Can anyone help look into the problem and provide a solution to get it around? Thanks!

[jin6@node0026 Julia-03232022]$ ./julia

_

_ _ _ (_) _ | Documentation: https://docs.julialang.org

(_) | (_) (_) |

_ _ | | __ _ | Type “?” for help, “]?” for Pkg help.

| | | | | | |/ _` | |

| | || | | | (| | | Version 1.9.0-DEV.239 (2022-03-23)

/ |_|||_’_| | Commit a5fe945b4f (0 days old master)

|__/ |

julia> VERSION

v"1.9.0-DEV.239"

julia> import Pkg; Pkg.add(“CUDA”)

Updating registry at ~/.julia/registries/General

Updating git-repo https://github.com/JuliaRegistries/General.git

Resolving package versions…

No Changes to ~/.julia/environments/v1.9/Project.toml

No Changes to ~/.julia/environments/v1.9/Manifest.toml

Precompiling project…

46 dependencies successfully precompiled in 44 seconds

julia> using CUDA

julia> CUDA.versioninfo()

CUDA toolkit 11.6, artifact installation

NVIDIA driver 470.42.1, for CUDA 11.4

CUDA driver 11.4

Libraries:

  • CUBLAS: 11.8.1

  • CURAND: 10.2.9

  • CUFFT: 10.7.0

  • CUSOLVER: 11.3.2

  • CUSPARSE: 11.7.1

  • CUPTI: 16.0.0

  • NVML: 11.0.0+470.42.1

  • CUDNN: 8.30.2 (for CUDA 11.5.0)

  • CUTENSOR: 1.4.0 (for CUDA 11.5.0)

Toolchain:

  • Julia: 1.9.0-DEV.239

  • LLVM: 13.0.1

  • PTX ISA support: 3.2, 4.0, 4.1, 4.2, 4.3, 5.0, 6.0, 6.1, 6.3, 6.4, 6.5, 7.0

  • Device capability support: sm_35, sm_37, sm_50, sm_52, sm_53, sm_60, sm_61, sm_62, sm_70, sm_72, sm_75, sm_80

1 device:

0: Tesla V100-PCIE-16GB (sm_70, 15.756 GiB / 15.782 GiB available)

julia> [CUDA.capability(dev) for dev in CUDA.devices()]

1-element Vector{VersionNumber}:

v"7.0.0"

julia> a = CuArray([1,2,3,4])

4-element CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}:

1

2

3

4

julia> a .+= 1

ERROR: MethodError: no method matching return_types(::GPUArrays.var"#broadcast_kernel#17", ::Type{Tuple{CUDA.CuKernelContext, CuDeviceVector{Int64, 1}, Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(+), Tuple{Base.Broadcast.Extruded{CuDeviceVector{Int64, 1}, Tuple{Bool}, Tuple{Int64}}, Int64}}, Int64}}, ::GPUCompiler.GPUInterpreter)

Closest candidates are:

return_types(::Any, ::Any; world, interp) at reflection.jl:1294

return_types(::Any) at reflection.jl:1294

Stacktrace:

[1] check_method( job::GPUCompiler.CompilerJob )

@ GPUCompiler ~/.julia/packages/GPUCompiler/I9fZc/src/validation.jl:19

[2] macro expansion

@ ~/.julia/packages/TimerOutputs/nDhDw/src/TimerOutput.jl:252 [inlined]

[3] macro expansion

@ ~/.julia/packages/GPUCompiler/I9fZc/src/driver.jl:89 [inlined]

[4] emit_julia( job::GPUCompiler.CompilerJob )

@ GPUCompiler ~/.julia/packages/GPUCompiler/I9fZc/src/utils.jl:64

[5] cufunction_compile( job::GPUCompiler.CompilerJob )

@ CUDA ~/.julia/packages/CUDA/5jdFl/src/compiler/execution.jl:324

[6] cached_compilation( cache::Dict{UInt64, Any}, job::GPUCompiler.CompilerJob, compiler::typeof(CUDA.cufunction_compile), linker::typeof(CUDA.cufunction_link) )

@ GPUCompiler ~/.julia/packages/GPUCompiler/I9fZc/src/cache.jl:90

[7] cufunction( f::GPUArrays.var"#broadcast_kernel#17", tt::Type{Tuple{CUDA.CuKernelContext, CuDeviceVector{Int64, 1}, Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(+), Tuple{Base.Broadcast.Extruded{CuDeviceVector{Int64, 1}, Tuple{Bool}, Tuple{Int64}}, Int64}}, Int64}}; name::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}} )

@ CUDA ~/.julia/packages/CUDA/5jdFl/src/compiler/execution.jl:297

[8] cufunction

@ ~/.julia/packages/CUDA/5jdFl/src/compiler/execution.jl:291 [inlined]

[9] macro expansion

@ ~/.julia/packages/CUDA/5jdFl/src/compiler/execution.jl:102 [inlined]

[10] #launch_heuristic#282

@ ~/.julia/packages/CUDA/5jdFl/src/gpuarrays.jl:17 [inlined]

[11] _copyto!

@ ~/.julia/packages/GPUArrays/VNhDf/src/host/broadcast.jl:73 [inlined]

[12] materialize!

@ ~/.julia/packages/GPUArrays/VNhDf/src/host/broadcast.jl:51 [inlined]

[13] materialize!( dest::CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, bc::Base.Broadcast.Broadcasted{CUDA.CuArrayStyle{1}, Nothing, typeof(+), Tuple{CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}, Int64}} )

@ Base.Broadcast ./broadcast.jl:868

[14] top-level scope

@ REPL[7]:1

[15] top-level scope

@ ~/.julia/packages/CUDA/5jdFl/src/initialization.jl:52

Unreleased versions of Julia are not supported. This specific issue is fixed on GPUCompiler#master, but there may be other problems.

2 Likes

Thanks, Tim. May I ask what’s the latest version of Julia that support CUDA CuArray then?

Officially, I’d guess it’s 1.7 (since 1.8 is still in beta).

1.8-beta1 has bugs that break CUDA.jl; beta2 should work once it’s released. Officially, 1.7 indeed.

Thank you both. I git checkout v1.7.2 again, everything seems to work except @atomic macro. Is it a bug?

What do you mean by ‘except’? Does it throws an error? Calculates anything wrong? etc. The @atomic macro is tested by CUDA.jl’s CI so I doubt it just broke.

can you use official binary instead of compiling it yourself?

I got errors as shown in the following picture:

Can you please inform me how to get the official binary?
I was following https://github.com/JuliaLang/julia/tree/v1.7.2 to get source from GitHub and build it.
Thanks!

https://julialang.org/downloads/

You’re using @atomic from Base, not from CUDA.jl. Write CUDA.@atomic.

Thanks, adding CUDA. solves the problem!