# Debugging with CUDA.jl

**URL:** <https://discourse.julialang.org/t/debugging-with-cuda-jl/47493>\
**Category:** GPU\
**Tags:** gpu, debugging\
**Created:** [September 29, 2020, 4:19pm UTC](https://discourse.julialang.org/t/debugging-with-cuda-jl/47493 "2020-09-29T16:19:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bmit/32/12443_2.png) [@bmit](https://discourse.julialang.org/u/bmit)\
**Post date:** [September 29, 2020, 4:19pm UTC](https://discourse.julialang.org/t/debugging-with-cuda-jl/47493/1 "2020-09-29T16:19:18Z")

</div>

Does Debugger.jl work with CUDA.jl? I haven’t had any luck and wasn’t sure if I was missing something or it’s not supposed to work. Here’s the simplest case I came up with:

```julia
using CUDA
using Debugger
function test_cuda_debug(A,B)
    B .= A
end
A = CUDA.rand(Float32, 16)
B = CUDA.rand(Float32, 16)
test_cuda_debug(A,B)
@run test_cuda_debug(A,B)

```

gives

> signal (4): Illegal instruction  
> in expression starting at REPL[8]  
> …

If this isn’t supported, what debugging workflows have people found are effective?

---

<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:** [September 29, 2020, 5:50pm UTC](https://discourse.julialang.org/t/debugging-with-cuda-jl/47493/2 "2020-09-29T17:50:09Z")

</div>

The illegal instruction is a bug in Julia, and should be filed there (or on the Debugger.jl repo if you can show it’s Debugger related).

Although you can use Debugger.jl to debug the innards of CUDA.jl, you can’t use it to debug actual kernel code. Printf-debugging is your best bet there. There is `cuda-gdb`, but due to a bug in CUDA we currently don’t emit the necessary debug information to make that a pleasant experience.
