Enhancing the capabilities of autonomous space missions
The below case study shares some of the technical details and outcomes of the scientific and HPC-focused programming support provided to a research project through NeSI’s Consultancy Service.
This service supports projects across a range of domains, with an aim to lift researchers’ productivity, efficiency, and skills in research computing. If you are interested to learn more or apply for Consultancy support, visit our Consultancy Service page.
At the University of Auckland, Doctoral Student Adam Evans and his supervisor, Professor Roberto Armellin, are working on developing guidance algorithms based on differential algebraic techniques for spaceflight. The outcome of his research project will allow for a high-order guidance algorithm to be generated for landing on the asteroid Bennu. Missions to asteroids like Bennu, for both observation and sample return, are fundamental for our understanding of the origin of the solar system. However landing on small bodies is difficult due to the highly nonlinear dynamical environment and the small error margins. The ‘high-order’ nature of the developed algorithm means it can effectively handle this nonlinearity (compared to classical implementations that are linear and thus diverge quickly in nonlinear environments). The Automatic Domain Splitting (ADS) implementation used in this new approach is a further improvement over previous research which not only increases the effectiveness of the guidance scheme, but also increases the convergence radius to allow greater uncertainty in the trajectory to be handled, which has great application to robust autonomous space missions of the future.
The algorithm works by solving for an initial simulation domain. If the error in the solution is too high, the ADS routine will split the domain in two and then solve both of the subdomains to improve the accuracy of the solution. This happens recursively (i.e. each subdomain could then also split and the resulting sub-subdomains would then need to be solved too) until the error is acceptable. In the original implementation, the subdomains are solved sequentially, however, each subdomain can be solved independently of all other domains, which means the ADS routine is a good candidate for parallelisation. In some cases a large amount of splitting has been observed, for example up to thousands of splits, so parallelising the ADS could potentially give a good boost in performance.
What was done
NeSI Research Software Engineers Chris Scott and Maxime Rio worked with Adam via a NeSI Consultancy project to help improve the performance of his code. Initial profiling of the code showed that there was another routine, in addition to the ADS, called “PolyGrav” that was also a good candidate for parallelisation. We added OpenMP parallelism to this routine, including investigating thread safety in the underlying DACE library. The ADS routine was then parallelised too using OpenMP, by creating a pool of threads that take unprocessed domains from a queue and solve them, performing splits if required by adding the resultant new subdomains back into the queue to be processed.
Parallelised the ADS routine using OpenMP, which results in a significant performance improvement for scenarios that require lots of “domain splitting”. A simple test case ran 8 times faster using 16 threads, with the parallel efficiency expected to improve for more realistic cases (that involve more domain splitting)
Parallelised another routine (“PolyGrav”) that was identified as a major performance bottleneck during profiling, also using OpenMP and resulting in another good speedup independent of the amount of splitting
The two levels of parallelism can be used together (i.e. nested parallelism) or individually and is easily controlled using environment variables
Introduced a CMake build system to the project to make building the code, locating dependencies, etc. much easier and the code is now more portable between platforms
Introduced the spdlog logging library to give more clear messages (including time stamps to help with understanding when things are happening in parallel)
A simulation output of the guidance algorithm used for landing on the asteroid Bennu. Credit: Adam Evans.
"My consultancy with NeSI has been invaluable for my research. The parallelisation of the ADS and PolyGrav routines have resulted in significant speed ups to my programs, and with multiple runs of the code, I have already saved hours if not days of computational time to develop the guidance algorithms that are the focus of my research. Throughout the project duration, Chris and Maxime would explain their progress during weekly meetings, allowing me to understand and appreciate what was being developed and how. Their willingness to explain their code has allowed me to understand how the parallelisation routines they have put into place work, so that I may further develop this in future and both share and explain this to colleagues. The additional tips and tricks I have learnt from their wealth of knowledge about C++, multithreading, libraries, compiler settings, etc. has been of substantial use too. I could not recommend the NeSI consultancy more highly - thank you once again to Chris and Maxime for their incredible work."
- Adam Evans, Doctoral Student, Mechanical Engineering, University of Auckland
Do you have a research project that could benefit from working with NeSI Research Software Engineers or our Data Science Engineer? Learn more about what kind of support they can offer and get in touch by emailing email@example.com.