-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCG produces different output on GPU #724
Comments
Hi @zjwegert, can you re-run the tests with CUDA toolkit 11.8? Is it also possible to see the logs with the option |
Hi @amontoison, julia> x = krylov_inv(A,b);
┌ Info: Simple stats
│ niter: 25
│ solved: true
│ inconsistent: false
│ residuals: [ 8.1e+00 4.1e+00 1.3e+00 ... 2.4e-08 2.9e-08 7.9e-09 ]
│ Aresiduals: []
│ κ₂(A): []
└ status: solution good enough given atol and rtol
julia> x2 = krylov_inv(A,b);
┌ Info: Simple stats
│ niter: 25
│ solved: true
│ inconsistent: false
│ residuals: [ 8.1e+00 4.1e+00 1.3e+00 ... 2.4e-08 2.9e-08 7.9e-09 ]
│ Aresiduals: []
│ κ₂(A): []
└ status: solution good enough given atol and rtol
julia> norm(x-x2,Inf) # ---> 0.0
0.0
julia> gpu_x = krylov_inv_gpu(A,b);
┌ Info: Simple stats
│ niter: 24
│ solved: true
│ inconsistent: false
│ residuals: [ 8.1e+00 4.1e+00 1.3e+00 ... 4.9e-08 2.0e-08 1.0e-08 ]
│ Aresiduals: []
│ κ₂(A): []
└ status: solution good enough given atol and rtol
julia> gpu_x2 = krylov_inv_gpu(A,b);
┌ Info: Simple stats
│ niter: 24
│ solved: true
│ inconsistent: false
│ residuals: [ 8.1e+00 4.1e+00 1.3e+00 ... 4.9e-08 2.0e-08 8.9e-09 ]
│ Aresiduals: []
│ κ₂(A): []
└ status: solution good enough given atol and rtol
julia> norm(gpu_x-gpu_x2,Inf) # ---> Non-zero
1.9215254387638936e-12 The condition number for the matrix in this computation is julia> cond(Array(A),2)
37.067459615697715 |
The observed phenomenon is related to the parallelism of GPUs. An example to explain it is to generate a matrix of size 5 x n where each row are equals and the coefficients of the rows are (1, 1/2, ..., 1/n). If v = (1, ..., 1), the components of using LinearAlgebra, CUDA, CUDA.CUSPARSE
n = 10000
T = Float64
A_cpu = zeros(T, 5, n)
for i = 1:5
for j = 1:n
A_cpu[i,j] = 1/j
end
end
A_cpu = sparse(A_cpu)
v_cpu = ones(T, n)
y_cpu = A_cpu * v_cpu
A_gpu = CuSparseMatrixCSC(A_cpu)
v_gpu = CuVector(v_cpu)
y_gpu = A_gpu * v_gpu
|
@zjwegert May I close this issue? |
Describe the bug
It appears that a Jacobi preconditioned CG method produces different output on a GPU when re-run.
To reproduce
The Minimal Working Example (MWE) for this bug:
Expected behavior
Expect
norm(gpu_x-gpu_x2,Inf) = 0
.Version info
Details on Julia:
Package versions:
Details on CUDA:
Additional info:
I've tested this on another system and the issue still presents.
&
The text was updated successfully, but these errors were encountered: