I will try and add/share some examples from the physics world. (I work at Fermilab ;-)
7321:24028
Share
Simple Monte Carlo simulations can be very appropriate assignments for CS1/CS2 (for-loops, conditionals, rand() and maybe 1D arrays). They also can be embarrassingly parallel, making them a class of algorithms that are quite easy to convert from their original sequential solutions to corresponding parallel or distributed solutions that run much faster. The videos linked below are designed for viewing by instructors and show how to use OpenMP to parallelize three 'typical' CS1/CS2 student solutions. They then give descriptions of three additional assignments for instructors to try with their students.
The written module material linked below is designed for students to use in a class or lab setting. It introduces these type of algorithms, providing some examples with C++ code for both the original sequential version and the parallelized OpenMP version.
Languages Supported: , , C++, C,
Relevant Parallel Computing Concepts: , Task Parallelism, , Shared Memory,
Recommended Teaching Level: Introductory, ,
Possible Course Use: Introduction to Computer Science, , , , ,
One set of videos focuses on how to set up Microsoft Visual Studio.NET to use Intel's Parallel Advisor XE. Videos describing the projects using these tools are at:
David Valentine's Monte Carlo OpenMP/Visual Studio/Parallel Advisor video examples for instructorsThe videos solve 4 Monte Carlo simulations (coin-flip, roulette wheel, Plinko Game and Texas Hold'em hands. Then the viewer is given three Monte Carlo simulations to do on their own.
A second set of videos emphasizes the use of OpenMP to teach these Monte Carlo examples. If you are not using the Parallel Advisor tool with Visual Studio or are using linux machines to teach C++, these videos will explain the addition of OpenMP directives to existing sequential solutions and how you can demonstrate these in an introductory course. This set of videos can be found here:
David Valentine's Monte Carlo OpenMP video examples for instructors
We have written materials for students to read and then activities for them to try in a lab setting.
You can visit the module in your browser:
Monte Carlo Simulation Exemplar
or you can download the module in either PDF format or latex format.
PDF Format: Monte CarloSimulationExemplar.pdf.
Latex Format: MonteCarloSimulationExemplar latex.tar.gz.
Word Formats:
The template for these solutions is:
(1) Give a Monte Carlo simulation assignment in the introductory course. Students will generate a conventional, serial solution.
(2) Grade & return that assignment in the normal way.
(3) Towards the end of the course, cycle back to their already-working serial assignment, and just show them the OpenMP pragma to parallelyze the primary work horse loop. Compare run times and show them the system monitor CPU usage for the two solutions.
7321:24028
Share