Skip to content

Segmentation fault with threaded FFTW when JULIA_COPY_STACKS="yes" #40677

Open

Description

Hey,

initially I opened an issue in FFTW.jl but I'm not sure whether it really belongs there since I found about some issues with JULIA_COPY_STACKS="yes" here.
I also tried threaded for loops or threaded matmul but it didn't crash.

My setup with FFTW v1.4.0:

julia> FFTW.version # is that the linked library? How to change that?
v"3.3.9"

julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 5 5600X 6-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, generic)
Environment:
  JULIA_NUM_THREADS = 12
  JULIA_COPY_STACKS = yes

The following crashes with JULIA_COPY_STACKS="yes" and works for JULIA_COPY_STACK="no":

~ export JULIA_COPY_STACKS="yes"~ julia --threads=2             
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.1 (2021-04-23)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> begin
           using FFTW
           FFTW.set_num_threads(12)
           x = randn((400, 400, 13))
           fft(x);
       end;

signal (11): Segmentation fault
in expression starting at REPL[1]:1
spawn_apply at /home/fxw/.julia/artifacts/81791030d1dcd08bf0c67b3e8224cb573d0f5a0a/lib/libfftw3.so (unknown line)
#2 at ./threadingconstructs.jl:169
unknown function (ip: 0x7f10e857072f)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:839
jl_init_root_task at /buildworker/worker/package_linux64/build/src/task.c:1288
_julia_init at /buildworker/worker/package_linux64/build/src/init.c:800
repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:702
main at julia (unknown line)

signal (11): Segmentation fault
in expression starting at REPL[1]:1
spawn_apply at /home/fxw/.julia/artifacts/81791030d1dcd08bf0c67b3e8224cb573d0f5a0a/lib/libfftw3.so (unknown line)
#2 at ./threadingconstructs.jl:169
unknown function (ip: 0x7f10e857072f)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:839
jl_init_root_task at /buildworker/worker/package_linux64/build/src/task.c:1288
jl_threadfun at /buildworker/worker/package_linux64/build/src/partr.c:264
start_thread at /lib/x86_64-linux-gnu/libpthread.so.0 (unknown line)
clone at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
Allocations: 2005171 (Pool: 2004448; Big: 723); GC: 4
[1]    5639 segmentation fault (core dumped)  julia --threads=2
➜  ~ export JULIA_COPY_STACKS="no" 
➜  ~ julia --threads=2            
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.1 (2021-04-23)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> begin
           using FFTW
           FFTW.set_num_threads(12)
           x = randn((400, 400, 13))
           fft(x);
       end;

I actually don't really understand what the variable does but it was suggested by JavaCall.jl.

Thanks a lot and sorry it that's wrong here,

Felix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    upstreamThe issue is with an upstream dependency, e.g. LLVM

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions