Is there round(..., digits=2) in CUDA?

I would like to use the function round(a, digits=2) on the GPU, but it seems that this is not possible.

Is there another function for this purpose?

Thank you in advance

How about this? I prefer trick of this kind:

roundigit2(x) = round(Int32, 100x) / 100
julia> using CUDA

julia> roundigit2(x) = round(Int32, 100x) / 100
roundigit2 (generic function with 1 method)

julia> X = CuArray(randn(100))
100-element CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}:
  0.9393934792087492
  0.6900935059439155
 -0.8939959207450046
 -1.8878733700288313
  ⋮
  0.0561743482887146
 -1.4615333912881514
 -0.4060048468494186
  0.8475641383618252

julia> roundigit2.(X)
100-element CuArray{Float64, 1, CUDA.Mem.DeviceBuffer}:
  0.94
  0.69
 -0.89
 -1.89
  ⋮
  0.06
 -1.46
 -0.41
  0.85

Why not?

julia> a = CUDA.rand(2)
2-element CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}:
 0.30272454
 0.8437567

julia> function kernel(a,b)
       a[threadIdx().x] = round(b[threadIdx().x]; digits=2)
       return
       end

julia> b = similar(a)
2-element CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}:
 0.0
 0.0

julia> @cuda kernel(b,a)
CUDA.HostKernel for kernel(CuDeviceVector{Float32, 1}, CuDeviceVector{Float32, 1})

julia> b
2-element CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}:
 0.3
 0.0

You should include source code and error messages when opening topics like this.