Skip to content
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

Remove CUBLAS decomposition tests without pivoting. #1246

Merged
merged 1 commit into from
Nov 19, 2021

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Nov 18, 2021

After looking into this with @andreasnoack, it turns out that with NoPivot errors quickly accumulate:

using LinearAlgebra
using CUDA
using Test
using Random

m = 3
B = 1
elty = Float32

A = [Float32[0.6079158 0.62611455 0.012768269; 0.61469626 0.6331439 0.42760158; 0.959462 0.3199075 0.31573468]]
As = 1
# move to device
d_A = CuArray{elty, 2}[]
for i in 1:length(A)
    push!(d_A,CuArray(A[i]))
end
pivot, info = CUBLAS.getrf_batched!(d_A, false)
h_info = Array(info)

pivot = NoPivot()
C   = lu!(copy(A[As]), pivot)
h_A = Array(d_A[As])

#reconstruct L,U
dL = Matrix(one(elty)*I, m, m)
dU = zeros(elty,(m,m))
k = h_info[As]
if k >= 0
    dL += tril(h_A,-k-1)
    dU += triu(h_A,k)
end

#compare
@test C.L  dL
@test C.U  dU
julia> C.L
3×3 Matrix{Float32}:
 1.0           0.0  0.0
 1.01115       1.0  0.0
 1.57828  -14541.9  1.0

julia> dL
3×3 Matrix{Float32}:
 1.0           0.0  0.0
 1.01115       1.0  0.0
 1.57828  -14547.8  1.0

@maleadt maleadt added the cuda libraries Stuff about CUDA library wrappers. label Nov 18, 2021
@codecov
Copy link

codecov bot commented Nov 18, 2021

Codecov Report

Merging #1246 (2ccc93e) into master (303d4ff) will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1246      +/-   ##
==========================================
- Coverage   80.11%   80.09%   -0.03%     
==========================================
  Files         119      119              
  Lines        8404     8404              
==========================================
- Hits         6733     6731       -2     
- Misses       1671     1673       +2     
Impacted Files Coverage Δ
lib/cublas/wrappers.jl 92.34% <0.00%> (-0.23%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 303d4ff...2ccc93e. Read the comment docs.

@maleadt maleadt merged commit 262c183 into master Nov 19, 2021
@maleadt maleadt deleted the tb/cublas_nopivot branch November 19, 2021 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda libraries Stuff about CUDA library wrappers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant