Skip to content

Commit

Permalink
Prepare for paralelization. Let's run tests first.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gertian committed Oct 27, 2024
1 parent 61412f6 commit e31945e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/algorithms/grassmann.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ struct ManifoldPoint{T,E,G,C}
end

function ManifoldPoint(state::Union{InfiniteMPS,FiniteMPS}, envs)
g = Vector{ Grassmann.GrassmannTangent }(undef, length(state.AL))
@static if Defaults.parallelize_sites
@sync for i in 1:length(state)
Threads.@spawn begin
al_d_i = MPSKit.∂∂AC(i, state, envs.opp, envs) * state.AC[i]
g[i] = Grassmann.project(al_d_i, state.AL[i])
end
end
g = map(CartesianIndices(state.AL)) do I
return Grassmann.project(al_d[I], state.AL[I])
end
else
al_d = similar(state.AL)
for i in 1:length(state)
Expand All @@ -103,8 +105,8 @@ function ManifoldPoint(state::Union{InfiniteMPS,FiniteMPS}, envs)
end

function ManifoldPoint(state::MPSMultiline, envs)
#TODO : support parralelize_sites
# FIXME: add support for unitcells
# TODO : then support parralelize_sites
@assert length(state.AL) == 1 "GradientGrassmann only supports MPSMultiline without unitcells for now"

# TODO: this really should not use the operator from the environment
Expand Down

0 comments on commit e31945e

Please sign in to comment.