Scientific Programming

by Nikolai Piskunov

 

During the last years one subject not covered by the PhD course curriculum popped up many times in the discussion with students: programming ... and I do not mean computer sciences or numerical methods. I mean basic skills in how to implement a given task (physical model, data analysis, text file sorting, whatever) on a computer. This will not be a course in Python, Java or C++ although we would need to use some language(s) for the homework.

 

The goal of the course is to understand the interaction between you program and your computer and to answer the question why apparently identical algorithms may show different performance and even different results

 

With this introduction the course will cover the following topics:

 

1. Computer and software interaction:

   - hardware, memory, bus, registers,

   - pipelines, threads

   - branching, context switching

   - memory allocation,

   - loops

   - exceptions
   - input/output

 

2. Programming language components:

   - constants, variables, arrays, structures, derived data types

   - flow control (redirections, conditions, loops)

   - subroutines (parameters, global variables, static versus dynamic,

     pointers versus values)

   - memory allocation

   - I/O, files from a program perspective, creation and opening of files,

     formatted, unformatted, sequential, direct, file positioning

   - libraries, using and creating dynamic or static library

   - combining programming languages

 

3. Programming

   - compillers, steps and switches

   - general layout (designing a new code)

   - structuring

 

4. Debugging ("every code has at least one bug")

   - debugging strategy

   - using code structure

   - "poor-men's" debugging

   - using special tools (tracing, exceptions, array boundaries, memory

     leaks)

 

5. Optimization

   - array size and access

   - subroutine calls

   - loops

   - threads

   - optimization versus structure and portability

 

The link to the 2015 course web page can be found here

 

I am planning to use practical examples in various programming languages that I am familiar with (FORTRAN 77 and 90, C, C++, IDL) and the students will get lots of home work in a form of small programs aimed at understanding computer behavior, and train various programming muscles.

 

The course will be 10 hp. In order to pass you will need to turn in all homework some of which you will present in the class.

 

We will complete the course in October with the following schedule:

Part I: September 5-10 (3 lectures and lots of home work)

Part II: Sept. 19-21 (student presentation of the home work)

Part III: Sept.23 - Oct. 19 (concluding 5 lectures with more but smaller home work)

 

The schedule looks like this:

 

Lecture Notes, schedule and home work:

Lecture 1 (Mon 05/09 10:15-12:00 Oseenska rummet Å73121) Computer hardware characteristics affecting user codes

Lecture 2 (Wed 07/09 10:15-12:00 Oseenska rummet Å73121) Elements of programming languages

Lecture 3 (Fre 09/09 10:15-12:00 Oseenska rummet Å73121) Compiling and Linking

Home Work Part I The first round of presentations is on September 19th at 10:15am Oseenska rummet Å73121

                               The second round of presentations is on September 21st at 10:15am Å4001, different room!

Lecture 4 (Fri 23/09 10:15-12:00 Oseenska rummet Å73121) Designing a new code

Lecture 5 (Mon 26/09 15:15-17:00 Å80109, different room!) Style and Structure

  3rd round of homework presentations ( Tue 27/09 10:15-12:00 Å6K1107, different room!)

Lecture 6 (Mon 03/10 10:15-12:00 Oseenska rummet Å73121) Optimization

Home Work Part II. The results will be presented in the class (10 minutes per person). Here are you options:

-If you are starting to work on a new code, do the analysis described in lecture 4 and present argumentation.

-If you have a code, which is producing dubious results, try using the debugging techniques described in the course and present the results.

-If you have a working code that may benefit from optimization profile it and look for possible optimization options.

-If you have a working code that you would want to parallelize, try it.

Lecture 7 (Mon 17/10 10:15-12:00 Oseenska rummet Å73121) Going multi-lingual

Lecture 8 (Wed 19/10 10:15-12:00 Oseenska rummet Å73121) Parallel computing

Home Work Part I:  The last round of presentations is on October 21st at 10:15am Oseenska rummet Å73121

Home Work Part II: Presentations of the Home Work Part II - your own project & parallel computing - will be on Thursday, October 27th at 13:15 Oseenska rummet Å73121

 

Good luck!

 

Prof. Nikolai Piskunov

piskunov@fysast.uu.se

tel: 018 471 59 58