Skip to content

Commit

Permalink
Merge pull request #6978 from lindahua/dh/openblas1
Browse files Browse the repository at this point in the history
Only apply the gemv workaround when OpenBLAS is being used.
  • Loading branch information
lindahua committed May 27, 2014
2 parents 87c3e38 + c7c7cf1 commit b57777f
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions base/linalg/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b57777f

Please sign in to comment.