Is there a way to use @allowscalar in a heterogeneous manner using KernelAbstractions?

0samuraiE
Tue, 08 Apr 2025 03:24:09 +0000
GPU

Hi all,

Is it correct that scalar indexing like Out[1] is not allowed with KernelAbstractions.jl alone, and that we need GPUArrays.@allowscalar for this? Should we always use GPUArrays together with KernelAbstractions for such cases?

using KernelAbstractions
using CUDA
using GPUArrays

backend = CUDABackend()
Out = KernelAbstractions.zeros(backend, Float64, 1)
GPUArrays.@allowscalar Out[1]

4 posts - 3 participants