/ Ideas / Exploring Concurrency in Agent-Based Modelling with Multicore OCaml

This is an idea proposed in 2021 as a Cambridge Computer Science Part II project, and has been completed by Martynas Sinkievič. It was supervised by Anil Madhavapeddy as part of the Remote Sensing of Nature project.

Summary

Computational modelling techniques such as ABMs are used to understand the dynamics of ecosystems and predict their behaviour in response to climate change and ecological disturbances, while also searching for optimal paths towards solutions to these problems. Terrestrial biosphere models are one such model which simulate the vegetation and soil life cycle. There have been two approaches taken with such modelling:

This project investigates ABMs that simulate all relevant parameters of a local environment and can capture the lifetime of agents, and thus can achieve accurate summaries as observed emergent behaviour. These models are computationally intensive, and so we need multi-processor hardware to be utilised fully. While common performant languages for computational science include C++ and Java, their semantics can be unforgiving in the face of complex code, with data-races causing potentially causing non-sequential behaviour in both languages. This makes debugging and developing such applications with parallelism in mind very difficult, especially so for those without deep background knowledge of the respective compilers and runtimes. It is also common practise in the aforementioned languages to introduce global state, which can lead to difficult to interpret data relationships and makes parallelism much more difficult to apply.

This project ported a particular example of the leading agent-based forest simulator created by Marechaux and Chave, TROLL, and migrated it to OCaml while applying a more functional style, and then introduced concurrency. This gave insight into the difficulties of refactoring and maintaining modern scientific computing codebases, as well as the new parallelisation mechanisms of Multicore OCaml.

Related reading

Links

Related Ideas