Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
| data[isrc] = (convert(T, coeff), idst, isrc) | ||
| # the pairs are transformed in chunks, such that every task has enough work | ||
| nthreads = get_num_manipulation_threads() | ||
| chunks = Iterators.partition(eachindex(data), UNIQUE_TRANSFORM_CHUNKSIZE) |
There was a problem hiding this comment.
I guess this is looping over everything 1024 elements at a time, but for abelian symmetries it's probably a fair assumption that all of the work is more or less the same, so a static scheduler that just splits in nthreads equal chunks has even less overhead and should otherwise also be load-balanced.
(With of course a cutoff for not spawning tasks for too few entries).
There was a problem hiding this comment.
I switched to the static split you suggested: the pairs are now split into one equal range per task, and the number of tasks is capped such that every task gets at least 1024 pairs, so small transformers stay serial.
There's no measurable performance difference with the chunks of 1024, but this is strictly simpler.
… tasks The pairs are split into one equal range per task, on up to get_num_manipulation_threads() tasks with taskforeach, as the fusion tree blocks of a GenericTreeTransformer already are. Every task gets at least 1024 pairs, so small transformers stay serial. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
658808c to
ee29572
Compare
GenericTreeTransformeralready computes its recoupling blocks onget_num_manipulation_threads()tasks, butUniqueTreeTransformertransforms its fusion tree pairs in a serial loop. For abelian tensors with many sectors per leg that loop is most of the cost of building a transformer, so cold index manipulations do not speed up with the manipulation threads.This splits the pairs into one equal range per task and transforms the ranges through
taskforeach, on up toget_num_manipulation_threads()tasks as in the generic case. Every pair of an abelian transformer costs about the same, so equal ranges are balanced; every task gets at least 1024 pairs, so small transformers stay serial. Each task writes its own entries ofdata, the destination trees are only read, and the caches of the fusion tree manipulations are already safe to use from several tasks. With timers enabled the construction stays serial, as forGenericTreeTransformer. The transformer data is identical for any number of tasks.Reproducer: builds the transformers of four braids of
V ⊗ V ⊗ V ← V ⊗ V ⊗ VwithVhaving one-dimensionalFermionParity ⊠ U1Irrepsectors of charges-K:K, with the braid cache emptied first (cold) or kept (cached), and checks that every thread count gives the same data.julia -t 8, 8 cores of one machine, OpenBLAS 1 thread, minimum of 3 runs, times in seconds:The machine was shared, so the serial times vary by about ±0.1 s between runs. These times were measured with fixed chunks of 1024 pairs handed out one at a time instead of one range per task; the two gave the same times within this noise when compared on one machine.
🤖 Generated with Claude Code