We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
memcopy.jl
1 parent 045fab2 commit d61f6a9Copy full SHA for d61f6a9
examples/memcopy.jl
@@ -1,6 +1,8 @@
1
using KernelAbstractions
2
-using CUDAKernels
3
using CUDA
+using CUDAKernels
4
+using AMDGPU
5
+using ROCKernels
6
using Test
7
8
@kernel function copy_kernel!(A, @Const(B))
@@ -34,3 +36,26 @@ if has_cuda_gpu()
34
36
wait(event)
35
37
@test A == B
38
end
39
+
40
+function has_rocm_gpu()
41
+ for agent in AMDGPU.get_agents()
42
+ if agent.type == :gpu
43
+ return true
44
+ end
45
46
+ return false
47
+end
48
49
+if has_rocm_gpu()
50
51
+ function mycopy!(A::ROCArray, B::ROCArray)
52
+ @assert size(A) == size(B)
53
+ copy_kernel!(ROCDevice(), 256)(A, B, ndrange=length(A))
54
55
56
+ A = zeros(Float32, 1024) |> ROCArray
57
+ B = ones(Float32, 1024) |> ROCArray
58
+ event = mycopy!(A, B)
59
+ wait(event)
60
+ @test A == B
61
0 commit comments