CUDA.jl
CUDA.jl copied to clipboard
2-arg `show`
Closes #1190
Prints the Float32 case most compactly, although perhaps it would be less confusing to write out cu(Float32[0.7821349, 0.99106485]) in the end? Certainly simpler.
julia> x = rand(2)
2-element Vector{Float64}:
0.7821348955171186
0.9910648595224902
julia> (f32 = cu(x), f64 = CuArray(x), i32 = CuArray(Int32[1,2,3]))
(f32 = cu([0.7821349, 0.99106485]), f64 = CuArray([0.7821348955171186, 0.9910648595224902]), i32 = cu(Int32[1, 2, 3]))
The base functionality (and corresponding tests) for this lives in GPUArrays.jl, https://github.com/JuliaGPU/GPUArrays.jl/blob/79cc61b1752523ce8386fe2904cc51a27e187c26/src/host/abstractarray.jl#L42-L57, so maybe we should start by updating it there so that we always show CuArray(...)? And/or adapt the test at https://github.com/JuliaGPU/GPUArrays.jl/blob/79cc61b1752523ce8386fe2904cc51a27e187c26/test/testsuite/base.jl#L239-L240 so that it only checks for the presence of [1] etc to make the cu optimization here possible.