Thanks to everyone for their contributions and participation tonight! We went over Chapter 3, got through the sequential section on K-means, but didn't get into parallelizing it yet.
I took us on a bit of a detour because I questioned the point of something in the book. Specifically where he defines
rdeepseq x = rseq (force x)
and then defines
parPair sa sb = evalPair (rparWith sa) (rparWith sb)
and then calls
parPair rdeepseq rdeepseq
I thought, why are we wrapping the force with rseq, instead of rpar, only to later add the parallelism? So we tried an experiment in the meeting. We defined
rdeeppar x = rpar (force x)
and then instead of calling parPair, we wrote
evalPair rdeeppar rdeeppar
This seemed to produce the same results - even the threadscope output looked the same.
It turns out that rseq doesn't really do anything. It doesn't create a spark, whereas rpar does. So wrapping an rseq around the (force x) is just so that we get a strategy. Then you can always decide later that you want to run it in parallel, by wrapping rparWith around your strategy. So, rparWith rseq is the same as rpar.
We'll follow up with the rest of Chapter 3 next time, on September 3rd.
- Lyle