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.
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:
- The top-down approach take coarse-grained dynamic models that simulate environments in large chunks and scale to large areas as needed, but with a lack of accuracy in the simulated environment that only captures summarised features.
- Bottom-up fine-grained agent-based models (ABMs) which provide a more accurate description of the modelled domain.
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
- Isabelle Marechaux and Jerome Chave. An individual-based forest model to jointly simulate carbon and tree diversity in Amazonia: description and applications. Ecological Monographs, 87(4):632–664, 2017.
Links
- The source code is on a private repository on GitHub. Please contact Martynas Sinkievič to request access.
- The dissertation is available on request for interested students from Anil Madhavapeddy but has not otherwise been made public.
Related News
- Remote Sensing of Nature / Jan 2023