JuliaGPU / GPUArrays.jl

Reusable array functionality for Julia's various GPU backends.
MIT License
339 stars 78 forks source link

Error running GPUArrays on Jupyter #287

Closed sbacelar closed 4 years ago

sbacelar commented 4 years ago

I am using Julia 1.4.1 and GPUArrays v.3.4.1. I have no problem precompiling GPUArrays on REPL or Atom but on Jupyter I get the following error:

using GPUArrays
┌ Info: Precompiling GPUArrays [0c68f7d7-f131-5f86-a1c3-88cf8149b2d7]
└ @ Base loading.jl:1260
ERROR: LoadError: LoadError: UndefVarError: WrappedArray not defined
Stacktrace:
 [1] top-level scope at /home/sergio/.julia/packages/GPUArrays/JqOUg/src/host/abstractarray.jl:24
 [2] include(::Module, ::String) at ./Base.jl:377
 [3] include(::String) at /home/sergio/.julia/packages/GPUArrays/JqOUg/src/GPUArrays.jl:1
 [4] top-level scope at /home/sergio/.julia/packages/GPUArrays/JqOUg/src/GPUArrays.jl:25
 [5] include(::Module, ::String) at ./Base.jl:377
 [6] top-level scope at none:2
 [7] eval at ./boot.jl:331 [inlined]
 [8] eval(::Expr) at ./client.jl:449
 [9] top-level scope at ./none:3
in expression starting at /home/sergio/.julia/packages/GPUArrays/JqOUg/src/host/abstractarray.jl:24
in expression starting at /home/sergio/.julia/packages/GPUArrays/JqOUg/src/GPUArrays.jl:25

Failed to precompile GPUArrays [0c68f7d7-f131-5f86-a1c3-88cf8149b2d7] to /home/sergio/.julia/compiled/v1.4/GPUArrays/v5u0T_nVUOf.ji.

Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922
 [6] top-level scope at In[9]:1
maleadt commented 4 years ago

That's strange, WrappedArray is exported by Adapt starting with v1.1, and GPUArrays 3.4.1 requires Adapt v1.1 or higher. Could you have a look at your manifest, or which version of Adapt is being loaded within Jupyter?

maleadt commented 4 years ago

Are you using PackageCompiler, and/or a custom sysimg? Could you show the contents of Base.loaded_modules before loading any package?

sbacelar commented 4 years ago

Thank you. It is solved. Jupyter was using Adapt v.1.0.1.

maxfreu commented 4 years ago

I actually still get this error, even in the repl. In a new env I add Flux#master, which results in:

julia> using Flux
[ Info: Precompiling Flux [587475ba-b771-5e3f-ad9e-33799f191a9c]
ERROR: LoadError: LoadError: UndefVarError: WrappedArray not defined
Stacktrace:
 [1] top-level scope at /home/max/.julia/packages/GPUArrays/X4SqE/src/host/abstractarray.jl:24
 [2] include(::Module, ::String) at ./Base.jl:377
 [3] include(::String) at /home/max/.julia/packages/GPUArrays/X4SqE/src/GPUArrays.jl:1
 [4] top-level scope at /home/max/.julia/packages/GPUArrays/X4SqE/src/GPUArrays.jl:25
 [5] include(::Module, ::String) at ./Base.jl:377
 [6] top-level scope at none:2
 [7] eval at ./boot.jl:331 [inlined]
 [8] eval(::Expr) at ./client.jl:449
 [9] top-level scope at ./none:3
in expression starting at /home/max/.julia/packages/GPUArrays/X4SqE/src/host/abstractarray.jl:24
in expression starting at /home/max/.julia/packages/GPUArrays/X4SqE/src/GPUArrays.jl:25
ERROR: LoadError: Failed to precompile GPUArrays [0c68f7d7-f131-5f86-a1c3-88cf8149b2d7] to /home/max/.julia/compiled/v1.4/GPUArrays/v5u0T_VvmUK.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922
 [6] include(::Module, ::String) at ./Base.jl:377
 [7] top-level scope at none:2
 [8] eval at ./boot.jl:331 [inlined]
 [9] eval(::Expr) at ./client.jl:449
 [10] top-level scope at ./none:3
in expression starting at /home/max/.julia/packages/CUDA/42B9G/src/CUDA.jl:5
ERROR: LoadError: Failed to precompile CUDA [052768ef-5323-5732-b1bb-66c8b64840ba] to /home/max/.julia/compiled/v1.4/CUDA/oWw5k_VvmUK.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922
 [6] include(::Module, ::String) at ./Base.jl:377
 [7] top-level scope at none:2
 [8] eval at ./boot.jl:331 [inlined]
 [9] eval(::Expr) at ./client.jl:449
 [10] top-level scope at ./none:3
in expression starting at /home/max/.julia/packages/Flux/OUYqy/src/Flux.jl:29
ERROR: Failed to precompile Flux [587475ba-b771-5e3f-ad9e-33799f191a9c] to /home/max/.julia/compiled/v1.4/Flux/QdkVy_VvmUK.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922

Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 7 1700X Eight-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, znver1)

(fluxtest) pkg> add Flux#master
   Updating git-repo `https://github.com/FluxML/Flux.jl.git`
  Resolving package versions...
   Updating `~/sandbox/fluxtest/Project.toml`
  [587475ba] + Flux v0.11.0-DEV #master (https://github.com/FluxML/Flux.jl.git)
   Updating `~/sandbox/fluxtest/Manifest.toml`
...
  [79e6a3ab] + Adapt v2.0.2
  [587475ba] + Flux v0.11.0-DEV #master (https://github.com/FluxML/Flux.jl.git)
  [0c68f7d7] + GPUArrays v4.0.0
...

Flux v0.10.3 works, v0.10.4 doesn't.

On a fresh 1.5rc1 I encounter a potpourri of other errors, depending on the flux version.

maleadt commented 4 years ago

We've been using correct version bounds when adding that functionality to Adapt, so this is likely a package mismatch on your end.