Skip to content

Commit 8fa2b92

Browse files
committed
Small test suite on perdot
1 parent de4a408 commit 8fa2b92

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/maintests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ backend != "KernelAbstractions" && throw(ArgumentError("SIMD backend not allowed
9494
@test GPUArrays.@allowscalar WaterLily.interp(SVector(3.5,3),b) 3.5
9595
@test GPUArrays.@allowscalar eltype(WaterLily.interp(SVector(3.5,3),b))==Float64
9696
@test_throws MethodError GPUArrays.@allowscalar WaterLily.interp(SVector(2.5f0,1.f0),b)
97+
98+
# test on perdot
99+
σ1 = rand(Ng...) |> f # scalar
100+
σ2 = rand(Ng...) |> f # another scalar
101+
# use ≈ instead of == as summation in different order might result in slight difference in floating point expressions
102+
@test GPUArrays.@allowscalar WaterLily.perdot(σ1,σ2,()) sum(σ1[I]*σ2[I] for ICartesianIndices(σ1))
103+
@test GPUArrays.@allowscalar WaterLily.perdot(σ1,σ2,(1,)) sum(σ1[I]*σ2[I] for Iinside(σ1))
104+
@test GPUArrays.@allowscalar WaterLily.perdot(σ1,σ2,(1,2)) sum(σ1[I]*σ2[I] for Iinside(σ1))
97105
end
98106
end
99107

0 commit comments

Comments
 (0)