Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasfaingnaert committed Oct 19, 2023
1 parent c8f9916 commit 9ce5f7f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/core/cudadrv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,34 @@ end
@test (CUDA.@elapsed identity(nothing)) > 0
@test (CUDA.@elapsed blocking=true identity(nothing)) > 0

let
function simple_matmul(C, A, B, N)
for i = 1:N
for j = 1:N
elem = C[i, j]

for k = 1:N
elem += A[i, k] * B[k, j]
end

C[i, j] = elem
end
end

nothing
end

A = CuArray(rand(Float32, (1000, 1000)))
B = CuArray(rand(Float32, (1000, 1000)))
C = similar(A)

N1 = (CUDA.@elapsed @cuda simple_matmul(C, A, B, 500))
N2 = (CUDA.@elapsed @cuda simple_matmul(C, A, B, 1000))

@test 16 * N1 > N2
@test N2 > 4 * N1
end

CuEvent(CUDA.EVENT_BLOCKING_SYNC)
CuEvent(CUDA.EVENT_BLOCKING_SYNC | CUDA.EVENT_DISABLE_TIMING)

Expand Down

0 comments on commit 9ce5f7f

Please sign in to comment.