Skip to content

Commit

Permalink
make unit tests CUDA 4 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
omlins committed May 17, 2023
1 parent 662717a commit a9d39cf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/test_CellArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ end
end;
@testset "fill!" begin
allowscalar(true)
fill!(A, 9); @test all(A.data[:] .== 9.0)
fill!(B, 9.0); @test all(B.data[:] .== 9)
fill!(A, 9); @test all(Base.Array(A.data) .== 9.0)
fill!(B, 9.0); @test all(Base.Array(B.data) .== 9)
fill!(C, (1:length(eltype(C)))); @test all(C .== (T_Float64(1:length(eltype(C))) for i=1:dims[1], j=1:dims[2]))
fill!(D, (1:length(eltype(D)))); @test all(D .== (T_Int32(1:length(eltype(D))) for i=1:dims[1], j=1:dims[2]))
fill!(E, (1:length(eltype(E)))); @test all(E .== (T2_Float64(1:length(eltype(E))) for i=1:dims[1], j=1:dims[2]))
Expand Down Expand Up @@ -248,9 +248,9 @@ end
A[ix,iy] = A[ix,iy] * A[ix,iy];
return
end
A.data.=3; @cuda blocks=size(A) matsquare2D_CUDA!(A); synchronize(); @test all(A.data[:] .== 9)
A.data.=3; @cuda blocks=size(A) matsquare2D_CUDA!(A); synchronize(); @test all(Base.Array(A.data) .== 9)
J.data.=3; J_ref.data.=36; @cuda blocks=size(J) matsquare2D_CUDA!(J); synchronize(); @test CUDA.@allowscalar all(J .== J_ref)
C.data.=2; G.data.=3; @cuda blocks=size(C) add2D_CUDA!(C, G); synchronize(); @test all(C.data[:] .== 5)
C.data.=2; G.data.=3; @cuda blocks=size(C) add2D_CUDA!(C, G); synchronize(); @test all(Base.Array(C.data) .== 5)
end
if array_type == "AMDGPU"
function add2D_AMDGPU!(A, B)
Expand All @@ -265,9 +265,9 @@ end
A[ix,iy] = A[ix,iy] * A[ix,iy];
return
end
A.data.=3; wait(@roc gridsize=size(A) matsquare2D_AMDGPU!(A)); @test all(A.data[:] .== 9)
A.data.=3; wait(@roc gridsize=size(A) matsquare2D_AMDGPU!(A)); @test all(Base.Array(A.data) .== 9)
J.data.=3; J_ref.data.=36; wait(@roc gridsize=size(J) matsquare2D_AMDGPU!(J)); @test AMDGPU.@allowscalar all(J .== J_ref)
C.data.=2; G.data.=3; wait(@roc gridsize=size(C) add2D_AMDGPU!(C, G)); @test all(C.data[:] .== 5)
C.data.=2; G.data.=3; wait(@roc gridsize=size(C) add2D_AMDGPU!(C, G)); @test all(Base.Array(C.data) .== 5)
end
end;
@testset "cellsize" begin
Expand Down

0 comments on commit a9d39cf

Please sign in to comment.