Skip to content

Conversation

kshyatt
Copy link
Member

@kshyatt kshyatt commented Oct 9, 2025

This is causing CUDA nightly to fail because we don't have a specialized method to copy triangular types on GPU to CPU matrices. This is a work around that hopefully avoids the fail while still test appropriately.

@maleadt
Copy link
Member

maleadt commented Oct 9, 2025

we don't have a specialized method to copy triangular types on GPU to CPU matrices

Wouldn't it be more reasonable to add that? And what about

## copy a triangular part of a matrix to another matrix
if isdefined(LinearAlgebra, :copytrito!)
function LinearAlgebra.copytrito!(B::AbstractGPUMatrix{T}, A::AbstractGPUMatrix{T}, uplo::AbstractChar) where {T}
LinearAlgebra.BLAS.chkuplo(uplo)
m,n = size(A)
m1,n1 = size(B)
if uplo == 'U'
if n < m
(m1 < n || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($n,$n)"))
else
(m1 < m || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$n)"))
end
@kernel function U_kernel!(_A, _B)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j >= i
@inbounds _B[i,j] = _A[i,j]
end
end
U_kernel!(get_backend(B))(A, B; ndrange = size(A))
else # uplo == 'L'
if m < n
(m1 < m || n1 < m) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$m)"))
else
(m1 < m || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$n)"))
end
@kernel function L_kernel!(_A, _B)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j <= i
@inbounds _B[i,j] = _A[i,j]
end
end
L_kernel!(get_backend(A))(A, B; ndrange = size(A))
end
return B
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants