JuliaGPU/CUDA.jl

Broadcasting and reshaped, transposed, CuArrays

Open

#228 geöffnet am 17. Juni 2020

Auf GitHub ansehen
 (6 Kommentare) (3 Reaktionen) (0 zugewiesene Personen)Julia (274 Forks)batch import
bugcuda arrayhelp wanted

Repository-Metriken

Stars
 (1.408 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 5h) (16 gemergte PRs in 30 T)

Beschreibung

Some broadcasting operations work fine on reshape(transpose(cu( objects, but some fail:

using CUDA
CUDA.allowscalar(false)
mat = cu(rand(2,2))

reshape(transpose(mat),2,1,2) .+ mat # ok

exp.(reshape(transpose(mat), 2,1,2)) # ERROR: scalar getindex is disallowed
CUDA.exp.(reshape(transpose(mat), 2,1,2)) # FATAL ERROR: Symbol "__nv_expf"not found

Something like this appears to be the cause of https://github.com/mcabbott/TensorCast.jl/issues/25, where the failure happens only when broadcasting two such objects, just one is fine:

C = cu(ones(10,2))
L = cu(ones(10,3))

reshape(C,1,2,10) .+ reshape(L', 3,1,10) # ok
reshape(C',1,2,10) .+ reshape(L, 3,1,10) # ok
reshape(C',1,2,10) .+ reshape(L', 3,1,10) # ERROR: scalar getindex is disallowed

This is with CUDA v0.1.0, I get the same errors on CuArrays v2.2.1, and on CuArrays v1.7.2 the only change is this:

julia> CuArrays.CUDAnative.exp.(reshape(transpose(mat), 2,1,2)) #
ERROR: LLVM error: Program used external function '___nv_expf' which could not be resolved!

Contributor Guide