JuliaGPU/CUDA.jl

hvncat triggers scalar iteration

Open

#1,822 opened on Mar 22, 2023

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Julia (274 forks)batch import
cuda arrayenhancementgood first issue

Repository metrics

Stars
 (1,408 stars)
PR merge metrics
 (Avg merge 5d 5h) (16 merged PRs in 30d)

Description

gg = CUDA.rand(2,2)

# errors with
[gg;; gg]
Scalar indexing is disallowed.

Invocation of getindex resulted in scalar indexing of a GPU array.

This is typically caused by calling an iterating implementation of a method.

Such implementations *do not* execute on the GPU, but very slowly on the CPU,

and therefore are only permitted from the REPL for prototyping purposes.

If you did intend to index this array, annotate the caller with @allowscalar.

    error(::String)@error.jl:35
    assertscalar(::String)@GPUArraysCore.jl:103
    getindex(::CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, ::Int64)@indexing.jl:9
    _typed_hvncat(::Type{Float32}, ::Val{2}, ::CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, ::CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer})@abstractarray.jl:2259
    _typed_hvncat(::Type, ::Int64, ::Bool, ::CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, ::Vararg{CUDA.CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}})@abstractarray.jl:2215
    _hvncat@abstractarray.jl:2196[inlined]
    hvncat@abstractarray.jl:2189[inlined]
    top-level scope@[Local: 1](http://localhost:1234/edit?id=77e8e67e-c8bb-11ed-06aa-479b71d48037#)[inlined]


# works
[gg; gg]

CUDA runtime 11.8, artifact installation CUDA driver 12.0 NVIDIA driver 525.85.5

Libraries:

  • CUBLAS: 11.11.3
  • CURAND: 10.3.0
  • CUFFT: 10.9.0
  • CUSOLVER: 11.4.1
  • CUSPARSE: 11.7.5
  • CUPTI: 18.0.0
  • NVML: 12.0.0+525.85.5

Toolchain:

  • Julia: 1.8.5
  • LLVM: 13.0.1
  • PTX ISA support: 3.2, 4.0, 4.1, 4.2, 4.3, 5.0, 6.0, 6.1, 6.3, 6.4, 6.5, 7.0, 7.1, 7.2
  • Device capability support: sm_35, sm_37, sm_50, sm_52, sm_53, sm_60, sm_61, sm_62, sm_70, sm_72, sm_75, sm_80, sm_86

1 device: 0: NVIDIA GeForce RTX 3060 (sm_86, 6.252 GiB / 12.000 GiB available)

Julia Version 1.8.5 Commit 17cfb8e65ea (2023-01-08 06:45 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 24 × AMD Ryzen 9 5900X 12-Core Processor WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, znver3) Threads: 12 on 24 virtual cores Environment: JULIA_NUM_THREADS = 12 JULIA_REVISE_WORKER_ONLY = 1

Contributor guide