| *[Home|COMP322]* | *[Owlspace Course Site - Section 1|https://owlspace-ccm.rice.edu/portal/site/COMP-322-ELEC-323-A01-Sp11]* | *[Owlspace Course Site - Section 2|https://owlspace-ccm.rice.edu/portal/site/COMP-322-ELEC-323-A02-Sp11]* | *[Office Hours|322OfficeHours]* | *[Turnin Guide|322TurninGuide]* | *[HJ Release|322Resources]* |

h1. COMP 322: Fundamentals of Parallel Programming

|| Instructor: | [Prof. Vivek Sarkar|http://www.cs.rice.edu/~vsarkar] || Staff: | [Sanjay Chatterjee|http://www.cs.rice.edu/~cs20] (DH 2068) ||
|| | Please send all emails to comp322-staff {at} rice.edu || | [Raghavan Raman|http://www.cs.rice.edu/~rr5] ||
|| | || | Christopher Nunu ||
|| | || | Max Grossman ||
|| Lectures: | Duncan Hall (DH) 1042 || Time: | MWF 1:00-01:50pm ||
|| Labs: | Ryon 102 || Times: | Tuesday 2:30-3:50pm (Sec 1), Wednesday 3:30-4:50pm (Sec 2) ||

h2. Introduction

The goal of COMP 322 is to introduce you to the fundamentals of parallel programming and parallel algorithms, using a pedagogical approach that exposes you to the intellectual challenges in parallel software without enmeshing you in low-level details of different parallel systems.  To that end, the main pre-requisite course requirement is COMP 211 or equivalent.  This course should be accessible to anyone familiar with the foundations of sequential algorithms and data structures, and with basic Java programming.  COMP 221 is also recommended as a co-requisite.

The pedagogical approach will introduce you to the following foundations of parallel programming:

* Primitive constructs for task creation & termination, collective & point-to-point synchronization, task and data distribution, and data parallelism
* Abstract models of parallel computees and computation graphs
* Parallel algorithms and data structures including lists, strings, trees, graphs, matrices
* Common parallel programming patterns including task parallelism, undirected and directed synchronization, data parallelism, divide-and-conquer parallelism, map-reduce, concurrent event processing including graphical user interfaces. 

Laboratory assignments will explore these topics through a simple parallel extension to the Java language called [Habanero-Java|http://habanero.rice.edu/hj] (HJ), developed in the [Habanero Multicore Software Research project|http://habanero.rice.edu] at Rice University.  The use of Java will be confined to a subset of the language that should also be accessible to C programmers \--\- no advanced Java features will be used.  An abstract performance model for HJ programs will be available to aid you in complexity analysis of parallel programs before you embark on performance evaluations on real parallel machines.  We will conclude the course by introducing you to some real-world parallel programming models including the Java Concurrency Utilities, CUDA and Google's MapReduce.  The foundations gained in this course will prepare you for advanced courses on Parallel Computing offered at Rice (COMP 422, COMP 522). 
 
Since the aim of the course is for you to gain both theoretical and practical knowledge of the foundations of parallel programming, the weightage for course work will be balanced across four written assignments,  three programming assignments, and two exams.

h2. {color:#003366}{*}Textbooks{*}{color}

There are no required textbooks for the class. You will be expected to read each lecture handout before coming to the lecture.  We will provide a number of online references in the lecture slides as well.

However, there are two optional textbooks that we will draw from quite heavily.  You are encouraged to get copies of either or both books as useful references during and after this course:

* [Java Concurrency in Practice|http://jcip.net/] {color:#515151}by Brian Goetz with Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes and Doug Lea{color}
* [Principles of Parallel Programming|http://www.pearsonhighered.com/educator/academic/product/0,3110,0321487907,00.html] by Calvin Lin & Lawrence Snyder

{color:#003366}{*}Lecture Schedule{*}{color}


|| || *Day* || *Date(2009)* || *Topic* || *Handouts* || *Slides* || *Homework Assigned* || *Homework Due* ||
|| 1 | Mon | Jan 10 | Lecture 1: The What and Why of Parallel Programming | [lec1-handout|https://svn.rice.edu/r/comp322/course/comp322-s11-lec1.pdf] | | HW1 (Written Assignment) | ||
|| 2 | Wed | Jan 12 | Lecture 2: Task Creation & Termination using Async & Finish | | | | ||
|| 3 | Fri | Jan 14 | Lecture 3: Computation Graphs, Abstract Performance Metrics | | | HW2 (Written Assignment) | HW1 ||
|| \- | Mon | Jan 17 | School Holiday | | | | ||
|| 4 | Wed | Jan 19 | Lecture 4: Futures \--\- Tasks with Return Values | | | | ||
|| 5 | Fri | Jan 21 | Lecture 5: Parallel Array Sum, Parallel Quicksort | | | HW3 (Programming Assignment) | HW2 ||
|| 6 | Mon | Jan 24 | Lecture 6: Data Races and How to Avoid Them | | | | ||
|| 7 | Wed | Jan 26 | Lecture 7: Parallel Prefix Sum | | | | ||
|| 8 | Fri | Jan 28 | Lecture 8: Scheduling Theory, Amdahl's Law | | | | ||
|| 9 | Mon | Jan 31 | Lecture 9: Forall parallel loops, Data parallelism | | | | ||
|| 10 | Wed | Feb 02 | Lecture 10: Parallel algorithms using forall | | | | ||
|| 11 | Fri | Feb 04 | Lecture 11: Critical sections and the Isolated statements | | | HW4 (Written Assignment) | HW3 ||
|| 12 | Mon | Feb 07 | Lecture 12: Java Atomic Variables | | | | ||
|| 13 | Wed | Feb 09 | Lecture 13: Guest Lecture (John Mellor-Crummey) | | | | ||
|| 14 | Fri | Feb 11 | Lecture 14: Guest Lecture (John Mellor-Crummey) \\ | | | | ||
|| 15 | Mon | Feb 14 | Lecture 15: Barrier Synchronization (Phasers I) | | | | ||
|| 16 | Wed | Feb 16 | Lecture 16: Split-phase Barriers (Phasers II) | | | | ||
|| 17 | Fri | Feb 18 | Lecture 17: Point-to-point Synchronization (Phasers III) | | | | HW4 ||
|| 18 | Mon | Feb 21 | Lecture 18: Successive Over Relaxation case study | | | | ||
|| 19 | Wed | Feb 23 | Lecture 19: Midterm Summary | | | Midterm Exam (Take-home) | ||
|| 20 | Fri | Feb 25 | No lecture, Exam1 due today | | | HW5 (Written Assignment) | Midterm Exam (Take-home) ||
|| \- | M-F | Feb 28 - Mar 04 | Spring Break | | | | ||
|| 21 | Mon | Mar 07 | Lecture 20: Map Reduce | | | | ||
|| 22 | Wed | Mar 09 | Lecture 21: Generalized Scan | | | | ||
|| 23 | Fri | Mar 11 | Lecture 22: Task Affinity with Places | | | HW6 (Programming Assignment) | HW5 ||
|| 24 | Mon | Mar 14 | Lecture 23: Task Affinity with Places, contd. | | | | ||
|| 25 | Wed | Mar 16 | Lecture 24: Bounded Buffers | | | | ||
|| 26 | Fri | Mar 18 | Lecture 25: Java Concurrent Collections | | | | ||
|| 27 | Mon | Mar 21 | Lecture 26: Data Flow Programming | | | | ||
|| 28 | Wed | Mar 23 | Lecture 27: Data Flow Programming, contd \\ | | | | ||
|| \- | Fri | Mar 25 | Midterm Recess | | | | ||
|| 29 | Mon | Mar 28 | Lecture 28: Java Threads \\ | | | | ||
|| 30 | Wed | Mar 30 | Lecture 29: GUI Applications \\ | | | | ||
|| 31 | Fri | Apr 01 | Lecture 30: Java Executors \\ | | | HW7 (Programming Assignment) | HW6 ||
|| 32 | Mon | Apr 04 | Lecture 31: Java Locks & Conditions \\ | | | | ||
|| 33 | Wed | Apr 06 | Lecture 32: Java Synchronizers \\ | | | | ||
|| 34 | Fri | Apr 08 | Lecture 33: Deadlock, Livelock, Liveness | | | | ||
|| 35 | Mon | Apr 11 | Lecture 34: Java Memory Model and Volatile Variables \\ | | | | ||
|| 36 | Wed | Apr 13 | Lecture 35: GPGU programming with CUDA | | | | ||
|| 37 | Fri | Apr 15 | Lecture 36: CUDA contd. | | | | ||
|| 38 | Mon | Apr 18 | Lecture 37: Distributed-memory programming with MPI | | | | ||
|| 39 | Wed | Apr 20 | Lecture 38: MPI contd. | | | | ||
|| 40 | Fri | Apr 22 | Lecture 39: Course Summary | | | | HW7 ||


h2. Grading, Honor Code Policy, Processes and Procedures


{color:#000000}Grading will be based on your performance on homeworks (worth 50%) and exams (20% for first exam, and 30% for the second exam).{color}

{color:#000000}The purpose of the homeworks is to train you to solve problems and to help deepen your understanding of concepts introduced in class. Homeworks and programming assignments are due on the dates and times specified in the course schedule. Please turn in all your homeworks using the CLEAR turn-in system. Homework is worth full credit when turned in on time. A 10% penalty per day will be levied on late homeworks, up to a maximum of 6 days. No submissions will be accepted more than 6 days after the due date.{color}

{color:#000000}You will be expected to follow the Honor Code in all homeworks and exams.  All submitted homeworks are expected to be the result of your individual effort. You are free to discuss course material and approaches to problems with your other classmates, the teaching assistants and the professor, but you should never misrepresent someone else’s work as your own. If you use any material from external sources, you must provide proper attribution.  Take-home exams, which are pledged under the Honor Code, test your individual understanding and knowledge of the material. Collaboration on exams is strictly forbidden.  Finally, it is also your responsibility to protect your homeworks and exams from unauthorized access. {color}

The work you submit for this class is expected to be the result of your own work and that of your homework partner. You are free to discuss course material and approaches to problems with your other classmates, the teaching assistants and the professor, but you should never misrepresent someone else’s work as your own. If you use any material from online sources, you must provide proper attribution (as shown here) in your homework/programming assignment turnins. A tutorial on how and when to cite sources is here. You should explain what value you have added to work taken from online sources. Finally, it is also your responsibility to protect your work from unauthorized access. I will expect you to follow the Honor Code in this course.
{color:#000000}Graded homeworks will be returned to you via email, and exams as marked-up hardcopies. If you believe we have made an error in grading your homework or exam, please bring the matter to our attention within one week.{color}

{color:#003366}{*}Accommodations for Students with Special Needs{*}{color}

Students with disabilities are encouraged to contact me during the first two weeks of class regarding any special needs. Students with disabilities should also contact Disabled Student Services in the [Ley Student Center|http://www.rice.edu/projects/lsc/] and the [Rice Disability Support Services|http://dacnet.rice.edu/~dss/].