Optimisation of a FLIP Fluids solver

In spring 2021 I joined forces with three classmates, and as part of the ETH lecture “Advanced Systems Lab” we revisited the FLIP Fluids Solver project from two years prior. The goal this time was to optimise the code using the skills acquired in this lecture and improve the time required to run a simulation.

Producer-consumer scheme with MPI

Below is a simple implementation of the producer-consumer parallel strategy with MPI. It’s just a dummy example, and could probably be improved greatly, but it is a nice illustration of the producer-consumer model, as well as uses for MPI_ANY_SOURCE, MPI_ANY_TAG, and MPI_Status. #include <stdio.h> #include <mpi.h> #include <time.h> #include <stdlib.h> #include <math.h> // Producer-consumer scheme

CUDA: efficient parallel reduction

CUDA is a very powerful API which allows us to run highly parallel software on Nvidia GPUs. It is typically used to accelerate specific operations, called kernels, such as matrix multiplication, matrix decomposition, training neural networks et cetera. One such common operation is a reduction: adding up a long array of numbers. One simple implementation

FLIP fluids simulation

Update: as of 2022, the full code has been open-sourced and is available on GitHub. In autumn 2018, I teamed up with classmates Silvia Nauer and Mikael Stellio for a project in the ETHZ course Physically-Based Simulation for Computer Graphics. The objective of our project was to create a video of a meteorite crashing into

Adding C++ auto-completion to Vim

I recently started using Vim as my main editor for programming. After the initial learning curve, I really started enjoying it, however, there’s some things I really miss from more traditional IDEs. Two of these are auto-completion and semantic “tips”. Auto-completion allows the developer to type only part of a function or attribute name, and

C++: the Named Parameter Idiom

Some times you will have a large C++ class with many parameters that need initializing. That can lead to some ugly constructor calls: auto popsim = PopulationSim(1000, 100000, 1000, 1000, 1500, 0.17, 0.05, 32, 3, 1, 7, 1); This makes the code very hard to maintain and debug, as there is no easy way to

Lecture summary: Programming Techniques for Scientific Simulations

During the autumn semester of 2017 I took the course “Programming Techniques for Scientific Simulations” as part of my BSc course in Computational Science and engineering at ETH Zürich. This is a summary of the course’s contents I wrote and used during the actual exam. Some things are missing, as it was an open-book exam

Compiling C++ libraries

If you use C++, you’ve almost certainly already used a library of some kind. Even the classic “Hello world” program requires one: #include <iostream> // include the iostream library int main() { std::cout << “Hello world!”; return 0; } But what if we wanted to write our own? This has several advantages. First off, if