Rs
Module 7Performance LabLesson 7 of 722 min

Module 6 Lab: Parallel Chunk Sum

Channel-based parallel reduction lab.

Lab

Split 0..10_000 into chunks, sum squares in threads, reduce via channel.

Print total and compare to sequential.

Challenge

Vary worker count and reason about overhead for tiny n.

Tips
  • Same pattern as MC reductions
  • drop tx before iter
  • Match sequential for correctness

Try it live

Module 6 Lab: Parallel Chunk SumRust 2021
Loading editor…
Output
Press Run to compile and execute.