CUDA.sqrt will not found symbol "__nv_sqrt"

I think this may be a bug and reported it.

https://github.com/JuliaGPU/CUDA.jl/issues/559#issue-748013387

Now I wonder if this a artifact error because other math function like abs are not work too. But, what caused it?

CUDA.sqrt is GPU only. The following code is OK.

using CUDA

function sqrt_kernel!(res, val)
    res[begin] = CUDA.sqrt(val)
    return
end

res = cu([0.0])
@cuda sqrt_kernel!(res, 12.34)
println(res[begin])

Answered by

https://github.com/JuliaGPU/CUDA.jl/issues/559#issuecomment-731595826