@@ -6,6 +6,7 @@ Random.seed!(666)
66function test_ic0(FC, V, M)
77 n = 100
88 R = real(FC)
9+ tol = eps(R) |> sqrt
910 A_cpu = rand(FC, n, n)
1011 A_cpu = A_cpu * A_cpu'
1112 A_cpu = sparse(A_cpu)
@@ -19,9 +20,9 @@ function test_ic0(FC, V, M)
1920 r_gpu = b_gpu - A_gpu * x_gpu
2021 @test stats.niter ≤ 5
2122 if (FC <: ComplexF64) && V.body.name.name == :ROCArray
22- @test_broken norm(r_gpu) ≤ 1e-6
23+ @test_broken norm(r_gpu) ≤ tol
2324 else
24- @test norm(r_gpu) ≤ 1e-8
25+ @test norm(r_gpu) ≤ tol
2526 end
2627
2728 A_gpu = M(A_cpu + 200*I)
@@ -30,15 +31,16 @@ function test_ic0(FC, V, M)
3031 r_gpu = b_gpu - A_gpu * x_gpu
3132 @test stats.niter ≤ 5
3233 if (FC <: ComplexF64) && V.body.name.name == :ROCArray
33- @test_broken norm(r_gpu) ≤ 1e-6
34+ @test_broken norm(r_gpu) ≤ tol
3435 else
35- @test norm(r_gpu) ≤ 1e-8
36+ @test norm(r_gpu) ≤ tol
3637 end
3738end
3839
3940function test_ilu0(FC, V, M)
4041 n = 100
4142 R = real(FC)
43+ tol = eps(R) |> sqrt
4244 A_cpu = rand(FC, n, n)
4345 A_cpu = sparse(A_cpu)
4446 b_cpu = rand(FC, n)
@@ -50,17 +52,19 @@ function test_ilu0(FC, V, M)
5052 x_gpu, stats = gmres(A_gpu, b_gpu, N=P, ldiv=true)
5153 r_gpu = b_gpu - A_gpu * x_gpu
5254 @test stats.niter ≤ 5
53- @test norm(r_gpu) ≤ 1e-8
55+ @test norm(r_gpu) ≤ tol
5456
5557 A_gpu = M(A_cpu + 200*I)
5658 update!(P, A_gpu)
5759 x_gpu, stats = gmres(A_gpu, b_gpu, N=P, ldiv=true)
5860 r_gpu = b_gpu - A_gpu * x_gpu
5961 @test stats.niter ≤ 5
60- @test norm(r_gpu) ≤ 1e-8
62+ @test norm(r_gpu) ≤ tol
6163end
6264
6365function test_operator(FC, V, DM, SM)
66+ R = real(FC)
67+ tol = eps(R) |> sqrt
6468 m = 200
6569 n = 100
6670 A_cpu = rand(FC, n, n)
@@ -74,7 +78,7 @@ function test_operator(FC, V, DM, SM)
7478 x_gpu, stats = gmres(opA_gpu, b_gpu)
7579 r_gpu = b_gpu - A_gpu * x_gpu
7680 @test stats.solved
77- @test norm(r_gpu) ≤ 1e-8
81+ @test norm(r_gpu) ≤ tol
7882
7983 A_cpu = rand(FC, m, n)
8084 A_cpu = sparse(A_cpu)
0 commit comments