I am having issues with the cuda/flux packages when using the gpu.
Example code
using Flux, CUDA
m = Dense(10,5) |> gpu
x = rand(10) |> gpu
m(x)
> UndefVarError: parameters not defined
versions
Julia 1.6.1
CUDA 11.4
Running test of CUDA
(@v1.6) pkg> test CUDA
Testing CUDA
Status `/tmp/jl_VHbM3L/Project.toml`
[79e6a3ab] Adapt v3.3.1
[ab4f0b2a] BFloat16s v0.1.0
[052768ef] CUDA v2.6.3
[864edb3b] DataStructures v0.18.9
[7a1cc6ca] FFTW v1.4.3
[1a297f60] FillArrays v0.11.9
[f6369f11] ForwardDiff v0.10.18
[0c68f7d7] GPUArrays v6.4.1
[a98d9a8b] Interpolations v0.13.3
[872c559c] NNlib v0.7.25
[ade2ca70] Dates `@stdlib/Dates`
[8ba89e20] Distributed `@stdlib/Distributed`
[37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra`
[de0858da] Printf `@stdlib/Printf`
[3fa0cd96] REPL `@stdlib/REPL`
[9a3f8284] Random `@stdlib/Random`
[2f01184e] SparseArrays `@stdlib/SparseArrays`
[10745b16] Statistics `@stdlib/Statistics`
[8dfed614] Test `@stdlib/Test`
Status `/tmp/jl_VHbM3L/Manifest.toml`
[621f4979] AbstractFFTs v1.0.1
[79e6a3ab] Adapt v3.3.1
[13072b0f] AxisAlgorithms v1.0.0
[ab4f0b2a] BFloat16s v0.1.0
[fa961155] CEnum v0.4.1
[052768ef] CUDA v2.6.3
[d360d2e6] ChainRulesCore v0.10.13
[bbf7d656] CommonSubexpressions v0.3.0
[34da2185] Compat v3.32.0
[864edb3b] DataStructures v0.18.9
[163ba53b] DiffResults v1.0.3
[b552c78f] DiffRules v1.0.2
[ffbed154] DocStringExtensions v0.8.5
[e2ba6199] ExprTools v0.1.6
[7a1cc6ca] FFTW v1.4.3
[1a297f60] FillArrays v0.11.9
[f6369f11] ForwardDiff v0.10.18
[0c68f7d7] GPUArrays v6.4.1
[61eb1bfa] GPUCompiler v0.10.0
[a98d9a8b] Interpolations v0.13.3
[692b3bcd] JLLWrappers v1.3.0
[929cbde3] LLVM v3.9.0
[2ab3a3ac] LogExpFunctions v0.2.5
[1914dd2f] MacroTools v0.5.6
[c03570c3] Memoize v0.4.4
[872c559c] NNlib v0.7.25
[77ba4419] NaNMath v0.3.5
[6fe1bfb0] OffsetArrays v1.10.3
[bac558e1] OrderedCollections v1.4.1
[21216c6a] Preferences v1.2.2
[c84ed2f1] Ratios v0.4.0
[189a3867] Reexport v1.1.0
[ae029012] Requires v1.1.3
[6c6a2e73] Scratch v1.1.0
[276daf66] SpecialFunctions v1.6.0
[90137ffa] StaticArrays v1.2.6
[a759f4b9] TimerOutputs v0.5.12
[efce3f68] WoodburyMatrices v0.5.3
[f5851436] FFTW_jll v3.3.9+8
[1d5cc7b8] IntelOpenMP_jll v2018.0.3+2
[856f044c] MKL_jll v2021.1.1+1
[efe28fd5] OpenSpecFun_jll v0.5.5+0
[0dad84c5] ArgTools `@stdlib/ArgTools`
[56f22d72] Artifacts `@stdlib/Artifacts`
[2a0f44e3] Base64 `@stdlib/Base64`
[ade2ca70] Dates `@stdlib/Dates`
[8bb1440f] DelimitedFiles `@stdlib/DelimitedFiles`
[8ba89e20] Distributed `@stdlib/Distributed`
[f43a241f] Downloads `@stdlib/Downloads`
[b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils`
[4af54fe1] LazyArtifacts `@stdlib/LazyArtifacts`
[b27032c2] LibCURL `@stdlib/LibCURL`
[76f85450] LibGit2 `@stdlib/LibGit2`
[8f399da3] Libdl `@stdlib/Libdl`
[37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra`
[56ddb016] Logging `@stdlib/Logging`
[d6f4376e] Markdown `@stdlib/Markdown`
[a63ad114] Mmap `@stdlib/Mmap`
[ca575930] NetworkOptions `@stdlib/NetworkOptions`
[44cfe95a] Pkg `@stdlib/Pkg`
[de0858da] Printf `@stdlib/Printf`
[3fa0cd96] REPL `@stdlib/REPL`
[9a3f8284] Random `@stdlib/Random`
[ea8e919c] SHA `@stdlib/SHA`
[9e88b42a] Serialization `@stdlib/Serialization`
[1a1011a3] SharedArrays `@stdlib/SharedArrays`
[6462fe0b] Sockets `@stdlib/Sockets`
[2f01184e] SparseArrays `@stdlib/SparseArrays`
[10745b16] Statistics `@stdlib/Statistics`
[fa267f1f] TOML `@stdlib/TOML`
[a4e569a6] Tar `@stdlib/Tar`
[8dfed614] Test `@stdlib/Test`
[cf7118a7] UUIDs `@stdlib/UUIDs`
[4ec0a83e] Unicode `@stdlib/Unicode`
[e66e0078] CompilerSupportLibraries_jll `@stdlib/CompilerSupportLibraries_jll`
[deac9b47] LibCURL_jll `@stdlib/LibCURL_jll`
[29816b5a] LibSSH2_jll `@stdlib/LibSSH2_jll`
[c8ffd9c3] MbedTLS_jll `@stdlib/MbedTLS_jll`
[14a3606d] MozillaCACerts_jll `@stdlib/MozillaCACerts_jll`
[83775a58] Zlib_jll `@stdlib/Zlib_jll`
[8e850ede] nghttp2_jll `@stdlib/nghttp2_jll`
[3f19e933] p7zip_jll `@stdlib/p7zip_jll`
Testing Running tests...
ERROR: LoadError: LoadError: UndefVarError: parameters not defined
Stacktrace:
[1] call!(builder::LLVM.Builder, rt::GPUCompiler.Runtime.RuntimeMethodInstance, args::Vector{LLVM.ConstantExpr})
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/rtlib.jl:57
[2] emit_exception!(builder::LLVM.Builder, name::String, inst::LLVM.CallInst)
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/irgen.jl:262
[3] macro expansion
@ ~/.julia/packages/GPUCompiler/XwWPj/src/irgen.jl:212 [inlined]
[4] macro expansion
@ ~/.julia/packages/TimerOutputs/ZQ0rt/src/TimerOutput.jl:236 [inlined]
[5] lower_throw!(mod::LLVM.Module)
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/irgen.jl:173
[6] module_pass_callback(ptr::Ptr{Nothing}, data::Ptr{Nothing})
@ LLVM ~/.julia/packages/LLVM/srSVa/src/pass.jl:21
[7] macro expansion
@ ~/.julia/packages/LLVM/srSVa/src/util.jl:85 [inlined]
[8] LLVMRunPassManager
@ ~/.julia/packages/LLVM/srSVa/lib/11/libLLVM_h.jl:4707 [inlined]
[9] run!
@ ~/.julia/packages/LLVM/srSVa/src/passmanager.jl:39 [inlined]
[10] (::GPUCompiler.var"#51#53"{GPUCompiler.CompilerJob{GPUCompiler.PTXCompilerTarget, CUDA.CUDACompilerParams, GPUCompiler.FunctionSpec{typeof(GPUCompiler.Runtime.box_bool), Tuple{Bool}}}, LLVM.Module})(pm::LLVM.ModulePassManager)
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/irgen.jl:82
[11] LLVM.ModulePassManager(::GPUCompiler.var"#51#53"{GPUCompiler.CompilerJob{GPUCompiler.PTXCompilerTarget, CUDA.CUDACompilerParams, GPUCompiler.FunctionSpec{typeof(GPUCompiler.Runtime.box_bool), Tuple{Bool}}}, LLVM.Module})
@ LLVM ~/.julia/packages/LLVM/srSVa/src/passmanager.jl:33
[12] macro expansion
@ ~/.julia/packages/TimerOutputs/ZQ0rt/src/TimerOutput.jl:236 [inlined]
[13] irgen(job::GPUCompiler.CompilerJob, method_instance::Core.MethodInstance, world::UInt64)
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/irgen.jl:65
[14] macro expansion
@ ~/.julia/packages/GPUCompiler/XwWPj/src/driver.jl:130 [inlined]
[15] macro expansion
@ ~/.julia/packages/TimerOutputs/ZQ0rt/src/TimerOutput.jl:236 [inlined]
[16] macro expansion
@ ~/.julia/packages/GPUCompiler/XwWPj/src/driver.jl:129 [inlined]
[17] emit_llvm(job::GPUCompiler.CompilerJob, method_instance::Any, world::UInt64; libraries::Bool, deferred_codegen::Bool, optimize::Bool, only_entry::Bool)
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/utils.jl:62
[18] codegen(output::Symbol, job::GPUCompiler.CompilerJob; libraries::Bool, deferred_codegen::Bool, optimize::Bool, strip::Bool, validate::Bool, only_entry::Bool)
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/driver.jl:55
[19] emit_function!(mod::LLVM.Module, job::GPUCompiler.CompilerJob, f::Function, method::GPUCompiler.Runtime.RuntimeMethodInstance)
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/rtlib.jl:76
[20] build_runtime(job::GPUCompiler.CompilerJob, ctx::LLVM.Context)
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/rtlib.jl:126
[21] load_runtime(job::GPUCompiler.CompilerJob, ctx::LLVM.Context)
@ GPUCompiler ~/.julia/packages/GPUCompiler/XwWPj/src/rtlib.jl:174
[22] (::CUDA.var"#186#188"{Set{VersionNumber}, CUDA.CUDACompilerParams, GPUCompiler.FunctionSpec{CUDA.var"#185#187", Tuple{}}})(ctx::LLVM.Context)
@ CUDA ~/.julia/packages/CUDA/M4jkK/src/device/runtime.jl:21
[23] LLVM.Context(f::CUDA.var"#186#188"{Set{VersionNumber}, CUDA.CUDACompilerParams, GPUCompiler.FunctionSpec{CUDA.var"#185#187", Tuple{}}})
@ LLVM ~/.julia/packages/LLVM/srSVa/src/core/context.jl:22
[24] JuliaContext
@ ~/.julia/packages/LLVM/srSVa/src/interop/base.jl:29 [inlined]
[25] precompile_runtime
@ ~/.julia/packages/CUDA/M4jkK/src/device/runtime.jl:15 [inlined]
[26] precompile_runtime()
@ CUDA ~/.julia/packages/CUDA/M4jkK/src/device/runtime.jl:13
[27] top-level scope
@ ~/.julia/packages/CUDA/M4jkK/test/setup.jl:23
[28] include(fname::String)
@ Base.MainInclude ./client.jl:444
[29] top-level scope
@ ~/.julia/packages/CUDA/M4jkK/test/runtests.jl:51
[30] include(fname::String)
@ Base.MainInclude ./client.jl:444
[31] top-level scope
@ none:6
in expression starting at /home/mypop/.julia/packages/CUDA/M4jkK/test/setup.jl:23
in expression starting at /home/mypop/.julia/packages/CUDA/M4jkK/test/runtests.jl:51
ERROR: Package CUDA errored during testing