Skip to content

Commit

Permalink
Start
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyuxie committed Oct 3, 2024
1 parent 699f513 commit 25029fb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/test_macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ using Test: @test, @testset

# Macro to test the type Float64 or Float32 ?

# Macro to time the execution of a kernel
macro timed_kernel(kernel, args...; kwargs...)
quote
# Time the kernel
local start = CUDA.Event()
local stop = CUDA.Event()
CUDA.@synchronize
CUDA.record!(start)
$kernel(args...; kwargs...)
CUDA.@synchronize
CUDA.record!(stop)
CUDA.@synchronize
local elapsed_time = CUDA.elapsed_time(start, stop)
elapsed_time
end
end

# Macro to test the exact equality of arrays from GPU and CPU
macro test_equal(expr)
# Parse the expression and check that it is of the form
Expand Down

0 comments on commit 25029fb

Please sign in to comment.