Skip to content

Commit dc2246c

Browse files
authored
Fix copying between Symmetric and Hermitian matrices. (#2913)
We shouldn't perform a dense copy, which we started dispatching to after the Adapt.jl Union now lists Hermitian as well (Symmetric had been broken before).
1 parent 3d278b6 commit dc2246c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/cusolver/linalg.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ function Base.:\(F::Union{LinearAlgebra.LAPACKFactorizations{<:Any,<:CuArray},
110110
return LinearAlgebra._cut_B(BB, 1:n)
111111
end
112112

113+
# make copyto! for Hermitian and Symmetric dispatch to the Base implementation
114+
# instead of being overridden by GPUArrays' dense copy (because of AnyGPUArray)
115+
Base.copyto!(dst::Symmetric{<:Any,<:CuMatrix}, src::Symmetric{<:Any,<:CuMatrix}) =
116+
@invoke copyto!(dst::Symmetric, src::Symmetric)
117+
Base.copyto!(dst::Hermitian{<:Any,<:CuMatrix}, src::Hermitian{<:Any,<:CuMatrix}) =
118+
@invoke copyto!(dst::Hermitian, src::Hermitian)
119+
113120
# eigenvalues
114121

115122
function LinearAlgebra.eigen(A::Symmetric{T,<:CuMatrix}) where {T<:BlasReal}

0 commit comments

Comments
 (0)