Software Engineering for Scientific Computing
COMPSCI 194-73 (CCN 27274) / COMPSCI 294-73 (CCN 27241) 

Instructor:

Phil Colella 
643 Soda Hall / 50A-1121 LBNL

colella at cs.berkeley.edu


Class Location: 306 Soda Hall (HP Auditorium)

Class Time: TuTh 11:00-12:30

Office Hours:  TuTh 1:30-3:00, or by appointment.


Teaching Assistants

Brian Van Straalen

643 Soda Hall

Office Hours: Friday 10:30-12:00

cs294.73.brian at gmail.com



Kevin Wang

350 Hearst Mining

Office Hours: Mon & Wed 3:30-5:00

kevinwang at berkeley.edu



   



Fall 2011

1 Introduction

This course is intended for non-CS graduate students (CS294) or advanced undergraduates (CS194) interested in high performance computing and scientific simulation. The focus will be on skills and tools that cross most disciplines, and how they are applied towards larger software development goals. The course will be taught in the context of several dominant algorithmic motifs found in scientific computing: dense and sparse linear algebra, structured and unstructured grid methods, N-body problems, FFT. The course will be taught using C++, although no prior experience with the language will be assumed. Specific topics will include:


2 Course Structure

2.1 Format

2 lectures a week, 80 min. per lecture.

2.2 Prerequisites and Restrictions

To enroll in CS 294, a first-year graduate course in the sciences or engineering covering an area in which simulation is commonly used and at least one of the motifs listed above arises (can be taken concurrently). To enroll in CS 194, the students will have had to have taken an advanced undergraduate course in an an area in which simulation is commonly used and at least one of the motifs listed above arises. Some experience with computing applied to science (e.g E77 level); or the consent of the instructor. 

2.3 Grading

There will be 6 homework assignments, adding up to 45% of the final grade. Class participation and attendance is 10%. The final project is worth 45% of the grade. There might also be an optional bonus homework for 10%. 

Homework is to be submitted through the revision control system. Outside class work should comprise about 5 hours a week during the early course time, and up to 10 hours a week in the final month of class project time. It is hoped that the class project forms a suitable foundation for the students develop complicated thesis software modeling efforts. For CS 194, the students will be provided with a framework for implementing  common final project. For CS 294, the students will be required to develop a final project coming from their own discipline, in consultation with the instructor; organization into teams of 2-3 students will be permitted. 


3 Reading List and Resources

3a  Getting your work environment ready

A laptop is recommended, as that will let you bring your problems and your computer to the professor and TA office hours and get direct help on your own machine.   The next best is your own workstation.  Third place is access to a UNIX style account.

Neither the professor nor the TAs know anything about Microsoft Windows. We're sorry.  For what it is worth, nobody that does scientific computing professionally that we are aware of is using a Windows operating system for their work.  Also, all supercomputers and large scale computing facilities run UNIX style operating systems.  So, consider this your head start.   For the Windows users in the class we STRONGLY recommend you put a Linux distribtuion on your machine.  There are three main choices facing you at this time

Set your computer up to be a dual boot machine.  In day past this was a horrifyingly tedious process, but Ubuntu has made it quite natural.  Just go to www.ubuntu.com/download/ubuntu/windows-installer. This does mean you have to reboot your computer when switching to your linux world and your Windows world.  This is the most reliable operation mode however, as you boot into a real honest-to-gosh linux OS.
Set yourself up to run Ubuntu as an application inside Windows with www.andlinux.org.  This is called a Beta, but so far testing has been acceptable for most simple operations.  The downside, this will not work if you are using a 64-bit version of Windows.  It is all built using 32-bit binaries.
Cygwin  www.cygwin.com/install.html.  Ever maligned and cursed, but this old dinosaur from the DOS days is still maintained and works.  When running setup.exe make sure you select all the development tools
The Minimal GNU for Windows http://www.mingw.org/ gives you make, g++, svn, gdb, and most of the tools you need.  Like andliux, the emacs editor can be a bit wiggy, since the X server is not fully debugged, but the tools you need for the course are all there.
Mac users will need to have a version of XCode installed on their machine.  It is not a part of the default installation but it is on your distributed disk/thumb drive as an additional installation (XCode 3.x).  You will need to put /Developer/usr/bin in your terminal path (remember, under Mac OS X is a real BSD unix operating system, most of the shell commands we give you work fine in the bash shell you access with your Terminal application).  DO NOT USE THE XCODE ON THE APPLE APP STORE.  It is a horror of breakage at this time.
You will need a sane and powerful editor on your system.  You can pick an easy editor, then grow weary of using your mouse to do everything, or a powerful editor, and feel like a bumbling fool for the first month.  Some options
First choice, Emacs.   We use it, lots of programmers use it.  You'll look like a pro when you master it, which nobody ever really does.  On linux it is already there, for macs visit http://www.macupdate.com/app/mac/19269/carbon-emacs.  Linux users might like to use xemacs instead www.xemacs.org.  It has menus and buttons for when you forget a command.  The Mac carbon emacs already has all these nice buttons and menus for you.
Jedit is a cool code editor.  http://www.jedit.org/  You can tell an editor that is meant for programming.
So, you have never used UNIX ? 
http://docstore.mik.ua/orelly/unix/lrnunix/
http://www.ee.surrey.ac.uk/Teaching/Unix/

    VisIt Download Page  VisIt download page


4 Course outline

Square brackets indicate lecture numbers.

  1. Course Introduction [1]
  2. The Seven Dwarves [2]
  3. Compiled vs Interpreted Languages [3]
  4. Development Management [4]
  5. C++ key language features.[5,6]
  6. Software Engineering Concepts [7,8]
  7. Structured Grid [9]
  8. Skill development: Debugging [10]
  9. Sparse Linear Algebra[11]
  10. Asymptotic analysis and algorithmic complexity. [12,13]
  11. Introduction to Profiling and simple Optimization [14]
  12. Dense Linear Algebra and Fast Fourier Transform[15,16]
  13. Unstructured Grids and Graph [17,18]
  14. Managing project complexity and team development.[19]
  15. Bigger Example, Crank-Nicholson Diffusion Equation [20]
  16. Final Project Discussion and Timeline. [20]
  17. N-Body Problem [21]
  18. Multi-level Schemes[22,23]
  19. Dictionaries. Keeping track of the explosion of parameters [24]
  20. Special Topic: A Tour Through Language and Compilation [25]
  21. Special Topic: And the world is all parallel. [26]
5. Links to Lectures
   
Lecture 1 - preliminaries, a short introduction to computer architecture, the motifs. (revised 10/1/11)
    Lecture 2 - Our first C++ programs: Hello World, and others.
    Lecture 3 - Pointers, references,and user-defined types.
    Lecture 4 - C++ Classes, Development Tools
    Lecture 5: Development Tools Continued
    Lecture 6: Structured Grids
    Lecture 7: Building, Testing and Debugging
    Lecture 8 Supplemental
    Lecture 9: Unstructured Grid / Finite Elements
    Lecture 9 Templates
    Lecture 10: FEM Assembly and SparseMatrix
    Lecture 11: Fast Fourier Transform & Homework 1 outbrief
    Lecture 12: Fourier Transforms and Third-Party Libraries.
    Lecture 13: Streams, Inheritance, Debugging Again
    Lecture 14: Dense Linear Algebra (guest lecture by J. Demmel)
    Lecture 15: Particle Methods; Homework #3
    Lecture 16: std::list, std::map, Project Info
    Lecture 17: Particle Methods; Homework #4; Homework #3
    Lecture 18: Performance Debugging
    Lecture 20: Final Project Material
    Lecture 21: Advanced Make, Configure, Autoconf, Automake. Anatomy of a Program
    Lecture 23: Visualization Using VisIt
    Lecture 25: Mixed Language Programming