Jutho / TensorOperations.jl

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

ERROR: @cutensor not defined #78

Closed lihebi closed 4 years ago

lihebi commented 4 years ago

This is weird enough. I'm on master branch:

Pkg.status()
...
([6aa20fa7] TensorOperations v2.1.1 #master (https://github.com/Jutho/TensorOperations.jl.git)
...
using TensorOperations: @cutensor

fail with

ERROR: UndefVarError: @cutensor not defined
Jutho commented 4 years ago

Did you also load CuArrays?

lihebi commented 4 years ago

Yes, I did. I just tried a new session with only CuArrays and TensorOperations, same error. I had no problem running Flux models on GPU with CuArrays.

Jutho commented 4 years ago

Do you have CUTENSOR installed.

Jutho commented 4 years ago

You can check with CuArrays.has_cutensor()

lihebi commented 4 years ago

I don't. I assumed it was installed by default with CUDA. Let me try it.

lihebi commented 4 years ago

It works after installing cuTENSOR. Thanks!

Jutho commented 4 years ago

Great. In time, I hopte to have GPU implementations which do not depend on CUTENSOR as fallback, but for now this is a necessary requirement.

mdav2 commented 4 years ago

I'm getting this same error within a package of mine. I'm not sure what may be causing it, because I read this thread and installed cuTENSOR. In a REPL, I'm able to use @cutensor just fine, but when attempting to import the macro in a submodule I get,

ERROR: LoadError: LoadError: LoadError: UndefVarError: @cutensor not defined
Stacktrace:
 [1] include(::Module, ::String) at ./Base.jl:377
 [2] include(::String) at /home/mmd01986/.julia/dev/JuES.jl/src/CoupledCluster.jl:16
 [3] top-level scope at /home/mmd01986/.julia/dev/JuES.jl/src/CoupledCluster.jl:31
 [4] include(::Module, ::String) at ./Base.jl:377
 [5] include(::String) at /home/mmd01986/.julia/dev/JuES.jl/src/JuES.jl:1
 [6] top-level scope at /home/mmd01986/.julia/dev/JuES.jl/src/JuES.jl:19
 [7] include(::Module, ::String) at ./Base.jl:377
 [8] top-level scope at none:2
 [9] eval at ./boot.jl:331 [inlined]
 [10] eval(::Expr) at ./client.jl:449
 [11] top-level scope at ./none:3
in expression starting at /home/mmd01986/.julia/dev/JuES.jl/src/GP-RCCD.jl:7
in expression starting at /home/mmd01986/.julia/dev/JuES.jl/src/CoupledCluster.jl:31
in expression starting at /home/mmd01986/.julia/dev/JuES.jl/src/JuES.jl:19

Running println(CuArrays.has_cutensor()) right before using TensorOperations: @tensoropt @cutensor prints true.

lpawela commented 3 years ago

Is there any update on this. I seem to be facing the same issu as @mdav2 when developing my package. Testing the package crashes on precompilation, but before the crash I can confirm that CUDA.has_cutensor() = true. The next lines are

ERROR: LoadError: LoadError: LoadError: UndefVarError: @cutensor not defined
Stacktrace:
 [1] top-level scope
 [2] include(::Function, ::Module, ::String) at ./Base.jl:380
 [3] include at ./Base.jl:368 [inlined]
 [4] include(::String) at /home/lpawela/new-zksi-repo/SpinGlassPEPS.jl/src/SpinGlassPEPS.jl:1
 [5] top-level scope at /home/lpawela/new-zksi-repo/SpinGlassPEPS.jl/src/SpinGlassPEPS.jl:10
 [6] include(::Function, ::Module, ::String) at ./Base.jl:380
 [7] include(::Module, ::String) at ./Base.jl:368
 [8] top-level scope at none:2
 [9] eval at ./boot.jl:331 [inlined]
 [10] eval(::Expr) at ./client.jl:467
 [11] top-level scope at ./none:3
in expression starting at /home/lpawela/new-zksi-repo/SpinGlassPEPS.jl/src/MPS.jl:89
in expression starting at /home/lpawela/new-zksi-repo/SpinGlassPEPS.jl/src/MPS.jl:83
in expression starting at /home/lpawela/new-zksi-repo/SpinGlassPEPS.jl/src/SpinGlassPEPS.jl:10

My Project.toml is

[deps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

When the tests start I can confirm that

(SpinGlassPEPS) pkg> test
    Testing SpinGlassPEPS
Status `/tmp/jl_un8h4g/Project.toml`
  [052768ef] CUDA v1.3.3
  [2c514f87] SpinGlassPEPS v0.0.1 `~/new-zksi-repo/SpinGlassPEPS.jl`
  [6aa20fa7] TensorOperations v3.0.1
  [37e2e46d] LinearAlgebra
  [8dfed614] Test