Skip to content

Parallelization on CPU segfaults on occasion  #166

Closed
@amcostant

Description

@amcostant

I tried implementing a Palatalized diff() see code below

function pdiff(f::Array{T,1},x::T) where T <:SymEngine.Basic
       dfdx = Array{Basic}(undef,length(f))
       Threads.@threads for i = 1:length(f)
          dfdx[i]=diff(f[i],x)
       end
       return dfdx
end

julia> a,b = SymEngine.symbols("a b")
julia> ex = [rand(1)[1]*a^2+rand(1)[1]*a*b for i in 1:10000]
julia> pdiff(ex,a)

The code runs successfully part of the time and part of the time I get this error:

signal (11): Segmentation fault
in expression starting at no file:0

signal (11): Segmentation fault
in expression starting at no file:0

signal (11): Segmentation fault

signal (11): Segmentation fault

signal (11): Segmentation fault

signal (11): Segmentation fault
in expression starting at no file:0
in expression starting at no file:0
in expression starting at no file:0
in expression starting at no fileunknown function (ip: 0x7420e5b57749acff)
Allocaression starting at no file:0
Allocations: 11560826 (Pool: 11558345; Big: 2481); GC: 25
n expression starting at no file:0
in expression starting at no file:0
in expression starting at no file:0
in expression starting at no filein expression starting at no file:0
in expression starting at no filein expression starting at no file:0
in expression starting at no fileSegmentation fault (core dumped)`

and sometimes this:
'julia> pdiff(ex,a)

signal (11): Segmentation fault
in expression starting at no file:0

signal (11): Segmentation fault

signal (11): Segmentation fault
in expres11): Segmentation fault
in expression starting at no fileunknown function (ip: 0x1ecf6644a00fin expression starting at no filein expression starting at no file:0
n expression starting at no file:0
0ff)
in expression starting at no file:0
Allocations: 11779635 (Pool: 1177712Allocations: 11779635 (Pool: 1177712Allocations: 11779635 (Pool: 11777124; Big: 2511); GC: 25
Segmentation fault (core dumped)'

for info on my system

julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, haswell)
Environment:
  JULIA_NUM_THREADS = 20

I have noticed that with more cores the problem is more persistent. For example when attempting to benchmark on two cores, I get this:

julia> @benchmark pdiff(ex,a)

Error thrown in threaded loop on thread 0: ReadOnlyMemoryError()
Error thrown in threaded loop on thread 1: ReadOnlyMemoryError()
Error thrown in threaded loop on thread 0: ReadOnlyMemoryError()
Error thrown in threaded loop on thread 1: ReadOnlyMemoryError()
Error thrown in threaded loop on thread 0: ReadOnlyMemoryError()
Error thrown in threaded loop on thread 1: ReadOnlyMemoryError()
...
Error thrown in threaded loop on thread 1: ReadOnlyMemoryError()
Error thrown in threaded loop on thread 0: ReadOnlyMemoryError()
Error thrown in threaded loop on thread 1: ReadOnlyMemoryError()corrupted double-linked list

Error thrown in threaded loop on thread 1: ReadOnlyMemoryError()
signal (6): Aborted
in expression starting at no file:0

The problem persists whenever I use more than one core, and I do not have this problem when running other parallel code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions