Julia: EXCEPTION_ACCESS_VIOLATION when using dot from LinearAlgebra.jl

Created on 5 Nov 2020  ·  8Comments  ·  Source: JuliaLang/julia

I noticed this problem on my machine. I think it may be a bug as another person was able to reproduce it on their machine.

The problem is that julia crashes when I use the dot function from LinearAlgebra.jl on arrays of complex numbers that are longer than 10^4. If the arrays of complex numbers have of length 10001 or more, it crashes. If the arrays are real dot works just fine. If the arrays are complex and are less than 10001 entries dot works fine.

Another interesting point is that when I run the code for the dot function (found in the repository for LinearAlgebra) and use that function it works as it should in this case. So, when I run

function dot end

function dot(x, y) # arbitrary iterables
    ix = iterate(x)
    iy = iterate(y)
    if ix === nothing
        if iy !== nothing
            throw(DimensionMismatch("x and y are of different lengths!"))
        end
        return dot(zero(eltype(x)), zero(eltype(y)))
    end
    if iy === nothing
        throw(DimensionMismatch("x and y are of different lengths!"))
    end
    (vx, xs) = ix
    (vy, ys) = iy
    s = dot(vx, vy)
    while true
        ix = iterate(x, xs)
        iy = iterate(y, ys)
        ix === nothing && break
        iy === nothing && break
        (vx, xs), (vy, ys) = ix, iy
        s += dot(vx, vy)
    end
    if !(iy === nothing && ix === nothing)
        throw(DimensionMismatch("x and y are of different lengths!"))
    end
    return s
end

dot(x::Number, y::Number) = conj(x) * y

function dot(x::AbstractArray, y::AbstractArray)
    lx = length(x)
    if lx != length(y)
        throw(DimensionMismatch("first array has length $(lx) which does not match the length of the second, $(length(y))."))
    end
    if lx == 0
        return dot(zero(eltype(x)), zero(eltype(y)))
    end
    s = zero(dot(first(x), first(y)))
    for (Ix, Iy) in zip(eachindex(x), eachindex(y))
        @inbounds s += dot(x[Ix], y[Iy])
    end
    s
end

foo(n) = randn(n) + im*randn(n)

dot(foo(10^7),foo(10^7))

It works fine but if I run:

using LinearAlgebra: dot

foo(n) = randn(n) + im*randn(n)

dot(foo(10001),foo(10001))

julia crashes.

The error message I get before julia dies is here:

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception:
Please submit a bug repor
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1d407280 --  at 0x1d407280 -- OLATION with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1d407280 --  at 0x1d407280 --  at 0x1d407280 -- OLATION with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1d407280 --  at 0x1d407280 -- OLATION with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1d407280 --  at 0x1d407280 -- OLATION at 0x1d407280 --  at 0x1d407280 -- OLATION with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1d407280 --  at 0x1d407280 -- OLATION with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1d407280 --

Here are my configurations

julia> versioninfo()
Julia Version 1.5.2
Commit 539f3ce943 (2020-09-23 23:17 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

I am happy to supply any other help information.
Thank you.

bug windows

All 8 comments

can reproduce with a simple

julia> using LinearAlgebra

julia> dot(rand(10001).*im, rand(10001).*im)

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION  with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1a64b500 --  at 0x1a64b500 --  OLATION  with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1a64b500 --  at 0x1a64b500 --  OLATION  with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1a64b500 --  at 0x1a64b500 --  OLATION ulia\bin\libopenblas64_.DLL (unknown line)
  error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1a64b500 --  at 0x1a64b500 --  OLATION ulia\bin\libopenblas64_.DLL (unknown line)
in expression starting at REPL[3]:1
 ibopenblas64_.DLL (unknown line)
  error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1a64b500 --  at 0x1a64b500 --  OLATION EPL[3]:1
 ibopenblas64_.DLL (unknown line)
  error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x1a64b500 --  OLATION at 0x1a64b500 --  at 0x1a64b500 --  OLATION EPL[3]:1
 at 0x1a64b500 --

Works for me with Julia 1.5.2 on MacOS. Is the problem specific to the Windows build?

Works for me with Julia 1.5.2 on MacOS. Is the problem specific to the Windows build?

The build of my Windows 10 OS is 19041.572

Doesn't crash for me either, MacOS.

Note that the method of dot being called isn't the generic one pasted, @less dot(foo(10001),foo(10001)) leads to:

dot(x::Union{DenseArray{T},StridedVector{T}}, y::Union{DenseArray{T},StridedVector{T}}) where {T<:BlasComplex} = BLAS.dotc(x, y)

I can't reproduce this on Linux on the latest Julia master.

Note that the method of dot being called isn't the generic one pasted, @less dot(foo(10001),foo(10001)) leads to:

dot(x::Union{DenseArray{T},StridedVector{T}}, y::Union{DenseArray{T},StridedVector{T}}) where {T<:BlasComplex} = BLAS.dotc(x, y)

I see. That's good to note. Thank you.

Is this duplicate of #36976? If so, OpenBLAS has fixed it upstream .

Yes, looks like a duplicate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

i-apellaniz picture i-apellaniz  ·  3Comments

sbromberger picture sbromberger  ·  3Comments

helgee picture helgee  ·  3Comments

iamed2 picture iamed2  ·  3Comments

StefanKarpinski picture StefanKarpinski  ·  3Comments