-
Notifications
You must be signed in to change notification settings - Fork 61
Confusion when using cuTENSOR #166
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
Comments
The setup is done through a package extension for both cuTENSOR and CUDA, such that it only gets loaded if there has been an import or using statement for both of these at some point. My best guess is to just add |
Ok, I somehow didn't paste the ✓ Strided
753
✓ NNlib → NNlibCUDAExt
754
✓ TensorOperations
755
✓ cuTENSOR
756
✓ TensorOperations → TensorOperationscuTENSORExt
757
✓ TensorOperations → TensorOperationsChainRulesCoreExt
758
✗ SpinGlassTensors
759
82 dependencies successfully precompiled in 88 seconds
761
ERROR: The following 1 direct dependency failed to precompile:
762
SpinGlassTensors [7584fc6a-5a23-4eeb-8277-827aab0146ea]
763
Failed to precompile SpinGlassTensors [7584fc6a-5a23-4eeb-8277-827aab0146ea] to "/tmp/jl_pIyevc/compiled/v1.10/SpinGlassTensors/jl_MqPj3t".
764
ERROR: LoadError: ArgumentError: cuTENSOR not loaded: add `using cuTENSOR` or `import cuTENSOR` before using `@cutensor`
765
Stacktrace:
766
[1] var"@cutensor"(__source__::LineNumberNode, __module__::Module, ex::Expr)
767
@ TensorOperations /tmp/jl_pIyevc/packages/TensorOperations/LAzcX/src/indexnotation/tensormacros.jl:300
768
[2] include(mod::Module, _path::String)
769
@ Base ./Base.jl:495
770
[3] include(x::String)
771
@ SpinGlassTensors /tmp/jl_pIyevc/packages/SpinGlassTensors/1PbPU/src/SpinGlassTensors.jl:1
772
[4] top-level scope
773
@ /tmp/jl_pIyevc/packages/SpinGlassTensors/1PbPU/src/SpinGlassTensors.jl:26
774
[5] include
775
@ ./Base.jl:495 [inlined]
776
[6] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
777
@ Base ./loading.jl:2222
778
[7] top-level scope
779
@ stdin:3
780
in expression starting at /tmp/jl_pIyevc/packages/SpinGlassTensors/1PbPU/src/mps/utils.jl:46
781
in expression starting at /tmp/jl_pIyevc/packages/SpinGlassTensors/1PbPU/src/mps/utils.jl:43
782
in expression starting at /tmp/jl_pIyevc/packages/SpinGlassTensors/1PbPU/src/SpinGlassTensors.jl:1
783
in expression starting at stdin:
784
Stacktrace:
785
[1] pkgerror(msg::String)
786
@ Pkg.Types /opt/hostedtoolcache/julia/1.10.2/x64/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70
787
[2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{io::IOContext{Base.PipeEndpoint}})
788
@ Pkg.API /opt/hostedtoolcache/julia/1.10.2/x64/share/julia/stdlib/v1.10/Pkg/src/API.jl:1659
789
[3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{Base.PipeEndpoint}, kwargs::@Kwargs{})
790
@ Pkg.API /opt/hostedtoolcache/julia/1.10.2/x64/share/julia/stdlib/v1.10/Pkg/src/API.jl:159
791
[4] precompile(pkgs::Vector{Pkg.Types.PackageSpec})
792
@ Pkg.API /opt/hostedtoolcache/julia/1.10.2/x64/share/julia/stdlib/v1.10/Pkg/src/API.jl:148
793
[5] precompile(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::@Kwargs{})
794
@ Pkg.API /opt/hostedtoolcache/julia/1.10.2/x64/share/julia/stdlib/v1.10/Pkg/src/API.jl:174
795
[6] precompile()
796
@ Pkg.API /opt/hostedtoolcache/julia/1.10.2/x64/share/julia/stdlib/v1.10/Pkg/src/API.jl:165
797
[7] top-level scope
798
@ none:17 |
I'm honestly not entirely sure what is going wrong here. The only thing I can think of is that the check I wrote is expanded before cuTENSOR is being loaded because it happens at compile time. Could you try and replace the |
Ok, this worked. Thank you! |
This should be fixed as of version v5. In particular, it should no longer be necessary to explicitly specify the backend and allocator in the way I suggested before, and |
I have some code using
@cutensor
. I have some problems with importingcuTENSOR
. In my package I haveWhen I run
julia --project
and run] test
everything works correctly. If I setup a new env with an emptyProject.toml
mkdir new_env touch new_env/Project.toml cd new_env julia --project
and run
] add <path_to_package>
and after thatprecompile
I getObviously,
cuTENSOR
is not visible to the macro. This causes issues with publishing the package in the Julia registry. Am I missing something?The text was updated successfully, but these errors were encountered: