Skip to content

Commit 7703e4b

Browse files
committed
Bugfix non-abelian add_transform!
Original version had a typo only affecting non-abelian groups with more than 1 threads Threads were not being used anyways so disabled them and added TODO to fix this
1 parent 29d4ef7 commit 7703e4b

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

src/tensors/indexmanipulations.jl

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,18 +326,32 @@ function _add_general_kernel!(tdst, tsrc, p, fusiontreetransform, α, β, backen
326326
elseif β != 1
327327
tdst = scale!(tdst, β)
328328
end
329-
if Threads.nthreads() > 1
330-
Threads.@sync for s₁ in sectors(codomain(tsrc)), s₂ in sectors(domain(tsrc))
331-
_add_sector!(tdst, tsrc, fusiontreemap, s₁, s₂, α, β, backend...)
332-
end
333-
else
334-
for (f₁, f₂) in fusiontrees(tsrc)
335-
for ((f₁′, f₂′), coeff) in fusiontreetransform(f₁, f₂)
336-
TO.tensoradd!(tdst[f₁′, f₂′], p, tsrc[f₁, f₂], :N, α * coeff, true,
337-
backend...)
338-
end
329+
330+
# TODO: implement multithreading for general symmetries
331+
# Currently disable multithreading for general symmetries, requires more testing and
332+
# possibly a different approach. Ideally, we'd loop over output blocks in parallel, to
333+
# avoid parallel writing, but this requires the inverse of the fusiontreetransform.
334+
335+
for (f₁, f₂) in fusiontrees(tsrc)
336+
for ((f₁′, f₂′), coeff) in fusiontreetransform(f₁, f₂)
337+
TO.tensoradd!(tdst[f₁′, f₂′], p, tsrc[f₁, f₂], :N, α * coeff, true,
338+
backend...)
339339
end
340340
end
341+
342+
# if Threads.nthreads() > 1
343+
# Threads.@sync for s₁ in sectors(codomain(tsrc)), s₂ in sectors(domain(tsrc))
344+
# _add_sectors!(tdst, tsrc, fusiontreemap, s₁, s₂, α, β, backend...)
345+
# end
346+
# else
347+
# for (f₁, f₂) in fusiontrees(tsrc)
348+
# for ((f₁′, f₂′), coeff) in fusiontreetransform(f₁, f₂)
349+
# TO.tensoradd!(tdst[f₁′, f₂′], p, tsrc[f₁, f₂], :N, α * coeff, true,
350+
# backend...)
351+
# end
352+
# end
353+
# end
354+
341355
return nothing
342356
end
343357

0 commit comments

Comments
 (0)