Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when creating CuArray of CuArray #133

Closed
DesmondZhong opened this issue May 7, 2019 · 2 comments
Closed

Segmentation fault when creating CuArray of CuArray #133

DesmondZhong opened this issue May 7, 2019 · 2 comments
Labels
bug Something isn't working cuda array Stuff about CuArray.

Comments

@DesmondZhong
Copy link

Describe the bug
Segmentation fault when creating CuArray of CuArray

To Reproduce
The Minimal Working Example (MWE) for this bug:

using CuArrays
x1 = cu(rand(5))
x2 = cu(rand(5))
x = [x1, x2] # Array of CuArray
convert(CuArray, [x1, x2])

I got the following error:

2-element CuArray{CuArray{Float32,1},1}:
 Float32[0.669814, 0.810592, 0.705412, 0.670489, 0.720598]
signal (11): Segmentation fault
in expression starting at no file:0
jl_alloc_array_1d at /usr/bin/../lib/libjulia.so.1 (unknown line)
unknown function (ip: 0x7fcb38be7d40)
Type at ./dict.jl:110
d at /home/desmond/.julia/packages/Lazy/ZAeCx/src/macros.jl:241 [inlined]
render at /home/desmond/.julia/packages/Atom/E4PBh/src/display/view.jl:31
render at /home/desmond/.julia/packages/Media/ItEPc/src/system.jl:173
render at /home/desmond/.julia/packages/Media/ItEPc/src/system.jl:173
jl_fptr_trampoline at /usr/bin/../lib/libjulia.so.1 (unknown line)
jl_apply_generic at /usr/bin/../lib/libjulia.so.1 (unknown line)
render at /home/desmond/.julia/packages/Atom/E4PBh/src/display/view.jl:49
render at /home/desmond/.julia/packages/Atom/E4PBh/src/display/display.jl:19 [inlined]
displayandrender at /home/desmond/.julia/packages/Atom/E4PBh/src/display/showdisplay.jl:127
jl_fptr_trampoline at /usr/bin/../lib/libjulia.so.1 (unknown line)
jl_apply_generic at /usr/bin/../lib/libjulia.so.1 (unknown line)
JuliaGPU/CuArrays.jl#117 at /home/desmond/.julia/packages/Atom/E4PBh/src/eval.jl:102
jl_apply_generic at /usr/bin/../lib/libjulia.so.1 (unknown line)
jl_f__apply at /usr/bin/../lib/libjulia.so.1 (unknown line)
jl_f__apply_latest at /usr/bin/../lib/libjulia.so.1 (unknown line)
macro expansion at ./essentials.jl:742 [inlined]
JuliaGPU/CuArrays.jl#113 at /home/desmond/.julia/packages/Atom/E4PBh/src/eval.jl:86
jl_apply_generic at /usr/bin/../lib/libjulia.so.1 (unknown line)
handlemsg at /home/desmond/.julia/packages/Atom/E4PBh/src/comm.jl:164
unknown function (ip: 0x7fcb2af2376c)
jl_apply_generic at /usr/bin/../lib/libjulia.so.1 (unknown line)
jl_f__apply at /usr/bin/../lib/libjulia.so.1 (unknown line)
JuliaGPU/CuArrays.jl#19 at ./task.jl:259
unknown function (ip: 0x7fcb2afc6574)
jl_apply_generic at /usr/bin/../lib/libjulia.so.1 (unknown line)
unknown function (ip: 0x7fcb43df3617)
unknown function (ip: 0xffffffffffffffff)
Allocations: 72891018 (Pool: 72878366; Big: 12652); GC: 153

Julia has exited. Press Enter to start a new session.

Apparently, it tried to create a CuArray of CuArray, but some segmentation fault is hit along the way. When I run this code, sometimes the error occurs before the line 2-element CuArray{CuArray{Float32,1},1}: Float32[0.669814, 0.810592, 0.705412, 0.670489, 0.720598] shows up in the REPL.

Expected behavior
expect to create a 2-element CuArray{CuArray{Float32,1},1}:

Build log

Building ZipFile ─────────→ `~/.julia/packages/ZipFile/YHTbb/deps/build.log`
  Building Arpack ──────────→ `~/.julia/packages/Arpack/UiiMc/deps/build.log`
┌ Error: Error building `Arpack`: 
│ ERROR: LoadError: LibraryProduct(nothing, ["libarpack"], :libarpack, "Prefix(/home/desmond/.julia/packages/Arpack/UiiMc/deps/usr)") is not satisfied, cannot generate deps.jl!
│ Stacktrace:
│  [1] #write_deps_file#152(::Bool, ::Function, ::String, ::Array{LibraryProduct,1}) at /home/desmond/.julia/packages/BinaryProvider/TcAwt/src/Products.jl:414
│  [2] (::getfield(BinaryProvider, Symbol("#kw##write_deps_file")))(::NamedTuple{(:verbose,),Tuple{Bool}}, ::typeof(write_deps_file), ::String, ::Array{LibraryProduct,1}) at ./none:0
│  [3] top-level scope at none:0
│  [4] include(::String) at ./client.jl:403
│  [5] top-level scope at none:0
│ in expression starting at /home/desmond/.julia/packages/Arpack/UiiMc/deps/build.jl:74
└ @ Pkg.Operations /build/julia/src/julia-1.1.0/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1075
  Building SpecialFunctions → `~/.julia/packages/SpecialFunctions/fvheQ/deps/build.log`
  Building Rmath ───────────→ `~/.julia/packages/Rmath/Py9gH/deps/build.log`
  Building Conda ───────────→ `~/.julia/packages/Conda/CpuvI/deps/build.log`
  Building CUDAdrv ─────────→ `~/.julia/packages/CUDAdrv/3cR2F/deps/build.log`
  Building LLVM ────────────→ `~/.julia/packages/LLVM/tg8MX/deps/build.log`
  Building CUDAnative ──────→ `~/.julia/packages/CUDAnative/wU0tS/deps/build.log`
  Building FFTW ────────────→ `~/.julia/packages/FFTW/p7sLQ/deps/build.log`
  Building CuArrays ────────→ `~/.julia/packages/CuArrays/PwSdF/deps/build.log`
  Building CodecZlib ───────→ `~/.julia/packages/CodecZlib/9jDi1/deps/build.log`

Environment details (please complete this section)
Details on Julia:

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) Core(TM) i7-3740QM CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, ivybridge)
Environment:
  JULIA_EDITOR = atom -a
  JULIA_NUM_THREADS = 4

Julia packages:

  • CUDAdrv
  • CUDAnative
  • CuArrays
  • Flux

CUDA version: 10.1
Driver Version: 418.56

Let me know if there's any other information I should provide! Thank you!

@maleadt maleadt transferred this issue from JuliaGPU/CuArrays.jl May 27, 2020
@maleadt maleadt added bug Something isn't working cuda array Stuff about CuArray. labels May 27, 2020
@kshyatt
Copy link
Contributor

kshyatt commented Jul 10, 2020

FWIW when I try to run this MWE now:

julia> using CUDA

julia> x1 = cu(rand(5));

julia> x2 = cu(rand(5));

julia> convert(CuArray, [x1, x2])
ERROR: CuArray only supports bits types
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] CuArray{CuArray{Float32,1,Nothing},1,P} where P(::UndefInitializer, ::Tuple{Int64}) at /home/kshyatt/.julia/dev/CUDA/src/array.jl:118
 [3] CuArray{CuArray{Float32,1,Nothing},N,P} where P where N(::UndefInitializer, ::Tuple{Int64}) at /home/kshyatt/.julia/dev/CUDA/src/array.jl:127
 [4] similar(::Type{CuArray{CuArray{Float32,1,Nothing},N,P} where P where N}, ::Tuple{Int64}) at ./abstractarray.jl:671
 [5] convert(::Type{CuArray}, ::Array{CuArray{Float32,1,Nothing},1}) at /home/kshyatt/.julia/packages/GPUArrays/X4SqE/src/host/construction.jl:95
 [6] top-level scope at REPL[9]:1

Which seems like a reasonable error to throw? Can we close this?

@maleadt
Copy link
Member

maleadt commented Jul 10, 2020

Yup, that seems entirely reasonable to me!

@maleadt maleadt closed this as completed Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda array Stuff about CuArray.
Projects
None yet
Development

No branches or pull requests

3 participants