A Wee Farewell
Sadly, this is my last post for the Summer of HPC. It’s been a great two months! Today, I’d like to talk about the final results of my project, namely the use of my animation framework for the coastal defence/wave demonstration, and the web framework I created for the simulation. First, a video of the coastal defence simulation in action!
The main operation used in the coastal defence demonstration is what is known as a “haloswap”. This is an operation at a slightly higher level of abstraction to typical MPI communications, but is very simple. To start, you need a grid, or matrix, or array – whatever terminology you prefer.
In the wave simulation, you need to split this grid across many different Pis to run a simple differential equation solver on it (which I won’t go into here). So far, so good. In the video above, we split this grid into 16 equal horizonal strips and give one strip to each Pi (the output from the simulator shows slightly different vertical lines). But how does a wave move from the top of the simulation to the bottom? There is some kind of local relationship in the grid that means changes in one area affect those nearby. How do we pass this local information to other Pis?
The size of this local area of influence is known as a halo, and as I’m sure you’ve guessed from the video, we simply swap the halos between the Pis, known as a “haloswap”. Under the hood, this is a simple send and receive both ways, of an array of numbers (a buffer of data). Once the local information is properly exchanged, the simulation can transfer waves between strips. Wonderful!
This does have to happen after every iteration (tick of time), so many thousands of haloswaps will occur during the simulation. This would be absolutely impractical to visualise, so there needs to be some kind of limitation on what is shown. For the ease of getting a nice visual output in this project, I’ve just shown every 100th haloswap, a number which would vary depending on the speed of the simulation. Better solutions exist – you could calculate the speed of showing the visualisation vs a sample speed of the visualisation, and show them at the correct rate to keep them in sync, for example, but this is a complex operation given how little it offers in return.
In order to show the haloswap, I added a custom function to my Wee MPI framework (now available in Fortran, as that’s what this and many other HPC simulations are written in), which allows a user to play any named animation on the server, allowing lots of easy flexibility for custom animations such as that shown above.
A Web Interface?
In my previous post, I discussed the creation of a web framework for running simulations. To recap on the current situation (the framework used for the current version of the wave simulator), all computations are managed by a web server (using Flask) on the top left Raspberry Pi. This Pi dispatches simulations and collects results using MPI, and then continuously returns these results over the network. Currently the client is also a Python application with an interface made using WxWidgets, but this doesn’t have to be the case!
The website is mainly functional – I didn’t spend long perfecting looks. As the focus of my project is the visualisation of the parallel communications, I didn’t want to spend too long on web development! I developed a simple version of the whole site, with placeholders in place of some things. For example, while network communications are fully implemented for the MPI demonstrations, handling data in the browser is not the same as in Python!
As a result, I wouldn’t be able to fully re-implement the wave simulation without a bit more work than I had time for, though you can see an initial version, which allows you to place blocks and shows the benefit of using a webpage as the user interface. Many further features could be added from here, such as a detailed control panel for Wee Archie operable by a student or non-HPC expert, further tutorials and demonstrations, even a virtual version of Wee Archie – WebGL is getting pretty fast nowadays.
Alternatives include a more modern UI framework than WxWidgets, but this requires a lot more knowledge than web development of the average Wee Archie developer. I’ll leave the final decision on the path to take up to the maintainers of Wee Archie here at EPCC!
I’d like to thank everybody here at EPCC and PRACE for such a wonderful experience, in particular my mentor, Dr. Gordon Gibb. I’ve learned a lot, from MPI to video editing in these two months, and I’m sure that I’ll never program in serial again if I can help it.
Before too long, all of my code will be available on the Wee Archie Github repository. If you’d like to see my final video presentation, I’ve embedded it below. My final report will be available on this site also. If you’d like to follow my work in future, check out my website!
I hope you’ve enjoyed my blog posts, goodbye for now!