Skip to content

Commit 2cd404b

Browse files
Merge pull request #1881 from CliMA/ck/mat_field_opt_tests
Add JET tests to matrix field broadcasting
2 parents 13d49de + a0bacdb commit 2cd404b

22 files changed

+28
-23
lines changed

test/MatrixFields/matrix_field_broadcasting.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ results = Profile.fetch()
2424
Profile.clear()
2525
ProfileCanvas.html_file("flame.html", results)
2626
27-
benchmark_getidx(bc)
27+
perf_getidx(bc)
2828
```
2929
=#
3030
using Test

test/MatrixFields/matrix_field_test_utils.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ end
316316
trunc_time(s::String) = count(',', s) > 1 ? join(split(s, ",")[1:2], ",") : s
317317

318318
function get_getidx_args(bc)
319-
space = axes(materialize(bc))
319+
space = axes(bc)
320320
idx = if space.staggering isa Spaces.CellCenter
321321
10
322322
else
@@ -330,7 +330,8 @@ function get_getidx_args(bc)
330330
return (; space, bc, loc_l, loc_i, loc_r, idx, hidx)
331331
end
332332

333-
function benchmark_getidx(bc)
333+
import JET
334+
function perf_getidx(bc; broken = false)
334335
(; space, bc, loc_l, loc_i, loc_r, idx, hidx) = get_getidx_args(bc)
335336
call_getidx(space, bc, loc_i, idx, hidx)
336337
call_getidx(space, bc, loc_l, idx, hidx)
@@ -345,6 +346,10 @@ function benchmark_getidx(bc)
345346
ber = time_and_units_str(
346347
BT.@belapsed call_getidx($space, $bc, $loc_r, $idx, $hidx)
347348
)
349+
350+
JET.@test_opt call_getidx(space, bc, loc_i, idx, hidx)
351+
JET.@test_opt call_getidx(space, bc, loc_l, idx, hidx)
352+
JET.@test_opt call_getidx(space, bc, loc_r, idx, hidx)
348353
@info "getidx times max(interior,left,right) = ($bei,$bel,$ber)"
349354
return nothing
350355
end

test/MatrixFields/matrix_fields_broadcasting/test_non_scalar_1.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ test_opt = get(ENV, "BUILDKITE", "") == "true"
2929
)
3030

3131
test_opt && opt_test_field_broadcast(result, bc; ref_set_result!)
32-
test_opt && !using_cuda && benchmark_getidx(bc)
32+
test_opt && !using_cuda && perf_getidx(bc)
3333
end

test/MatrixFields/matrix_fields_broadcasting/test_non_scalar_2.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ test_opt = get(ENV, "BUILDKITE", "") == "true"
3434
)
3535

3636
test_opt && opt_test_field_broadcast(result, bc; ref_set_result!)
37-
test_opt && !using_cuda && benchmark_getidx(bc)
37+
test_opt && !using_cuda && perf_getidx(bc)
3838
end

test/MatrixFields/matrix_fields_broadcasting/test_non_scalar_3.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ test_opt = get(ENV, "BUILDKITE", "") == "true"
3636
)
3737

3838
test_opt && opt_test_field_broadcast(result, bc; ref_set_result!)
39-
test_opt && !using_cuda && benchmark_getidx(bc)
39+
test_opt && !using_cuda && perf_getidx(bc)
4040
end

test/MatrixFields/matrix_fields_broadcasting/test_non_scalar_4.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ test_opt = get(ENV, "BUILDKITE", "") == "true"
3131
)
3232

3333
test_opt && opt_test_field_broadcast(result, bc; ref_set_result!)
34-
test_opt && !using_cuda && benchmark_getidx(bc)
34+
test_opt && !using_cuda && perf_getidx(bc)
3535
end

test/MatrixFields/matrix_fields_broadcasting/test_scalar_1.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ test_opt = get(ENV, "BUILDKITE", "") == "true"
2525
input_fields,
2626
using_cuda,
2727
)
28-
test_opt && !using_cuda && benchmark_getidx(bc)
28+
test_opt && !using_cuda && perf_getidx(bc)
2929
end

test/MatrixFields/matrix_fields_broadcasting/test_scalar_10.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ test_opt = get(ENV, "BUILDKITE", "") == "true"
5959
ref_set_result!,
6060
using_cuda,
6161
)
62-
test_opt && !using_cuda && benchmark_getidx(bc)
62+
test_opt && !using_cuda && perf_getidx(bc)
6363
end

test/MatrixFields/matrix_fields_broadcasting/test_scalar_11.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ test_opt = get(ENV, "BUILDKITE", "") == "true"
5555
ref_set_result!,
5656
using_cuda,
5757
)
58-
test_opt && !using_cuda && benchmark_getidx(bc)
58+
test_opt && !using_cuda && perf_getidx(bc)
5959
end

test/MatrixFields/matrix_fields_broadcasting/test_scalar_12.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ test_opt = get(ENV, "BUILDKITE", "") == "true"
5656
ref_set_result!,
5757
using_cuda,
5858
)
59-
test_opt && !using_cuda && benchmark_getidx(bc)
59+
test_opt && !using_cuda && perf_getidx(bc)
6060
end

0 commit comments

Comments
 (0)