Programming for Lovers in Python: Building a Reaction-Diffusion Simulator with Parallel Programming
This video is part of Programming for Lovers in Python and explores implementing a particle simulator using parallel programming. 00:00 Start screen 6:24 Welcome and Philomath updates 8:31 Project news and the AI for Science Studio 11:22 Today's plan: zooming in on reactions and diffusion 15:53 What does it take to get a parallel speedup? 23:40 Touring the starter code: datatypes.py 33:48 Drawing, plotting, and the reaction CSV 38:23 Touring main.py 39:57 Let's code: simulate_serial 54:09 Writing rand_step on a torus 57:26 Writing apply_reactions and a question for the chat 1:14:00 Writing apply_unary_reactions: deaths, conversions, births 1:27:08 Writing toroidal_distance 1:31:15 Intermission! 1:32:59 Writing simulate_parallel and the worker pool 1:38:42 Halos: seeing across the fence with pool.starmap 1:46:32 Writing assign_strips_with_halos 2:02:10 Writing process_strip and the do_reactions flag 2:13:55 Writing apply_reactions_with_halo 2:18:35 Mile 25 of the marathon: let's run the simulation 2:24:11 First run: a bug and a 0.1x speedup 2:26:32 Bigger inputs, bigger speedup 2:30:09 Lotka-Volterra: predator and prey 2:35:48 Running parallel only 2:41:20 Gause: competitive exclusion 2:47:26 SIR: epidemics and checkerboard patterns 2:49:33 The repressilator and emerging stripes 2:57:37 Rock paper scissors (and lizard Spock) 3:06:24 Looking ahead to the dark heart of computer science, and happy coding 🫶 Starter code: https://programmingforlovers.com/wp-content/uploads/reaction_diffusion_python.zip The material accompanies Chapter 6 of Programming for Lovers on "Parallel Programming in Python". It accompanies the code along shown below. [coming soon!] ⸻ 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.