Making Parallelism 'Nifty'

I am very proud to be one of the first Intel Academic Microgrant for Parallelism recipients. I thought others might enjoy hearing how one old dog is trying to learn some new tricks. Here is the story of "Making Parallelism 'Nifty'".

Getting Started with Parallelism

At SIGCSE 2009 in Chattanooga I attended an Intel presentation on Parallel Computing. The Intel representative, Michael Wrinn, said to the group, “Intel is not going back to a single core processor. The world has gone parallel and you better start teaching it!” He then wagged his finger at the group (which he never should have done). As I recall the faculty appropriately rose up as a unit and verbally beat him about the head and shoulders for being so disrespectful. But I left the session thinking “He’s absolutely right.”

That summer I enrolled in the National Computational Science Institute (NCSI) workshop on “Parallel Programming and Cluster Computing” at the University of Oklahoma and thoroughly enjoyed myself. You should check out for this year's workshops. They are a great opportunity to learn a great deal in a little time.

That fall I introduced “Parallel Fridays” into my Computer Architecture class, where every Friday we broke off what we were doing and explored open-MP, MPI and some CUDA. Student teams reconfigured our lab into four separate clusters with the Bootable Cluster CD (BCCD). It was a fantastic experience. I am very proud of the fact that in each of the last two years, student teams from Architecture have been able to publish their research results in parallel computing. The fact that the venerable Patterson & Hennessy COD textbook adds parallel topics now in every chapter was a great help.

The 'Ahah!' Moment

At SIGCSE 2011 in Dallas I thoroughly enjoyed the Intel presentation on the Manycore Testbed platform. The presentation was given as a "detective story" motif based on a real problem Intel faced as they converted an embarrassingly parallel ray-tracing application to a open-MP implementation. The Windows implementation ran as expected, while the Linux version actually ran slower- not the best recommendation for using parallel tools! Working with the Intel Parallel Suite tools, the offending bit of code (a state-based random number generator in a Linux library) was quickly identified and replaced.

A session I always try to attend at SIGCSE is Nick Parlante's "Nifty Assignments" (Nifty). These are always brilliant, engaging programming assignments usually aimed at the CS1/CS2 level. They are delightful, and this year was no exception. Our educational community has some very creative (and seemingly over-caffeinated) colleagues who come up with amazing ways to engage students in the problem solving enterprise which is programming.

Finally, Intel announced the Microgrant program at SIGCSE 2011 to encourage folks to develop curricular materials bringing parallelism into the undergraduate classroom. On the flight home the thought hit me: take the Nifty assignments and run them through the Intel Suite of tools and "make parallelism 'nifty'". I would do what Intel modeled in their presentation, using 6 of the most brilliant and engaging programming assignments the SIGCSE community could find. That should result in some very engaging parallel curricular materials.

Work of the Community

Upon hearing of the award, I immediately contacted the 6 authors of this year's Nifty Assignments, explaining what I wanted to do and asking their permission to adapt their work in this way. Their response was immediate and very encouraging. The SIGCSE community really does behave as a collegial, cooperative community of scholars. The only stipulation given me was to not allow complete source code to find its way to the Web. These assignments are still being used in the classrooms, and students should not be able to Google complete solutions. That seems exactly right to me.

This summer I plan to work my way through these 6 Nifty assignments showing how parallelism can be easily added to the correct (linear) solution. In my own CS2 class in the fall I hope to give at least one of the Nifties early in the term. Then later in the semester as I introduce the idea of parallelism the students can revisit their already working solutions and see where the open-MP constructs can let them take advantage of the quad cores already on their desktop. In my senior level Architecture course, we plan to take a Nifty and expand it onto the Intel Manycore testbed to explore scalability and other issues.

My hope is to have some appropriate videos and notes showing the conversion in both Windows and Linux environments. Intel has agreed to post the results on their site, and I hope they will encourage our community to bring parallelism to the undergraduate classroom.

Parallelism in CS1 and CS2?

I think this is our easiest approach to getting undergraduates to think parallel. We work in small, engaging assignments early on, and build them throughout the curriculum. Then in a capstone-like course dealing with parallel architecture they can stand up and see the whole topic. I know of colleagues (like Joel Adams at Calvin College) who are successfully implementing such a model.

Open-MP allows us to "grab the low-hanging fruit" in existing programs. As soon as students see nested for-loops, they should be considering if they can bring multi-cores to bear on the solution. I have found a very effective evangelistic tool here: the simple Systems Monitor. I will run some number-crunching program (numerical integration or Monte Carlo simulation) that takes a good solid minute or more to complete linearly. The System Monitor usually shows one of the four cores doing most of the work. Then run the same code with just a few open-MP constructs and all four cores max to 100% and the run time is about 1/4 of the linear time. When students see those four cores "red-lining" they demand to know how to do that. The battle is already won.

Summing Up

I have to agree way back with Michael Wrinn's finger wagging that started me on this whole venture: the world has gone parallel and we have to start teaching that way. I like this small, incremental model housed in our existing curriculum. What are some other ideas in the community?

Pour de plus amples informations sur les optimisations de compilation, consultez notre Avertissement concernant les optimisations.