130 likes | 330 Views
Hands-On Exploration of Parallelism for Absolute Beginners W ith Scratch. Third NSF/TCPP Workshop on Parallel and Distributed Computing Education (EduPar-13) May 20 th , 2013. Steven Bogaerts Department of Mathematics & Computer Science Wittenberg University Springfield, OH.
E N D
Hands-On Exploration of Parallelism for Absolute Beginners With Scratch Third NSF/TCPP Workshop on Parallel and Distributed Computing Education (EduPar-13)May 20th, 2013 • Steven Bogaerts Department of Mathematics & Computer Science • Wittenberg UniversitySpringfield, OH NSF grant CCF-0915805, SHF:Small:RUI:Collaborative Research: Accelerators to Applications – Supercharging the Undergraduate Computer Science CurriculumPIs: Eric Stahlberg, Melissa Smith, Steven Bogaerts
Outline Steven Bogaerts The context of this work Introduction to Scratch Hands-on exercises on parallelism with Scratch Outcomes
PDC at Wittenberg Steven Bogaerts • The integration effort continues… • CS1 • Key concepts, message-passing paradigm, race conditions, blocking commands, … • CS2 • Threads, divide and conquer parallelism, efficiency • Languages • Shared memory (OpenMP) and message passing (MPI) in C • Algorithms • Sequential and parallel algorithms for various tasks, asymptotic complexity • Software design • Sequential and parallel design patterns • Hardware • FPGA programming • Artificial intelligence • Parallel alpha-beta pruning, neural network training • Cybersecurity • Botnets, distributed denial of service attacks • …
Computer Literacy Steven Bogaerts • Audience • Entirely non-majors (does not count towards CS major) • Occasionally a student will move on to CS1 and perhaps a minor or major • Many students with great unease in math and computing • Three roughly 5-week (15 contact-hour) parts • Excel • Design of spreadsheets to capture relevant data and calculations to facilitate real-world decisions • Access • Database design • Queries • Keys, referential integrity • Programming • Get an introduction to what programming is…
Programming in Scratch • Not literally in parallel • Code executes concurrently, sharing a single execution thread through context switches. Steven Bogaerts • Developed at the MIT Media Lab in 2007 • In use at various institutions as a first language for both majors and non-majors, and in K-12 education • Visually-oriented, fun introduction to key programming concepts • Similar to Alice – dragging and connecting blocks, manipulating “sprites”
The Situation Steven Bogaerts • I have 15 hours of contact time to give students a first taste of programming. • To be truly “literate” in computing today requires some basic understanding of parallelism. • Most literacy courses don’t include hands-on parallel programming exercises. • Question • With no prerequisites and little time, how can I give non-majors hands-on experience in parallelism?
Illustrations of Parallel Computing with Scratch Steven Bogaerts Parallelism and communication for clean solutions Race conditions Blocking and non-blocking commands Shared and private variables
Parallelism and Communication for Clean Solutions • Option 1 • Option 2 Boy Ball Boy Ball ? ? • Complex relationship of values • Simple relationship of values The world is naturally parallel Let parallelism arise naturally as the best solution Task: Animation of a boy walking and dribbling a ball
Race Conditions Ball First? Later? Paddle Later? Later? • Arbitrary interleaving – some blocks may immediately end execution! • Exercises • Determine interleaving through observation • Fix code through waits or blocking until receipt of a signal Steven Bogaerts Parallelism also brings added challenges Not truly parallel, so actually this is unexpected program behavior occurring due to the arbitrary interleaving of concurrent code
Blocking and Non-Blocking Commands • A sample broadcast exercise: Sender Recipient Blocking Non-Blocking Steven Bogaerts
Shared and Private Variables Q W E R A S D F • Private variable • Each mole’s state (up or down) • Shared variables • Score counter • Game difficulty parameters Steven Bogaerts Whack-A-Mole
Outcomes Steven Bogaerts Material was very easy to integrate into the class in a level-appropriate manner. Strong performance (mostly A’s and B’s) on parallelism assignments and exam questions. General parallelism discussions - students report very good understanding (4.0 / 5.0) and enjoyment (4.0 / 5.0). Parallelism in Scratch – students report high understanding (4.7 / 5.0) and enjoyment (4.4 / 5.0).
Summary Steven Bogaerts • Context • A very short time in a literacy course • Maybe at the start of CS1 • Hands-on exploration of parallelism with Scratch • Parallelism and communication for clean solutions • Race conditions • Blocking and non-blocking commands • Shared and private variables • Outcomes – successful integration in literacy course