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

Incorrect types following CUDA.jl refactoring #1200

Closed
clintonTE opened this issue May 29, 2020 · 3 comments
Closed

Incorrect types following CUDA.jl refactoring #1200

clintonTE opened this issue May 29, 2020 · 3 comments

Comments

@clintonTE
Copy link

Related to #1194 and JuliaGPU/CUDA.jl#14

using CUDA, Flux
function mwecuda()
  A = rand(100,10)

  @info "A: $(typeof(A))"
  @info "gpu(A): $(typeof(gpu(A)))"
  @info "cu(A): $(typeof(CUDA.cu(A)))"
  @assert typeof(CUDA.cu(A)) <: CUDA.CuArray
  @assert typeof(gpu(A)) <: CUDA.CuArray
end
mwecuda()

Output:

[ Info: A: Array{Float64,2}
[ Info: gpu(A): CuArrays.CuArray{Float32,2,Nothing}
[ Info: cu(A): CuArray{Float32,2,Nothing}
ERROR: LoadError: AssertionError: typeof(gpu(A)) <: CUDA.CuArray
@cossio
Copy link
Contributor

cossio commented Jun 1, 2020

Can you check what version of Flux you have? I think the latest Flux is incompatible with CUDA so maybe you are running an older version.

Also let's wait til #1204 gets merged.

@clintonTE
Copy link
Author

Master.

Note I also get a MethodError the first time I run the above on a clean session, but it goes away on subsequent passes. Here is a stack trace for the MethodError in case it is helpful:

┌ Error: Exception while generating log record in module Main at REPL[4]:6
│   exception =
│    MethodError: no method matching context!(::CUDAdrv.CuContext)
│    Closest candidates are:
│      context!(::CuContext) at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\state.jl:124
│      context!(::Function, ::CuContext) at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\state.jl:144
│    Stacktrace:
│     [1] switched_tasks(::Int64, ::Task) at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\state.jl:73
│     [2] prepare_cuda_call() at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\state.jl:29
│     [3] initialize_api() at C:\Users\Clinton\.julia\packages\CUDA\INQwl\lib\cuda\error.jl:98
│     [4] macro expansion at C:\Users\Clinton\.julia\packages\CUDA\INQwl\lib\cuda\libcuda.jl:348 [inlined]
│     [5] macro expansion at C:\Users\Clinton\.julia\packages\CUDA\INQwl\lib\cuda\error.jl:108 [inlined]
│     [6] cuMemAlloc_v2(::Base.RefValue{CuPtr{Nothing}}, ::Int64) at C:\Users\Clinton\.julia\packages\CUDA\INQwl\lib\utils\call.jl:93
│     [7] alloc at C:\Users\Clinton\.julia\packages\CUDA\INQwl\lib\cuda\memory.jl:73 [inlined]
│     [8] macro expansion at C:\Users\Clinton\.julia\packages\TimerOutputs\NvIUx\src\TimerOutput.jl:245 [inlined]
│     [9] macro expansion at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\memory.jl:114 [inlined]
│     [10] macro expansion at .\util.jl:234 [inlined]
│     [11] actual_alloc(::Int64) at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\memory.jl:113
│     [12] actual_alloc at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\memory\binned.jl:53 [inlined]
│     [13] macro expansion at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\memory\binned.jl:248 [inlined]
│     [14] macro expansion at C:\Users\Clinton\.julia\packages\TimerOutputs\NvIUx\src\TimerOutput.jl:245 [inlined]
│     [15] pool_alloc(::Int64, ::Int64) at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\memory\binned.jl:247
│     [16] alloc(::Int64) at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\memory\binned.jl:389
│     [17] macro expansion at C:\Users\Clinton\.julia\packages\TimerOutputs\NvIUx\src\TimerOutput.jl:245 [inlined]
│     [18] macro expansion at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\memory.jl:225 [inlined]
│     [19] macro expansion at .\util.jl:234 [inlined]
│     [20] alloc at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\memory.jl:224 [inlined]
│     [21] CuArray{Float32,2,P} where P(::UndefInitializer, ::Tuple{Int64,Int64}) at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\array.jl:109
│     [22] CuArray at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\array.jl:117 [inlined]
│     [23] similar at .\abstractarray.jl:671 [inlined]
│     [24] convert(::Type{CuArray{Float32,N,P} where P where N}, ::Array{Float64,2}) at C:\Users\Clinton\.julia\packages\GPUArrays\Ij4YR\src\host\construction.jl:91
│     [25] adapt_storage at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\array.jl:255 [inlined]
│     [26] adapt_structure at C:\Users\Clinton\.julia\packages\Adapt\3Zk8x\src\Adapt.jl:83 [inlined]
│     [27] adapt at C:\Users\Clinton\.julia\packages\Adapt\3Zk8x\src\Adapt.jl:81 [inlined]
│     [28] cu at C:\Users\Clinton\.julia\packages\CUDA\INQwl\src\array.jl:334 [inlined]
│     [29] macro expansion at .\logging.jl:322 [inlined]
│     [30] mwecuda() at .\REPL[4]:6
│     [31] top-level scope at REPL[5]:1
│     [32] eval(::Module, ::Any) at .\boot.jl:331
│     [33] eval_user_input(::Any, ::REPL.REPLBackend) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\REPL\src\REPL.jl:86
│     [34] macro expansion at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\REPL\src\REPL.jl:118 [inlined]
│     [35] (::REPL.var"#26#27"{REPL.REPLBackend})() at .\task.jl:358

@ToucheSir
Copy link
Member

The MWE works and I don't think this has been an issue for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants