CUDAKernels not defined error in KernelAbstractions example

Hi all,

I am new to Julia and am currently trying to run performant_matmul.jl example present in KernelsAbstractions.jl. I have added CUDA.jl to my environment which I created using activate & instantiate using the Project.toml present in KA’s directory. I keep getting CUDAKernels not defined error.

This might be a stupid mistake but am not able to pinpoint the issue. Can someone help me in understanding why this is breaking?

PS: Eveything works if I don’t add CUDA.jl into the environment i.e everything works on CPU.

ENVIRONMENT:
Windows 11, 16GB RAM, 1TB SSD, Ryzen 7 with Radeon Graphics, RTX 3060 6GB RAM.

Detailed steps:

  • Create a Julia env using Project.toml in KernelAbstractions.jl directory
1.  cd KA-src
2.  julia
3.  ]
4.  activate .
5.  instantiate
6.  add CUDA
8.  exit julia terminal
  • compile the performant_matmul.jl script using the below given command after .
julia --project=${KA_SOURCE_PATH} .\examples\performant_matmul.jl

Error:

ERROR: LoadError: UndefVarError: CUDAKernels not defined
Stacktrace:
 [1] top-level scope
   @ C:\Users\priyam\julia-work\ka-src\examples\utils.jl:4
 [2] include(fname::String)
   @ Base.MainInclude .\client.jl:476
 [3] top-level scope
   @ C:\Users\priyam\julia-work\ka-src\examples\performant_matmul.jl:5
in expression starting at C:\Users\priyam\julia-work\ka-src\examples\utils.jl:2
in expression starting at C:\Users\priyam\julia-work\ka-src\examples\performant_matmul.jl:5

I assume you’re using the KA.jl main branch, which depends on Move CUDAKernels to CUDA.jl by vchuravy · Pull Request #1772 · JuliaGPU/CUDA.jl · GitHub

1 Like

@maleadt Thanks! It worked.

Can you be a little more explicit on what we need to do to get the main branch of KA working? I tried to

] add CUDA.jl#1772

But the package manager wasn’t happy with this.

Try ] add CUDA.jl#vc/ka_transition – you need to specify the branch, not the PR number.
In any case, it’s not recommended to use the KA.jl master branch unless you have a very good reason to, especially during a transition like this.

1 Like

Thanks - that worked.

So what is the recommendation for using KA at the moment?

What’s wrong with the released version?

1 Like