# Error in CUDA.jl

**URL:** <https://discourse.julialang.org/t/error-in-cuda-jl/65197>\
**Category:** GPU\
**Created:** [July 23, 2021, 5:16pm UTC](https://discourse.julialang.org/t/error-in-cuda-jl/65197 "2021-07-23T17:16:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmmmachado](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jmmmachado](https://discourse.julialang.org/u/jmmmachado)\
**Post date:** [July 23, 2021, 5:16pm UTC](https://discourse.julialang.org/t/error-in-cuda-jl/65197/1 "2021-07-23T17:16:20Z")

</div>

Hello everyone!

I am having some issues with CUDA.jl. At first I thought it was an issue with the drivers from NVIDIA or the CUDA installation on my PC, so I uninstalled the drivers, the cuda toolkits, everything. However when I installed the nvidia-driver-470, it identifies a CUDA 11.4 instalation before I re install CUDA.

Anyways, CUDA seems to work well when I run some pytorch codes. The problem is when I try to using CUDA.jl. So I tried running `Pkg.test(“CUDA”), I get the following

> 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/jmmmachado/.julia/packages/CUDA/M4jkK/test/setup.jl:23  
> in expression starting at /home/jmmmachado/.julia/packages/CUDA/M4jkK/test/runtests.jl:51  
> ERROR: Package CUDA errored during testing  
> Stacktrace:  
> [1] pkgerror(msg::String)  
> @ Pkg.Types /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:55  
> [2] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, julia\_args::Cmd, test\_args::Cmd, test\_fn::Nothing)  
> @ Pkg.Operations /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:1687  
> [3] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, test\_fn::Nothing, julia\_args::Cmd, test\_args::Cmd, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})  
> @ Pkg.API /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:336  
> [4] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec})  
> @ Pkg.API /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:323  
> [5] #test#62  
> @ /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:73 [inlined]  
> [6] test  
> @ /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:72 [inlined]  
> [7] #test#61  
> @ /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:70 [inlined]  
> [8] test  
> @ /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:70 [inlined]  
> [9] test(pkg::String; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})  
> @ Pkg.API /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:69  
> [10] test(pkg::String)  
> @ Pkg.API /buildworker/worker/package\_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:69  
> [11] top-level scope  
> @ REPL[2]:1

Does anybody know what could be wrong with my settup? Thanks already 🙂

`

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [July 26, 2021, 8:12am UTC](https://discourse.julialang.org/t/error-in-cuda-jl/65197/2 "2021-07-26T08:12:55Z")

</div>

Update your packages: this is [Both ExprTools and LLVM export "parameters" · Issue #214 · JuliaGPU/GPUCompiler.jl · GitHub](https://github.com/JuliaGPU/GPUCompiler.jl/issues/214), caused by a new export in ExprTools.jl.

---

<div class="post-metadata">

**Author:** ![jmmmachado](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jmmmachado](https://discourse.julialang.org/u/jmmmachado)\
**Post date:** [July 27, 2021, 8:07am UTC](https://discourse.julialang.org/t/error-in-cuda-jl/65197/3 "2021-07-27T08:07:07Z")

</div>

This worked! Thanks so much!

---

<div class="post-metadata">

**Author:** ![Dieter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dieter/32/29860_2.png) [@Dieter](https://discourse.julialang.org/u/Dieter)\
**Post date:** [September 2, 2021, 8:43pm UTC](https://discourse.julialang.org/t/error-in-cuda-jl/65197/4 "2021-09-02T20:43:44Z")

</div>

Hi Maleadt,

I have the same problem when testing CUDA

```julia
 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

```

I have still updated both packages

```julia

(@v1.6) pkg> update LLVM
    Updating registry at `~/.julia/registries/General`
  No Changes to `~/.julia/environments/v1.6/Project.toml`
  No Changes to `~/.julia/environments/v1.6/Manifest.toml`

(@v1.6) pkg> update ExprTools
    Updating registry at `~/.julia/registries/General`
  No Changes to `~/.julia/environments/v1.6/Project.toml`
  No Changes to `~/.julia/environments/v1.6/Manifest.toml`

```

but this did not change anything when testing CUDA. Are there further steps neccessary?

---

<div class="post-metadata">

**Author:** ![Dieter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dieter/32/29860_2.png) [@Dieter](https://discourse.julialang.org/u/Dieter)\
**Post date:** [September 2, 2021, 10:34pm UTC](https://discourse.julialang.org/t/error-in-cuda-jl/65197/5 "2021-09-02T22:34:20Z")

</div>

Problem already solved after deleting Manifest.toml and Project.toml and installing all needed packages again
