Jutho / TensorOperations.jl

Julia package for tensor contractions and related operations
https://jutho.github.io/TensorOperations.jl/stable/
Other
443 stars 56 forks source link

TensorOperations and CUDA 3.3, 3.4 #107

Closed lpawela closed 2 years ago

lpawela commented 2 years ago

v3.2.3 does not work with CUDA above 3.2. An example

(@v1.6) pkg> st
  [052768ef] CUDA v3.4.2
  [6aa20fa7] TensorOperations v3.2.3

This combination results in

julia> using CUDA

julia> using TensorOperations
┌ Warning: Error requiring `CUDA` from `TensorOperations`
│   exception =
│    LoadError: UndefVarError: @workspace not defined
│    Stacktrace:
│      [1] include(mod::Module, _path::String)
│        @ Base ./Base.jl:386
│      [2] include(x::String)
│        @ TensorOperations ~/.julia/packages/TensorOperations/SVpOW/src/TensorOperations.jl:1
│      [3] macro expansion
│        @ ~/.julia/packages/Requires/7Ncym/src/Requires.jl:40 [inlined]
│      [4] top-level scope
│        @ ~/.julia/packages/TensorOperations/SVpOW/src/TensorOperations.jl:163
│      [5] eval
│        @ ./boot.jl:360 [inlined]
│      [6] eval
│        @ ~/.julia/packages/TensorOperations/SVpOW/src/TensorOperations.jl:1 [inlined]
│      [7] (::TensorOperations.var"#211#214")()
│        @ TensorOperations ~/.julia/packages/Requires/7Ncym/src/require.jl:99
│      [8] err(f::Any, listener::Module, modname::String)
│        @ Requires ~/.julia/packages/Requires/7Ncym/src/require.jl:47
│      [9] (::TensorOperations.var"#210#213")()
│        @ TensorOperations ~/.julia/packages/Requires/7Ncym/src/require.jl:98
│     [10] withpath(f::Any, path::String)
│        @ Requires ~/.julia/packages/Requires/7Ncym/src/require.jl:37
│     [11] (::TensorOperations.var"#209#212")()
│        @ TensorOperations ~/.julia/packages/Requires/7Ncym/src/require.jl:97
│     [12] listenpkg(f::Any, pkg::Base.PkgId)
│        @ Requires ~/.julia/packages/Requires/7Ncym/src/require.jl:20
│     [13] macro expansion
│        @ ~/.julia/packages/Requires/7Ncym/src/require.jl:95 [inlined]
│     [14] __init__()
│        @ TensorOperations ~/.julia/packages/TensorOperations/SVpOW/src/TensorOperations.jl:146
│     [15] _include_from_serialized(path::String, depmods::Vector{Any})
│        @ Base ./loading.jl:674
│     [16] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
│        @ Base ./loading.jl:760
│     [17] _require(pkg::Base.PkgId)
│        @ Base ./loading.jl:998
│     [18] require(uuidkey::Base.PkgId)
│        @ Base ./loading.jl:914
│     [19] require(into::Module, mod::Symbol)
│        @ Base ./loading.jl:901
│     [20] eval
│        @ ./boot.jl:360 [inlined]
│     [21] eval_user_input(ast::Any, backend::REPL.REPLBackend)
│        @ REPL ~/lib/julia-1.6.1/share/julia/stdlib/v1.6/REPL/src/REPL.jl:139
│     [22] repl_backend_loop(backend::REPL.REPLBackend)
│        @ REPL ~/lib/julia-1.6.1/share/julia/stdlib/v1.6/REPL/src/REPL.jl:200
│     [23] start_repl_backend(backend::REPL.REPLBackend, consumer::Any)
│        @ REPL ~/lib/julia-1.6.1/share/julia/stdlib/v1.6/REPL/src/REPL.jl:185
│     [24] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool)
│        @ REPL ~/lib/julia-1.6.1/share/julia/stdlib/v1.6/REPL/src/REPL.jl:317
│     [25] run_repl(repl::REPL.AbstractREPL, consumer::Any)
│        @ REPL ~/lib/julia-1.6.1/share/julia/stdlib/v1.6/REPL/src/REPL.jl:305
│     [26] (::Base.var"#874#876"{Bool, Bool, Bool})(REPL::Module)
│        @ Base ./client.jl:387
│     [27] #invokelatest#2
│        @ ./essentials.jl:708 [inlined]
│     [28] invokelatest
│        @ ./essentials.jl:706 [inlined]
│     [29] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
│        @ Base ./client.jl:372
│     [30] exec_options(opts::Base.JLOptions)
│        @ Base ./client.jl:302
│     [31] _start()
│        @ Base ./client.jl:485
│    in expression starting at /home/lpawela/.julia/packages/TensorOperations/SVpOW/src/implementation/cuarray.jl:2
└ @ Requires ~/.julia/packages/Requires/7Ncym/src/require.jl:49

When trying to use @cutensor

julia> @cutensor
ERROR: LoadError: UndefVarError: @cutensor not defined
in expression starting at REPL[4]:1

The same error persisted when I downgraded to 3.3. However, I managed to get this combination working

(CuSpinGlassTensors) pkg> st
  [052768ef] CUDA v3.2.1
  [6aa20fa7] TensorOperations v3.2.3