# Lecture material¶

Videos for lectures will typically be available online a few hours after class. Search for “M3C” on panopto.

**Lecture 1:**Introduction to course, basic Unix commands. Slides (pdf)

**Lecture 3:**Simple I/O and text processing with Python, Python functions, Python programming demo: computing

*sqrt*with Newton’s method. Slides (pdf)

**Lecture 4:**Importing and running Python modules, timing Python code, informal introduction to random walks and Brwonian motion. Slides (pdf)

**Lecture 5:**Vectorizing code and completion of Brownian motion demo, complex networks and the NetworkX package. Slides (pdf)

**Lecture 6:**Further analysis of complex networks, solving optimization problems with Scipy. Slides (pdf)

**Lecture 7:**Final comments on optimization and Python. Introduction to Fortran. Examples illustrating: basic code structure, variable types and declarations, loops, if-statements, subroutines, quadrature with midpoint rule: Slides (pdf)

Several example codes can be found in course repo.

**Lecture 8:**More on Fortran. Array arithmetic, allocatable arrays, functions; modules and modular programming: Slides (pdf), Six example codes are available in the course repo.

**Lecture 9:**Libraries, Lapack and using

*dgesv*; interfacing Fortran and Python with

*f2py*; timing Fortran code: Slides (pdf)

**Lecture 10:**Tips on getting started with Fortran, using

*f2Py*with Fortran modules and allocatable arrays; compiling and optimization: Slides (pdf), Example codes are available in the course repo.

**Lecture 11**: Profiling Fortran code; introduction to parallel computing: Slides (pdf)

**Lecture 12**: Getting started with OpenMP, parallel loops. Slides (pdf) Example codes are available in the course repo.

**Lecture 13**: OpenMP: Reduction, setting the number of threads and a few other useful commands. Programming example: parallel quadrature with midpoint rule. Slides (pdf) midpoint_time_omp.f90

**Lecture 14**: Solving the (1-D) heat equation: Jacobi iteration, implementation with Fortran and OpenMP; Slides (pdf) jacobi1s_omp.f90 jacobi1s_omp.py

**Lecture 15**: Introduction to MPI, collective communication, parallel quadrature with MPI. Slides (pdf) mpif90template.f90 midpoint_mpi.f90

**Lecture 16**: More on Mpi, coarse-grain parallelism, send/recv, domain decomposition. Slides (pdf) sendExample.f90 gradient_p.f90

**Lecture 17**: Overview of send/recv and 1-D domain decomposition, time-marching methods, review of Jacobi iteration for 1D steady heat equation, 2D domain decomposition with MPI and sparse matrices. Slides (pdf) jacobi2s_omp.f90, Python RK4 code

**Lecture 18**: MPI reference slides, 2D domain decomposition with MPI, notes on parallel computing: OpenMP vs MPI, solving PDEs; Slides (pdf)

**Lecture 19**: Waves on graphs, HPC at Imperial; cloud computing with AWS, makefiles. Slides (pdf)

**Lecture 20**: Cluster computing for data analysis with Apache Spark; computer science vs. scientific computing and the merge sort algorithm. Slides (pdf)