|
1 | 1 | using KernelAbstractions, Test
|
2 | 2 | include(joinpath(@__DIR__, "utils.jl")) # Load backend
|
3 | 3 |
|
4 |
| -if Base.VERSION < v"1.7.0" |
5 |
| - return |
6 |
| -end |
7 | 4 |
|
8 | 5 | # Function to use as a baseline for CPU metrics
|
9 | 6 | function create_histogram(input)
|
|
83 | 80 | histogram_linear_baseline = create_histogram(linear_input)
|
84 | 81 | histogram_2_baseline = create_histogram(all_2)
|
85 | 82 |
|
86 |
| - CPU_rand_histogram = zeros(Int, 128) |
87 |
| - CPU_linear_histogram = zeros(Int, 1024) |
88 |
| - CPU_2_histogram = zeros(Int, 2) |
| 83 | + if Base.VERSION >= v"1.7.0" |
| 84 | + CPU_rand_histogram = zeros(Int, 128) |
| 85 | + CPU_linear_histogram = zeros(Int, 1024) |
| 86 | + CPU_2_histogram = zeros(Int, 2) |
89 | 87 |
|
90 |
| - wait(histogram!(CPU_rand_histogram, rand_input)) |
91 |
| - wait(histogram!(CPU_linear_histogram, linear_input)) |
92 |
| - wait(histogram!(CPU_2_histogram, all_2)) |
| 88 | + wait(histogram!(CPU_rand_histogram, rand_input)) |
| 89 | + wait(histogram!(CPU_linear_histogram, linear_input)) |
| 90 | + wait(histogram!(CPU_2_histogram, all_2)) |
93 | 91 |
|
94 |
| - @test isapprox(CPU_rand_histogram, histogram_rand_baseline) |
95 |
| - @test isapprox(CPU_linear_histogram, histogram_linear_baseline) |
96 |
| - @test isapprox(CPU_2_histogram, histogram_2_baseline) |
| 92 | + @test isapprox(CPU_rand_histogram, histogram_rand_baseline) |
| 93 | + @test isapprox(CPU_linear_histogram, histogram_linear_baseline) |
| 94 | + @test isapprox(CPU_2_histogram, histogram_2_baseline) |
| 95 | + end |
97 | 96 |
|
98 | 97 | if has_cuda_gpu()
|
99 | 98 | CUDA.allowscalar(false)
|
|
0 commit comments