Projects / SocialSim
Getting a social media simulator running on the lab’s server
SocialSim simulates social media platforms and the users on them, to study how users and content interact. The simulator code existed, but it didn’t build on the lab’s Linux server. My job was to make it build and run reliably there.
What it simulates
SocialSim is built on RHPC_SMPLE, the Repast HPC Social Media Platform Emulator. It models two things. A platform has its own features (posting, commenting, liking) and its own strategy for deciding what content each user sees. User agents act on the platform according to their own strategies. Researchers write a scenario, such as a simple Twitter-like platform fed with real event data from a CSV file, and run it over a simulated date range.
Because it’s built on Repast HPC and MPI, a simulation can be split across many processes to model large populations.
The problem
The code depended on a fragile chain of C++ scientific libraries: specific versions of Boost (with its MPI and serialization modules), NetCDF and its C++ bindings, and Repast HPC itself, each compiled against the others. On the lab’s Linux server that chain didn’t build, so the simulator couldn’t be used for research.
Architecture
Why this approach
Containerise the toolchain instead of fixing the server
Installing old Boost and Repast HPC versions directly on a shared research server would have risked breaking other people’s work, and the next person would have had to repeat it. A Dockerfile pins every version and compiles them against each other in the right order. It also documents the exact build, because the Dockerfile is the build.
Trade-off: a large image and a long first build, and MPI inside a container needs care if the simulation is later spread across several machines.
A run script for the common case
Running a scenario needed library paths, two property files and an MPI launcher. run_scenario.sh wraps that in one command that takes a scenario name and an output suffix, so researchers can run experiments without learning the build.
CI on every push
A GitLab CI job builds the project, so a change that breaks the build shows up immediately instead of the next time someone tries to run a simulation.
Check the details here against what you remember: whether simulations ran in the container or directly on the server, roughly how large a run you tested (agents, processes, runtime), and any results the lab used. A screenshot of a run’s output would also help.
What I learned
- Reproducibility is a feature. Research code that only runs on one machine effectively doesn’t exist. Pinning the environment did more for the project than any code change.
- Read the build before the code. Most of the problems were in makefiles, linker paths and library versions, not in the simulator. Understanding how C++ libraries find each other at build and run time was the actual skill.
- Make the right way the easy way. A one-line run script meant other people actually used the setup.