Laboratory for Scientific Computing, Department of Physics

University of Cambridge

My current research is involved with Adaptive Mesh Refinement, its parallelisation and optimization. This is being used to solve a wide range of problems in Scientific Computing by other members of the LSC Research Group.

My PhD focused on Numerical Relativity. The purpose of this was to develop
a code for simulating solutions of Einstein's equations using up-to-date
techniques such as AMR, overlapping grids, and HRSC schemes. The code was be
used to simulate wind accretion onto a Kerr-Schild black hole.

The code is built on the
Overture
package, which generates overlapping grids and provides capabilities for coding
numerical algorithms in a parallel environment

A copy of my thesis can be downloaded from DSpace. There was also a DVD accompanying my thesis, and the browseable content can be found here.

- Assessment of the MUSTA approach for numerical relativistic hydrodynamics - P. Blakely, N. Nikiforakis, W.D. Henshaw, Astronomy and Astrophysics, 575, March 2015, http://dx.doi.org/10.1051/0004-6361/201425182
- General Relativistic Hydrodynamics on Overlapping Curvilinear Grids - P. Blakely, N. Nikiforakis, W.D. Henshaw, Astronomy and Astrophysics, 575, March 2015, http://dx.doi.org/10.1051/0004-6361/201425184
- Relativistic Bondi-Hoyle-Lyttleton Accretion: A Parametric Study - P. Blakely, N. Nikiforakis, Astronomy and Astrophysics, 583, November 2015, http://dx.doi.org/10.1051/0004-6361/201525763

I undertake teaching for the MPhil in Scientific Computing run by the Centre for Scientific Computing. This is also part of the CDT in Computational Methods for Materials Science.

This course is taught to all MPhil students in the Michaelmas Term. GNU/Linux is the operating system of choice in most scientific research environments. In this course we cover the following topics:

- Lecture 1 - Command-line and files
- Lecture 2 - Linux networking
- Lecture 3 - Shell-scripting
- Lecture 4 - Compilation, Linking, and Makefiles
- Lecture 5 - Version control - Subversion and Git
- Lecture 6 - Computational Complexity and Data Structures

This course is taught to all MPhil students in the Michaelmas Term. While there are other scientific computational languages available, notably Fortran, many scientific programs are written in C++. This course aims to give students a solid grounding in the basics of the language and a good introduction to some of the more advanced aspects as might be needed for writing robust scientific programs. It does not cover all of C++ by any means.

- Lecture 1 - Introduction to C++
- Lecture 2 - Basic Mathematics
- Lecture 3 - Further C++ Constructs
- Lecture 4 - Functions
- Lecture 5 - Memory and Pointers
- Lecture 6 - The compilation process
- Lecture 7 - Object-Oriented Programming
- Lecture 8 - More classes
- Lecture 9 - Function and operator overloading
- Lecture 10 - C++ Standard Template Library
- Lecture 11 - Templates
- Lecture 12 - More programming comments

There is a set of practicals to accompany this course:

- Practical 1
- Practical 2
- Practical 3
- Practical 4
- Practical 5
- Practical 6
- Practical 7
- Practical 8
- Practical 9
- Practical 10
- Practical 11
- Practical 12

The solutions can be downloaded here.

I have occasionally replaced Dr Michael Rutter, standing in for lecturing his MPI course. Dr Rutter's notes can be found at MPI.pdf. I have used my own practical sheets for this, which can be found below:

- Practical 1 - My First MPI Program - compiling and linking
- Practical 2 - Simple collectives
- Practical 3 - Scatter and Gather
- Practical 4 - Send and Recv
- Practical 5 - Mandelbrot set area and Laplace's eqn
- Practical 6 - Short receives and ping-pong
- Practical 7 - NUMA and tuning

This course is taught to all MPhil students in the Michaelmas Term. It is intended to provide an introduction to the essentials of the CUDA programming language as developed by NVIDIA.

- Lecture 1 - Introduction to GPU hardware and to CUDA
- Lecture 2 - Writing and Compiling a CUDA code
- Lecture 3 - Example application: Two-dimensional Euler solver
- Lecture 4 - Debugging and Optimziation strategies
- Lecture 5 - CUDA Optimization
- Lecture 6 - Parallel CUDA and OpenCL

Code samples used in the lectures can be downloaded here.

There is a set of practicals to accompany this course:

- Practical 1 - Running CUDA examples
- Practical 2 - Multiplication of a Matrix and a Vector
- Practical 3 - Matrix Transposition
- Practical 4 - Reduction

Skeleton code for these practicals, as well as solutions, can be downloaded here (skeleton code) and here (solutions).

This course is under development, but covers aspects of C++11 not covered in the earlier course. It also covers some more advanced design constructs within C++.

- Lecture 1 - Introduction to C++11 - enums and types
- Lecture 2 - Further C++11 - moving and containers
- Lecture 3 - C++11 - Inheritance and Lambdas
- Lecture 4 - C++11 - Variadics, Folding, and C++17
- Lecture 5 - C++14 constexpr, Miscellaneous, and C++20
- Lecture 6 - Advanced C++: RAII, and templates
- Lecture 7 - Advanced C++: Template instantiation and expression templates

There are no practicals to go with this course, but virtually every topic introduced in the lectures is illustrated by a self-contained example in this tar-ball.

Brief talk on profiling given as an RSE Seminar. Profiling for HPC.

Brief talk on valgrind given as an RSE Seminar. Valgrind for debugging.

Brief introduction to issues of Parallel I/O and HDF5 given as an RSE Seminar. Parallel I/O and HDF5.

This probably doesn't count as a hobby, but I have written some obfuscated C programmes. Two of them have won awards in the International Obfuscated C Coding Contest:

- Life/Reverse-Life - in which we discover the Garden of Eden
- RPN Raytracer: Reverse Polish Notation Raytracing Animated GIF plotter.

Any complaints, comments or questions about this website and its content should be directed to Philip Blakely: pmb39@cam.ac.uk