AppleAccelerateLinAlgWrapper.jl icon indicating copy to clipboard operation
AppleAccelerateLinAlgWrapper.jl copied to clipboard

`ldiv` segfaults

Open mryodo opened this issue 3 years ago • 3 comments

Top of the morning!

Sorry, I know the wrapper is not a priority right now. Just wanted to check if it is a common issue: right now ldiv segfaults (but gemm works fine).

Example:

using LinearAlgebra, AppleAccelerateLinAlgWrapper

N=1000; A=randn(N, N); c=A*ones(N,1);

 AppleAccelerateLinAlgWrapper.ldiv(A, c)

The output is:

signal (11): Segmentation fault: 11
in expression starting at REPL[3]:1
BLASStateRelease at /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib (unknown line)
BLASStateRelease at /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib (unknown line)
Allocations: 3432183 (Pool: 3428169; Big: 4014); GC: 4

Technical info: julia-1.8.0-rc1, macos 13.0 on apple m1

mryodo avatar Sep 02 '22 11:09 mryodo

I just tried this on an M1 MacBook Pro, macos 13.0, julia-1.8.2 and got

julia> N=1000; A=rand(N,N); c=A*ones(N,1);

julia> AppleAccelerateLinAlgWrapper.ldiv(A,c)
julia(1444,0x1e605a500) malloc: Incorrect checksum for freed object 0x14f20b600: probably modified after being freed.
Corrupt value: 0x7ff8000000000000
julia(1444,0x1e605a500) malloc: *** set a breakpoint in malloc_error_break to debug

but when I do the same thing with

julia> N=1000; A=rand(N,N); c=A*ones(N);

I do not segfault. The call fails anyhow, though.

ERROR: MethodError: no method matching ldiv!(::Matrix{Float64}, ::Vector{Float64}, ::Val{Int32})
Closest candidates are:
  ldiv!(::StridedMatrix{T}, ::LinearAlgebra.AbstractTriangular{T}, ::Val{BlasInt}) where {T<:Union{Float32, Float64}, BlasInt<:Union{Int32, Int64}} at ~/Dropbox/Julia/dev/AppleAccelerateLinAlgWrapper/src/AppleAccelerateLinAlgWrapper.jl:133
  ldiv!(::AbstractMatrix, ::AbstractMatrix, ::Val{BlasInt}) where BlasInt at ~/Dropbox/Julia/dev/AppleAccelerateLinAlgWrapper/src/AppleAccelerateLinAlgWrapper.jl:166
  ldiv!(::AbstractMatrix, ::AbstractMatrix) at ~/Dropbox/Julia/dev/AppleAccelerateLinAlgWrapper/src/AppleAccelerateLinAlgWrapper.jl:166
Stacktrace:
 [1] ldiv(A::Matrix{Float64}, B::Vector{Float64}, ::Val{Int32}) (repeats 2 times)
   @ AppleAccelerateLinAlgWrapper ~/Dropbox/Julia/dev/AppleAccelerateLinAlgWrapper/src/AppleAccelerateLinAlgWrapper.jl:171
 [2] top-level scope
   @ REPL[5]:1

julia> 

ctkelley avatar Oct 26 '22 18:10 ctkelley

It'll be a few weeks before I have access to an M1 mac again to try these examples. I'll try and remember.

chriselrod avatar Oct 27 '22 09:10 chriselrod

Ok, so @ctkelley's problem is still here (but I think it is easy to add another vector specific definition with casting to matrix), but segfault is gone on macos13.1b

which is weird

mryodo avatar Oct 31 '22 14:10 mryodo