Skip to content

Commit 129d1c5

Browse files
committed
Add blog and fix poster
1 parent 882661b commit 129d1c5

File tree

5 files changed

+91
-2
lines changed

5 files changed

+91
-2
lines changed

_data/preslist.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
- title: "Improving BioDynamo's Performance using ROOT C++ Modules"
22
description: |
3-
Poster presented at the FOURTH Mode Workshop on Differentiable Programming for Experiment Desing
3+
Poster presented at the FOURTH Mode Workshop on Differentiable Programming for Experiment Design
44
location: "[Fourth MODE Workshop](https://indico.cern.ch/event/1380163/)"
55
date: 2024-09-24
66
speaker: Isaac Morales Santana
77
id: "FOURTHMODEBDM"
88
artifacts: |
99
[Link to poster](/assets/presentations/Fourth_MODE_Isaac_Morales.pdf)
10-
highlight: 1
10+
highlight: 0
1111

1212
- title: "Accelerating Large Scientific Workflows Using Source Transformation Automatic Differentiation"
1313
description: |
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: "Wrapping up GSoC'24: Improving performance of BioDynaMo using ROOT C++ Modules"
3+
layout: post
4+
excerpt: "This project, part of Google Summer of Code 2024, aims to reduce the header parsing in BioDynaMo using the ROOT C++ Modules"
5+
sitemap: false
6+
author: Isaac Morales Santana
7+
permalink: blogs/gsoc24_isaac_morales_wrapup_blog/
8+
banner_image: /images/blog/gsoc-banner.png
9+
date: 2024-10-17
10+
tags: gsoc root cmake c++
11+
---
12+
13+
### Introduction
14+
15+
I am Isaac Morales, a Computer Engineering student at the University of Granada, Spain.
16+
This summer I had the opportunity to participate in Google Summer of Code 2024. My project
17+
revolved around enhancing BioDynaMo's performance using the ROOT C++ Modules.
18+
19+
**Mentors**: Vassil Vassilev, Lukas Breitwieser.
20+
21+
22+
### Project overview
23+
24+
BioDynaMo is an agent-based simulation platform designed to facilitate complex simulations,
25+
particularly in fields like cancer research, epidemiology, and social sciences. It leverages
26+
ROOT—a framework widely used in high-energy physics—for statistical analysis, random number
27+
generation, C++ Jupyter notebooks, and I/O operations. However, enhancing BioDynaMo’s performance
28+
remains a key challenge. This is where this Google Summer of Code 2024 (GSoC ‘24) project comes
29+
into play, focusing on optimizing the platform through ROOT C++ Modules.
30+
31+
### The Challenge: Performance Bottlenecks in BioDynaMo
32+
BioDynaMo’s reflection system, which utilizes Cling (an interactive C++ interpreter from ROOT),
33+
experiences significant runtime performance and memory usage issues. The repeated parsing of library
34+
descriptors by Cling introduces inefficiencies that slow down the startup phase and consume excessive
35+
memory. These bottlenecks are especially evident in simulations with a low number of time steps, as
36+
a substantial portion of the time is spent on parsing rather than on actual computations.
37+
38+
### The Solution: Integrating ROOT C++ Modules.
39+
The primary goal of the GSoC project was to integrate ROOT’s C++ Modules into BioDynaMo to minimize
40+
these performance issues. C++ Modules offer an efficient on-disk representation of C++ code,
41+
reducing the need for repeated parsing of invariant code. By implementing these modules,
42+
the project aimed to optimize runtime memory usage and improve overall performance
43+
44+
## Key steps undertaken include:
45+
1. **Reworking CMake Rules:** The project incorporated ROOT and another packages
46+
efficiently using FetchContent, modifying CMake rules accordingly (e.g., PR [#365](https://github.com/BioDynaMo/biodynamo/pull/365)
47+
and [#387](https://github.com/BioDynaMo/biodynamo/pull/387))
48+
2. **Replacing genreflex with rootcling:** This switch was crucial to enable C++ Modules and
49+
streamline the generation of reflection information (PR [#379](https://github.com/BioDynaMo/biodynamo/pull/379))
50+
3. **Automatic Modules Map Generation:** Using relative paths, the CMake system was modified to
51+
automate module map creation, ensuring smooth integration with BioDynaMo's libraries.
52+
53+
### Promising Results
54+
The results have been promising, showcasing significant performance gains. Benchmarking revealed
55+
improvements ranging from 18% reduction in peak memory usage with the default modules.idx to 25% with the
56+
updated one.
57+
![Plot of the peak memory usage in various demos](/images/blog/bdm-peak-memory.png)
58+
59+
60+
Moreover, the startup phase saw an impressive 80% reduction in time, thanks to the optimized
61+
handling of header parsing. That highlights the efficiency of C++ Modules in minimizing
62+
Cling’s parsing overhead
63+
![Plot of the startup time in various demos](/images/blog/bdm-startup-time.png)
64+
65+
As expected, the simulation time did not show an appreciable improvement. However, in the
66+
unit tests, the time was 33% lower. I believe this is because unit tests involve a lot of parsing and Cling calls.
67+
68+
### Future Steps and Challenges Ahead
69+
Despite these advances, several challenges remain. For instance, memory leaks have been observed when using the new
70+
`ROOT_GENERATE_DICTIONARY`, even with C++ Modules disabled. Additionally, the build system for individual demos has
71+
caused compatibility issues with the main build system. Resolving these issues and finalizing the integration of C++
72+
Modules will be essential for ensuring long-term stability and reliability.
73+
74+
Looking ahead, further optimizations are planned, including potential module-based optimizations for BioDynaMo’s
75+
core components. Collaboration with the BioDynaMo team continues, with upcoming meetings scheduled
76+
to align efforts and resolve outstanding issues.
77+
78+
### Conclusion
79+
The integration of C++ Modules has proven effective in reducing memory usage and startup time, although some hurdles remain.
80+
Continued collaboration and testing will be crucial to fully realize the performance potential of BioDynaMo,
81+
enabling more efficient simulations for researchers in computational biology.
82+
83+
### Related Links
84+
85+
- [ROOT website](https://root.cern)
86+
- [BioDynaMo website](https://www.biodynamo.org/)
87+
- [My GitHub Profile](https://github.com/imorlxs)
88+
89+

images/blog/bdm-peak-memory.png

21.1 KB
Loading

images/blog/bdm-startup-time.png

21.3 KB
Loading

images/pubpic/FOURTHMODEBDM.png

226 KB
Loading

0 commit comments

Comments
 (0)