Skip to content

Commit 79f32b7

Browse files
committed
update parallel unit tests
1 parent 57bec0b commit 79f32b7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

test/test_parallel.jl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ end
3333
end
3434
Base.retry_load_extensions() # Potentially needed to load the extensions after the packages have been filtered.
3535

36-
3736
@static for package in TEST_PACKAGES
3837
FloatDefault = (package == PKG_METAL) ? Float32 : Float64 # Metal does not support Float64
3938

@@ -655,14 +654,14 @@ eval(:(
655654
return
656655
end
657656
@static if $package == $PKG_CUDA
658-
@test occursin("loopoffset = ((CUDA.blockIdx()).z - 1) * 3", kernel)
657+
@test occursin("loopoffset = (((CUDA.blockIdx()).z - 1) * 3 + (ranges[3])[1]) - 1", kernel) # Alternative: @test occursin("loopoffset = ((CUDA.blockIdx()).z - 1) * 3", kernel)
659658
elseif $package == $PKG_AMDGPU
660-
@test occursin("loopoffset = ((AMDGPU.workgroupIdx()).z - 1) * 3", kernel)
659+
@test occursin("loopoffset = (((AMDGPU.workgroupIdx()).z - 1) * 3 + (ranges[3])[1]) - 1", kernel) # Alternative: @test occursin("loopoffset = ((AMDGPU.workgroupIdx()).z - 1) * 3", kernel)
661660
elseif $package == $PKG_METAL
662-
@test occursin("loopoffset = ((Metal.threadgroup_position_in_grid_3d()).z - 1) * 3", kernel)
661+
@test occursin("loopoffset = (((Metal.threadgroup_position_in_grid_3d()).z - 1) * 3 + (ranges[3])[1]) - 1", kernel) # Alternative: @test occursin("loopoffset = ((Metal.threadgroup_position_in_grid_3d()).z - 1) * 3", kernel)
663662
end
664663
@test occursin("for i = -4:3", kernel)
665-
@test occursin("tz = i + loopoffset", kernel)
664+
@test occursin("iz = i + loopoffset", kernel) # Alternative: @test occursin("tz = i + loopoffset", kernel)
666665
@test occursin("A2[ix - 1, iy + 2, iz] = (A_ixm1_iyp2_izp3 - 2A_ixm3_iyp2_iz) + A_ixm4_iyp2_izm2", kernel)
667666
@test occursin("B2[ix + 1, iy + 2, iz + 1] = (B[ix + 1, iy + 2, iz + 2] - 2 * B[ix - 3, iy + 2, iz + 1]) + B[ix - 4, iy + 2, iz + 1]", kernel)
668667
@test occursin("C2[ix - 1, iy + 2, iz - 1] = (C_ixm1_iyp2_iz - 2C_ixm1_iyp2_izm1) + C_ixm1_iyp2_izm1", kernel)
@@ -712,14 +711,14 @@ eval(:(
712711
return
713712
end
714713
@static if $package == $PKG_CUDA
715-
@test occursin("loopoffset = ((CUDA.blockIdx()).z - 1) * 3", kernel)
714+
@test occursin("loopoffset = (((CUDA.blockIdx()).z - 1) * 3 + (ranges[3])[1]) - 1", kernel) # Alternative: @test occursin("loopoffset = ((CUDA.blockIdx()).z - 1) * 3", kernel)
716715
elseif $package == $PKG_AMDGPU
717-
@test occursin("loopoffset = ((AMDGPU.workgroupIdx()).z - 1) * 3", kernel)
716+
@test occursin("loopoffset = (((AMDGPU.workgroupIdx()).z - 1) * 3 + (ranges[3])[1]) - 1", kernel) # Alternative: @test occursin("loopoffset = ((AMDGPU.workgroupIdx()).z - 1) * 3", kernel)
718717
elseif $package == $PKG_METAL
719-
@test occursin("loopoffset = ((Metal.threadgroup_position_in_grid_3d()).z - 1) * 3", kernel)
718+
@test occursin("loopoffset = (((Metal.threadgroup_position_in_grid_3d()).z - 1) * 3 + (ranges[3])[1]) - 1", kernel) # Alternative: @test occursin("loopoffset = ((Metal.threadgroup_position_in_grid_3d()).z - 1) * 3", kernel)
720719
end
721720
@test occursin("for i = -4:3", kernel)
722-
@test occursin("tz = i + loopoffset", kernel)
721+
@test occursin("iz = i + loopoffset", kernel) # Alternative: @test occursin("tz = i + loopoffset", kernel)
723722
@test occursin("A2[ix - 1, iy + 2, iz] = (A_ixm1_iyp2_izp3 - 2A_ixm3_iyp2_iz) + A_ixm4_iyp2_izm2", kernel)
724723
@test occursin("B2[ix + 1, iy + 2, iz + 1] = (B[ix + 1, iy + 2, iz + 2] - 2 * B[ix - 3, iy + 2, iz + 1]) + B[ix - 4, iy + 2, iz + 1]", kernel)
725724
@test occursin("C2[ix - 1, iy + 2, iz - 1] = (C_ixm1_iyp2_iz - 2C_ixm1_iyp2_izm1) + C_ixm1_iyp2_izm1", kernel)

0 commit comments

Comments
 (0)