Programming for Lovers in Python: Parallel Programming Part 2
This video is part of Programming for Lovers in Python and continues to explores parallel programming in Python. 00:00 Start screen 6:57 Welcome and Philomath updates 11:11 Coming back to summing a list 15:17 Today's plan: a Monte Carlo simulation we can speed up 21:47 Let's code: parallel craps 22:48 Touring the serial craps code 26:23 Writing compute_craps_house_edge_parallel 39:50 What about leftover trials? 46:51 Writing total_win_one_proc 50:27 Sanity check and timing comparison 55:46 The serial version wins (at first) 57:12 Bigger inputs, bigger speedup 1:03:08 Touring the diffusion starter code 1:08:36 Writing simulate_serial 1:13:59 update_particles on a torus 1:18:33 rand_step: a little trigonometry 1:22:25 The naive parallel approach (and why it's a disaster) 1:32:14 Switching to multiprocessing.Pool and starmap 1:49:30 Writing assign_stripes 1:55:44 Running parallel diffusion: do we get a speedup? 1:58:54 Below 1x speedup; what should we change? 2:11:02 Looking ahead to chemical reactions, and happy coding 🫶 The material accompanies Chapter 6 of Programming for Lovers on "Parallel Programming in Python". 🎲 Parallel craps simulator starter code → https://programmingforlovers.com/wp-content/uploads/parallel_craps_python.zip 🫧 Single-particle diffusion starter code → https://programmingforlovers.com/wp-content/uploads/diffusion_python.zip ⸻ About Programming for Lovers Programming for Lovers is an open online course where you write code to answer real scientific questions, built on award-winning teaching from Phillip Compeau, Professor at Carnegie Mellon University. ▶ Sign up for the mailing list to receive course materials, reminders, and earn a certificate: http://eepurl.com/iC9DSg ▶ Free course materials and companion resources: https://programmingforlovers.com ▶ Practice problems and autograded exercises for this code-along: https://cogniterra.org/course/766/promo ▶ Join the Philomath community on Discord: https://discord.gg/n5ZKySCKU4 ⸻ Philomath Membership All lectures and recordings are free and open. If you’d like to participate more deeply—through office hours, bonus sessions, and community support—you can become a Philomath member here: https://philomath.memberful.com Membership supports the instructors and helps keep Philomath open.
Download
0 formatsNo download links available.