That is great to know - I appreciate you telling me as I was in the process of troubleshooting the setup of ITensorsGPU on our cluster. I doubt its worth it now that I know it will be deprecated.
I just tried the ITensorsGPU dmrg example here. I modified the example just slightly, changing
using ITensors
using ITensorGPU
to
using CUDA, ITensors
Its giving me the following error. Would appreciate any insights you have on this. I believe CUDA is set up correctly - I did that first prior to running the script (made sure the CUDA runtime matches the version of CUDA I have loaded (11.8)).
ERROR: LoadError: Scalar indexing is disallowed.
Invocation of getindex resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore are only permitted from the REPL for prototyping purposes.
If you did intend to index this array, annotate the caller with @allowscalar.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] assertscalar(op::String)
@ GPUArraysCore ~/.julia/packages/GPUArraysCore/uOYfN/src/GPUArraysCore.jl:103
[3] getindex(xs::CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, I::Int64)
@ GPUArrays ~/.julia/packages/GPUArrays/EZkix/src/host/indexing.jl:9
[4] getindex
@ ~/.julia/packages/StridedViews/bIjcq/src/stridedview.jl:97 [inlined]
[5] macro expansion
@ ~/.julia/packages/Strided/l1vm3/src/mapreduce.jl:330 [inlined]
[6] macro expansion
@ ./simdloop.jl:77 [inlined]
[7] macro expansion
@ ~/.julia/packages/Strided/l1vm3/src/mapreduce.jl:329 [inlined]
[8] _mapreduce_kernel!(f::Strided.CaptureArgs{NDTensors.var"#69#70", Tuple{Strided.Arg, Strided.Arg}}, op::Nothing, initop::Nothing, dims::Tuple{Int64, Int64, Int64}, blocks::Tuple{Int64, Int64, Int64}, arrays::Tuple{StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}, StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}, StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}}, strides::Tuple{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}}, offsets::Tuple{Int64, Int64, Int64})
@ Strided ~/.julia/packages/Strided/l1vm3/src/mapreduce.jl:229
[9] _mapreduce_block!(f::Any, op::Any, initop::Any, dims::Tuple{Int64, Int64, Int64}, strides::Tuple{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}}, offsets::Tuple{Int64, Int64, Int64}, costs::Tuple{Int64, Int64, Int64}, arrays::Tuple{StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}, StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}, StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}})
@ Strided ~/.julia/packages/Strided/l1vm3/src/mapreduce.jl:152
[10] _mapreduce_order!(f::Any, op::Any, initop::Any, dims::Tuple{Int64, Int64, Int64}, strides::Tuple{Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}, Tuple{Int64, Int64, Int64}}, arrays::Tuple{StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}, StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}, StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}})
@ Strided ~/.julia/packages/Strided/l1vm3/src/mapreduce.jl:138
[11] _mapreduce_fuse!(f::Any, op::Any, initop::Any, dims::Tuple{Int64, Int64, Int64}, arrays::Tuple{StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}, StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}, StridedViews.StridedView{Float32, 3, CuArray{Float32, 3, CUDA.Mem.DeviceBuffer}, typeof(identity)}})
@ Strided ~/.julia/packages/Strided/l1vm3/src/mapreduce.jl:116
[12] copyto!
@ ~/.julia/packages/Strided/l1vm3/src/broadcast.jl:35 [inlined]
[13] materialize!
@ ./broadcast.jl:884 [inlined]
[14] materialize!
@ ./broadcast.jl:881 [inlined]
[15] permutedims!(R::NDTensors.DenseTensor{Float32, 3, Tuple{Index{Int64}, Index{Int64}, Index{Int64}}, NDTensors.Dense{Float32, CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}}, T::NDTensors.DenseTensor{Float32, 3, Tuple{Index{Int64}, Index{Int64}, Index{Int64}}, NDTensors.Dense{Float32, CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}}, perm::Tuple{Int64, Int64, Int64}, f::NDTensors.var"#69#70")
@ NDTensors ~/.julia/packages/NDTensors/pUJ6b/src/dense/densetensor.jl:246
[16] permutedims!!
@ ~/.julia/packages/NDTensors/pUJ6b/src/dense/densetensor.jl:188 [inlined]
[17] permutedims!!
@ ~/.julia/packages/NDTensors/pUJ6b/src/dense/densetensor.jl:186 [inlined]
[18] permutedims(tensor::NDTensors.DenseTensor{Float32, 3, Tuple{Index{Int64}, Index{Int64}, Index{Int64}}, NDTensors.Dense{Float32, CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}}, perm::Tuple{Int64, Int64, Int64})
@ NDTensors ~/.julia/packages/NDTensors/pUJ6b/src/tensoralgebra/generic_tensor_operations.jl:5
[19] permutedims
@ ~/.julia/packages/ITensors/yZbTa/src/tensor_operations/permutations.jl:64 [inlined]
[20] _permute(as::NDTensors.NeverAlias, T::NDTensors.DenseTensor{Float32, 3, Tuple{Index{Int64}, Index{Int64}, Index{Int64}}, NDTensors.Dense{Float32, CuArray{Float32, 1, CUDA.Mem.DeviceBuffer}}}, new_inds::Tuple{Index{Int64}, Index{Int64}, Index{Int64}})
@ ITensors ~/.julia/packages/ITensors/yZbTa/src/tensor_operations/permutations.jl:69
[21] permute(as::NDTensors.NeverAlias, T::ITensor, new_inds::Tuple{Index{Int64}, Index{Int64}, Index{Int64}})
@ ITensors ~/.julia/packages/ITensors/yZbTa/src/tensor_operations/permutations.jl:73
[22] #permute#271
@ ~/.julia/packages/ITensors/yZbTa/src/tensor_operations/permutations.jl:54 [inlined]
[23] permute(T::ITensor, new_inds::Tuple{Index{Int64}, Index{Int64}, Index{Int64}})
@ ITensors ~/.julia/packages/ITensors/yZbTa/src/tensor_operations/permutations.jl:38
[24] permute(M::MPO, #unused#::Tuple{typeof(linkind), typeof(siteinds), typeof(linkind)})
@ ITensors ~/.julia/packages/ITensors/yZbTa/src/mps/dmrg.jl:14
[25] #dmrg#1052
@ ~/.julia/packages/ITensors/yZbTa/src/mps/dmrg.jl:25 [inlined]
[26] dmrg(H::MPO, psi0::MPS, sweeps::Sweeps)
@ ITensors ~/.julia/packages/ITensors/yZbTa/src/mps/dmrg.jl:20
[27] top-level scope
@ ./timing.jl:273 [inlined]
[28] top-level scope
@ ~/projects/dmrg_gpu_test2/DMRG_GPU.jl:0
in expression starting at /home/projects/dmrg_gpu_test2/DMRG_GPU.jl:25