Memcopy
The first example simple copies memory from B to A
using KernelAbstractions, Testinclude(joinpath(dirname(pathof(KernelAbstractions)), "../examples/utils.jl")) # Load backend@kernel function copy_kernel!(A, @Const(B)) I = @index(Global) @inbounds A[I] = B[I]endfunction mycopy!(A, B) backend = get_backend(A) @assert size(A) == size(B) @assert get_backend(B) == backend kernel = copy_kernel!(backend) kernel(A, B, ndrange = length(A)) returnendA = KernelAbstractions.zeros(backend, Float32, 128, 128)B = KernelAbstractions.ones(backend, Float32, 128, 128)mycopy!(A, B)KernelAbstractions.synchronize(backend)@test A == B