I have a kernel, which uses the exp
operation, it breaks down in a strange way
Minimum working example:
using CuArrays, CUDAnative
CuArrays.allowscalar(false)
x = randn(1000) |> cu
CUDAnative.map(CUDAnative.exp, x)
CUDAnative.reduce(+, x)
# works, but no kernel is evaluated
@device_code_warntype CUDAnative.mapreduce(exp, +, x) # no kernel evaluated
# the following code will cause Julia breaking down
@device_code_warntype CUDAnative.mapreduce(CUDAnative.exp, +, x)
Questions:
- Why
mapreduce
can run without calling a kernel andmap
calls the kernel? - Is it possible to prevent Julia from breaking down when calling
CUDAnative.exp
directly (not on GPU) and other CUDA intrinsics? Relaunching Julia REPL or Atom can be frustrating. - How to make the kernel function reusable, i.e. switch between
CUDAnative.exp
andBase.exp
without changing the kernel function?