Skip to content

Segmentation fault with threaded FFTW FFTW.set_num_threads(n) and julia --threads=k where k, n > 1 #236

@JakobAsslaender

Description

@JakobAsslaender

Hi,
I am getting a segfault error when multithreading both julia and FFTW, but I do not think this is the same bug as reported in #200. Forgive me if I am wrong.

The segfault occurs when writing a script with this content

using FFTW
FFTW.set_num_threads(20)
tmpVec = Array{Complex{Float64},3}(undef, (1024,1024,1024))
FP = plan_fft!(tmpVec; flags = FFTW.MEASURE)

and calling it with julia --threads 20 my_script.jl. The error message is

signal (11): Segmentation fault
in expression starting at .../tmp_debug.jl:9
spawn_apply at .../.julia/artifacts/e95ca94c82899616429924e9fdc7eccda275aa38/lib/libfftw3.so (unknown line)
#2 at ./threadingconstructs.jl:178
unknown function (ip: 0x7e7dc004ba0f)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:877
Allocations: 1439093 (Pool: 1438431; Big: 662); GC: 2
Segmentation fault

The error does not occur when using a smaller array size (e.g. 512 x 512 x 512), when executing this script in a (multi-threaded) REPL, or when calling julia --threads 1 my_script.jl. Further, I get this error only on our server with large memory:

julia> versioninfo(verbose=true)
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      "Red Hat Enterprise Linux Server release 7.9 (Maipo)"
  uname: Linux 3.10.0-1160.31.1.el7.x86_64 #1 SMP Wed May 26 20:18:08 UTC 2021 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz: 
                 speed         user         nice          sys         idle          irq
       #1-40  2400 MHz  124012989 s        151 s    2988670 s  400355468 s          0 s
       
  Memory: 1510.5959396362305 GB (1.20248398046875e6 MB free)
  Uptime: 1.31918749e6 sec
  Load Avg:  76.13  75.18  74.3
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake-avx512)

And not on a server with less memory, but otherwise (AFAIK) equivalent hard- and software:

julia> versioninfo(verbose=true)
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      "Red Hat Enterprise Linux Server release 7.9 (Maipo)"
  uname: Linux 3.10.0-1160.31.1.el7.x86_64 #1 SMP Wed May 26 20:18:08 UTC 2021 x86_64 x86_64
  CPU: Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz: 
                 speed         user         nice          sys         idle          irq
       #1-40  2400 MHz   21218022 s      22320 s    1268911 s  508883968 s          0 s
       
  Memory: 376.60246658325195 GB (341804.1875 MB free)
  Uptime: 1.32906989e6 sec
  Load Avg:  20.26  11.21  4.94
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake-avx512)

Both machines are using

julia> FFTW.version
v"3.3.10"

(they are using a central julia installation and central config files etc.)

Note that JULIA_COPY_STACKS="yes/no" did not change the behavior, hence I do not believe it is a duplicate of #200.

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