Skip to content

Julia crash when using fft_plan  #277

Open
@JuhaHeiskala

Description

@JuhaHeiskala

(Filed this first in Julia issues 51249, but got directed here. My gut feeling was that Julia gives invalid memory to FFTW)

Julia 1.9.3 installed from Generic linux package on Ubuntu 22.04 system.

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × AMD Ryzen 9 7950X 16-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
  Threads: 1 on 32 virtual cores
Environment:
  LD_LIBRARY_PATH = :/usr/local/lib

I get a crash when using the below code as a module with using Test, but not if I load the source directly in REPL include("Test.jl").

Test.jl code below
view in fft_out = fft(view(A, :, 1)) is not actually needed, also fft_plan*A[:,1] crashes. I just used the view when hit this the first time)

module Test
using FFTW

A = randn(ComplexF64, 128, 10)

fft_out = fft(view(A, :, 1))
fft_plan = plan_fft(zeros(ComplexF64, 128))

# This doesn't crash when loading the module
fft_out = fft_plan*view(A, :, 1)

function test()

  A = randn(ComplexF64, 128, 10)
  # this crashes
  f = fft_plan*view(A, :, 1)

  # this doesn't crash either loaded from REPL or as module
  # f = fft(view(A, :, 1))
end

end # module Test

I.e. below does not crash

julia> include("Test.jl")
Main.Test

julia> Test.test()
128-element Vector{ComplexF64}:
   -5.399150700691746 - 13.263908986406738im
   4.4856379107268936 + 14.76279541263508im
...

but this crashes

julia> using Test

julia> Test.test()

[532823] signal (11.1): Segmentation fault
in expression starting at REPL[2]:1
fftw_execute_dft at /home/juha/.julia/artifacts/e95ca94c82899616429924e9fdc7eccda275aa38/lib/libfftw3.so (unknown line)
unknown function (ip: 0x7fe691102216)

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