Skip to content

Commit

Permalink
add some JET tests (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub authored Sep 24, 2024
1 parent f2b73df commit 39ca617
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/AztecDiamonds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ function Base.checkbounds(t::Tiling, i, j)
return nothing
end

Base.@propagate_inbounds function Base.getindex(t::Tiling, i, j)
Base.@propagate_inbounds function Base.getindex(t::Tiling, i::Integer, j::Integer)
@boundscheck checkbounds(t, i, j)
return t.x[i, j]
end
Base.@propagate_inbounds function Base.setindex!(t::Tiling, x, i, j)
Base.@propagate_inbounds function Base.setindex!(t::Tiling, x, i::Integer, j::Integer)
@boundscheck checkbounds(t, i, j)
return setindex!(t.x, x, i, j)
end
Expand Down
4 changes: 2 additions & 2 deletions src/ka.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ end
end
end

@kernel function zero_kernel!(t::Tiling, N) # COV_EXCL_LINE
@kernel function zero_kernel!(t::Tiling, N::Int) # COV_EXCL_LINE
I = @index(Global, NTuple) # COV_EXCL_LINE
i, j = I .- N
@inbounds t.x[i, j] = NONE
end

function ka_diamond!(t, t′, N; backend)
function ka_diamond!(t::Tiling, t′::Tiling, N::Int; backend)
zero! = zero_kernel!(backend)
remove_bad_blocks! = remove_bad_blocks_kernel!(backend)
slide_tiles! = slide_tiles_kernel!(backend)
Expand Down
2 changes: 2 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
Expand All @@ -17,6 +18,7 @@ CUDA = "5.4.3"
CairoMakie = "0.12.11"
Colors = "0.12.11"
Images = "0.26.1"
JET = "0.8.21, 0.9.9"
Pkg = "1"
Test = "1"
TestItemRunner = "1.0.5"
10 changes: 10 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,13 @@ end
@test _to_img(D′) == replace(rot(_to_img(D)), replacements...)
end
end

@testitem "JET" begin
using JET

@test_opt diamond(10)
D = diamond(10)
@test_opt dr_path(D)
@test_opt AztecDiamonds.to_img(D)
@test_call show(stdout, MIME("text/plain"), D)
end
3 changes: 3 additions & 0 deletions test/makie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
save(path, f)
@test isfile(path)
@test filesize(path) > 1024 # 1 kiB

using JET
@test_opt Base.get_extension(AztecDiamonds, :MakieExtension).prepare_plot(D)
end

0 comments on commit 39ca617

Please sign in to comment.