Closed jw3126 closed 4 years ago
What do you expect that macro to do; print on the GPU? We have @cuprintln
for that, which is much more restricted in the types it can print; a GPU-compatible version of @show
would require show
which is currently not possible (we can't use Base formatting functionality because we don't support String or IO).
I was imagining that it expands to something like this:
@cushow x
@cuprintln "x = $x"
So same restrictions on types as @cuprintln
.
https://github.com/JuliaLang/julia/blob/b49d5ba3952bb1ce03ec55ab7ce0fa1cebd344fb/base/compiler/ssair/driver.jl#L8-L10 looks like a good implementation then :-) Want to create a PR with some tests?
Yes I want to do a PR.
I have trouble setting up dev version CUDAnative
. If I do
julia> using Pkg; pkg"dev CUDAnative"; using CUDAnative
I get
...
[ Info: Precompiling CUDAnative [be33ccc6-a3ff-5ff2-a52e-74243cff1e17]
ERROR: LoadError: LoadError: UndefVarError: CompositeCompilerTarget not defined
The following works with the stable version of CUDAnative
. Any hints on the problem with the dev version would be great.
macro cushow(ex)
val = gensym("val")
s = string(ex)
quote
$val = $(esc(ex))
CUDAnative.@cuprintln($(Expr(:string, s, " = ", val)))
$val
end
end
Any hints on the problem with the dev version would be great.
You also need to install GPUCompiler from the appropriate branch (generally master). The manifest encodes all this information.
I am new to gpu programming and think that at least for me a gpu analog of
@show
macro would be convenient for debugging and understanding how simple gpu programs work. Does such a macro exist? If not would a PR be welcome?