NumPy allowed · plain Python earns 10 bonus points
Implement parallel binary tree sum reduction, the core reduction pattern executed by GPU workgroups and CUDA kernels.
Implement parallel_sum_reduction(arr). Simulate hierarchical pairwise reduction: at stride s = 1, 2, 4..., add elements pair-by-pair until a single scalar sum remains. Return 0.0 if empty.
parallel_sum_reduction(arr: list[float]) -> float