Skip to content
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
4 changes: 2 additions & 2 deletions ext/MatrixAlgebraKitCUDAExt/yacusolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ for (bname, fname, elty, relty) in
length(S) == minmn ||
throw(DimensionMismatch("length mismatch between A and S"))

Ṽ = (jobz == 'V') ? similar(Vᴴ') : similar(Vᴴ, (n, minmn))
Ũ = (jobz == 'V') ? U : similar(U, (m, minmn))
Ṽ = (jobz == 'V') ? similar(Vᴴ') : similar(Vᴴ, (n, n))
Ũ = (jobz == 'V') ? U : similar(U, (m, m))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read the CUDA gesvdj documentation correctly, this could have been solved by setting econ = 1 also in the jobz = 'N' case, i.e. change line 217 above. It would be strange to need larger U and V matrices when not computing singular vectors at all, then in the case where we do compute them in economic mode.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really not clear from their documentation which also states that "U is an mxm unitary matrix, and V is an nxn unitary matrix". Should I try a followup PR setting econ = 1?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to trust the argument / API description, i.e. https://docs.nvidia.com/cuda/cusolver/index.html#id156 , though I think there have been cases where this trust was violated in the past 😄 .

lda = max(1, stride(A, 2))
ldu = max(1, stride(Ũ, 2))
ldv = max(1, stride(Ṽ, 2))
Expand Down
Loading