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

[CUSOLVER] Add a method for geqrf! #2085

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/cusolver/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ for (bname, fname,elty) in ((:cusolverDnSgeqrf_bufferSize, :cusolverDnSgeqrf, :F
(:cusolverDnCgeqrf_bufferSize, :cusolverDnCgeqrf, :ComplexF32),
(:cusolverDnZgeqrf_bufferSize, :cusolverDnZgeqrf, :ComplexF64))
@eval begin
function geqrf!(A::StridedCuMatrix{$elty})
function geqrf!(A::StridedCuMatrix{$elty}, tau::CuVector{$elty})
m, n = size(A)
lda = max(1, stride(A, 2))

Expand All @@ -154,7 +154,6 @@ for (bname, fname,elty) in ((:cusolverDnSgeqrf_bufferSize, :cusolverDnSgeqrf, :F
return out[]
end

tau = CuArray{$elty}(undef, min(m, n))
devinfo = CuArray{Cint}(undef, 1)
with_workspace($elty, bufferSize) do buffer
$fname(dense_handle(), m, n, A, lda, tau, buffer, length(buffer), devinfo)
Expand All @@ -166,6 +165,12 @@ for (bname, fname,elty) in ((:cusolverDnSgeqrf_bufferSize, :cusolverDnSgeqrf, :F

A, tau
end

function geqrf!(A::StridedCuMatrix{$elty})
m, n = size(A)
tau = CuArray{$elty}(undef, min(m, n))
geqrf!(A, tau)
end
end
end

Expand Down Expand Up @@ -891,6 +896,7 @@ for elty in (:Float32, :Float64, :ComplexF32, :ComplexF64)
LinearAlgebra.LAPACK.potri!(uplo::Char, A::StridedCuMatrix{$elty}) = CUSOLVER.potri!(uplo, A)
LinearAlgebra.LAPACK.getrf!(A::StridedCuMatrix{$elty}) = CUSOLVER.getrf!(A)
LinearAlgebra.LAPACK.geqrf!(A::StridedCuMatrix{$elty}) = CUSOLVER.geqrf!(A)
LinearAlgebra.LAPACK.geqrf!(A::StridedCuMatrix{$elty}, tau::CuVector{$elty}) = CUSOLVER.geqrf!(A, tau)
LinearAlgebra.LAPACK.sytrf!(uplo::Char, A::StridedCuMatrix{$elty}) = sytrf!(uplo, A)
LinearAlgebra.LAPACK.getrs!(trans::Char, A::StridedCuMatrix{$elty}, ipiv::CuVector{Cint}, B::StridedCuVecOrMat{$elty}) = CUSOLVER.getrs!(trans, A, ipiv, B)
LinearAlgebra.LAPACK.ormqr!(side::Char, trans::Char, A::CuMatrix{$elty}, tau::CuVector{$elty}, C::CuVecOrMat{$elty}) = CUSOLVER.ormqr!(side, trans, A, tau, C)
Expand Down