From c7c7cf157aacf1b5b171d985d84deaacecf511bb Mon Sep 17 00:00:00 2001 From: Dahua Lin Date: Mon, 26 May 2014 17:06:34 -0500 Subject: [PATCH] Only apply the gemv workaround when OpenBLAS is being used. --- base/linalg/matmul.jl | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/base/linalg/matmul.jl b/base/linalg/matmul.jl index 051a7c4dfd391..b1e777142e660 100644 --- a/base/linalg/matmul.jl +++ b/base/linalg/matmul.jl @@ -203,25 +203,24 @@ function copytri!(A::StridedMatrix, uplo::Char, conjugate::Bool=false) A end -gemv!{T<:BlasFloat}(y::StridedVector{T}, tA::Char, A::StridedMatrix{T}, x::StridedVector{T}) = generic_matvecmul!(y, tA, A, x) - -## Avoid calling BLAS.gemv! until #6941 is fixed. -# function gemv!{T<:BlasFloat}(y::StridedVector{T}, tA::Char, A::StridedMatrix{T}, x::StridedVector{T}) - -# stride(A, 1)==1 || return generic_matvecmul!(y, tA, A, x) - -# if tA != 'N' -# (nA, mA) = size(A) -# else -# (mA, nA) = size(A) -# end - -# nA==length(x) || throw(DimensionMismatch("")) -# mA==length(y) || throw(DimensionMismatch("")) -# mA == 0 && return zeros(T, 0) -# nA == 0 && return zeros(T, mA) -# return BLAS.gemv!(tA, one(T), A, x, zero(T), y) -# end +if Base.blas_vendor() == :openblas + ## Avoid calling BLAS.gemv! when OpenBLAS is being used until #6941 is fixed. + gemv!{T<:BlasFloat}(y::StridedVector{T}, tA::Char, A::StridedMatrix{T}, x::StridedVector{T}) = generic_matvecmul!(y, tA, A, x) +else + function gemv!{T<:BlasFloat}(y::StridedVector{T}, tA::Char, A::StridedMatrix{T}, x::StridedVector{T}) + stride(A, 1)==1 || return generic_matvecmul!(y, tA, A, x) + if tA != 'N' + (nA, mA) = size(A) + else + (mA, nA) = size(A) + end + nA==length(x) || throw(DimensionMismatch("")) + mA==length(y) || throw(DimensionMismatch("")) + mA == 0 && return zeros(T, 0) + nA == 0 && return zeros(T, mA) + return BLAS.gemv!(tA, one(T), A, x, zero(T), y) + end +end function syrk_wrapper!{T<:BlasFloat}(C::StridedMatrix{T}, tA::Char, A::StridedMatrix{T}) nC = chksquare(C)