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

movesite crashes on gpu for number conserving fermions #102

Closed
tipfom opened this issue Dec 17, 2024 · 0 comments · Fixed by #103
Closed

movesite crashes on gpu for number conserving fermions #102

tipfom opened this issue Dec 17, 2024 · 0 comments · Fixed by #103

Comments

@tipfom
Copy link
Contributor

tipfom commented Dec 17, 2024

The function movesite and hence implementations of, e.g., apply, crash on GPU for number conserving fermionic systems. The following MWE reproduces the crash:

using CUDA
using ITensors, ITensorMPS

s = siteinds("Fermion", 20; conserve_nf=true)
dev = NDTensors.cu
psi = random_mps(s, repeat(["Occ"], length(s)))
movesite(dev(psi), 3=>5)

The error message is

ERROR: MethodError: no method matching DenseVector{Float64}(::UndefInitializer, ::Tuple{Int64})
The type `DenseVector{Float64}` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  (::Type{<:AbstractArray})(::NDTensors.AllocateData.UndefInitializer, ::Tuple)
   @ NDTensors ~/julia/alpha-centauri/.julia/packages/NDTensors/GUW1c/src/lib/AllocateData/src/initializers.jl:16
  (::Type{<:AbstractArray})(::NDTensors.NeverAlias, ::AbstractArray)
   @ ITensors ~/julia/alpha-centauri/.julia/packages/ITensors/oDm3o/src/itensor.jl:673
  (::Type{<:AbstractArray})(::NDTensors.AllowAlias, ::AbstractArray)
   @ ITensors ~/julia/alpha-centauri/.julia/packages/ITensors/oDm3o/src/itensor.jl:677

Stacktrace:
  [1] similar(arraytype::Type{DenseVector{Float64}}, dims::Tuple{Int64})
    @ NDTensors ~/julia/alpha-centauri/.julia/packages/NDTensors/GUW1c/src/abstractarray/similar.jl:19
  [2] similar(arraytype::Type{DenseVector{Float64}}, dims::Int64)
    @ NDTensors ~/julia/alpha-centauri/.julia/packages/NDTensors/GUW1c/src/abstractarray/similar.jl:24
  [3] similar(storagetype::Type{NDTensors.BlockSparse{Float64, DenseVector{Float64}, 4}}, blockoffsets::Dictionaries.Dictionary{Block{4}, Int64}, dims::NTuple{4, Index{Vector{Pair{QN, Int64}}}})
    @ NDTensors ~/julia/alpha-centauri/.julia/packages/NDTensors/GUW1c/src/blocksparse/similar.jl:5
  [4] similar(tensortype::Type{NDTensors.BlockSparseTensor{Float64, 4, NTuple{…}, NDTensors.BlockSparse{…}}}, blockoffsets::Dictionaries.Dictionary{Block{4}, Int64}, dims::NTuple{4, Index{Vector{…}}})
    @ NDTensors ~/julia/alpha-centauri/.julia/packages/NDTensors/GUW1c/src/blocksparse/similar.jl:26
  [5] contraction_output(tensor1::NDTensors.BlockSparseTensor{…}, labelstensor1::NTuple{…}, tensor2::NDTensors.BlockSparseTensor{…}, labelstensor2::NTuple{…}, labelsR::NTuple{…})
    @ NDTensors ~/julia/alpha-centauri/.julia/packages/NDTensors/GUW1c/src/blocksparse/contract.jl:39
  [6] contract(tensor1::NDTensors.BlockSparseTensor{…}, labelstensor1::NTuple{…}, tensor2::NDTensors.BlockSparseTensor{…}, labelstensor2::NTuple{…}, labelsR::NTuple{…})
    @ NDTensors ~/julia/alpha-centauri/.julia/packages/NDTensors/GUW1c/src/blocksparse/contract.jl:10
  [7] _contract(A::NDTensors.BlockSparseTensor{Float64, 4, NTuple{…}, NDTensors.BlockSparse{…}}, B::NDTensors.BlockSparseTensor{Float64, 4, NTuple{…}, NDTensors.BlockSparse{…}})
    @ ITensors ~/julia/alpha-centauri/.julia/packages/ITensors/oDm3o/src/tensor_operations/tensor_algebra.jl:3
  [8] _contract(A::ITensor, B::ITensor)
    @ ITensors ~/julia/alpha-centauri/.julia/packages/ITensors/oDm3o/src/tensor_operations/tensor_algebra.jl:9
  [9] contract(A::ITensor, B::ITensor)
    @ ITensors ~/julia/alpha-centauri/.julia/packages/ITensors/oDm3o/src/tensor_operations/tensor_algebra.jl:74
 [10] *
    @ ~/julia/alpha-centauri/.julia/packages/ITensors/oDm3o/src/tensor_operations/tensor_algebra.jl:61 [inlined]
 [11] setindex!::MPS, A::ITensor, r::UnitRange{Int64}; orthocenter::Int64, perm::Vector{Int64}, kwargs::@Kwargs{})
    @ ITensorMPS ~/julia/alpha-centauri/.julia/packages/ITensorMPS/ULTh9/src/abstractmps.jl:1878
 [12] setindex!
    @ ~/julia/alpha-centauri/.julia/packages/ITensorMPS/ULTh9/src/abstractmps.jl:1823 [inlined]
 [13] swapbondsites::MPS, b::Int64; ortho::String, kwargs::@Kwargs{})
    @ ITensorMPS ~/julia/alpha-centauri/.julia/packages/ITensorMPS/ULTh9/src/abstractmps.jl:1990
 [14] swapbondsites
    @ ~/julia/alpha-centauri/.julia/packages/ITensorMPS/ULTh9/src/abstractmps.jl:1978 [inlined]
 [15] movesite::MPS, n1n2::Pair{Int64, Int64}; orthocenter::Int64, kwargs::@Kwargs{})
    @ ITensorMPS ~/julia/alpha-centauri/.julia/packages/ITensorMPS/ULTh9/src/abstractmps.jl:2016
 [16] movesite::MPS, n1n2::Pair{Int64, Int64})
    @ ITensorMPS ~/julia/alpha-centauri/.julia/packages/ITensorMPS/ULTh9/src/abstractmps.jl:2003
 [17] top-level scope
    @ REPL[31]:1
@tipfom tipfom changed the title 'movesite' crashes on gpu for number conserving fermions movesite crashes on gpu for number conserving fermions Dec 17, 2024
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

Successfully merging a pull request may close this issue.

1 participant