abmgpu
Agent Based Model on GPU using CUDA 12.2.1 and OpenGL 4.5 (CUDA OpenGL interop) on Windows/Linux
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.8%) to scientific vocabulary
Keywords
Repository
Agent Based Model on GPU using CUDA 12.2.1 and OpenGL 4.5 (CUDA OpenGL interop) on Windows/Linux
Basic Info
- Host: GitHub
- Owner: KienTTran
- License: mit
- Language: C++
- Default Branch: master
- Homepage: https://github.com/KienTTran/ABMGPU
- Size: 89.3 MB
Statistics
- Stars: 70
- Watchers: 2
- Forks: 3
- Open Issues: 0
- Releases: 3
Topics
Metadata Files
README.md
ABMGPU
| :tada: Demo of agent based model on GPU using CUDA 12.2.1 and OpenGL 4.5 (Windows/Linux) :tada: |
A demo of using CUDA and OpenGL to render different locations with multiple agents with their own properties.\
This is a useful begin place for those want to illustrate or experiment how an agent based model works.\
You can update the adjust_person_entity function in src/gpu/GPUBuffer.cu to change the moving path and color of each agent.
:dart: Each triangle is an agent with different color and trajectory.\ :dart: On GTX 3060 the software can render 5-10M agents without problem.
:flowerplayingcards: The image below illustrates a demo of 12,000 agents each location (60,000 agents in total) for easier observation.
In this demo, each triangle is an independent agent and it has two properties: color and moving path.\ The color is assigned by the location so all agents in the same location will have the same color.\ The moving trajectory is randomized for each agent.

:flowerplayingcards: The image below illustrates a demo of ~500,000 agents of 100 (10x10) locations configured a from GIS raster file where each location has a random number of agents. This demo is from devbranch.

:flowerplayingcards: The image below illustrates a demo of ~15,000,000 agents of 21,798 (173x126) locations configured a from GIS raster file of Burkina Faso. Moreover, the population is dynamically changed based on census data. The color of each agent is based on the population density of each location. This version will be released soon.

| :gem: Features :gem: |
:whitecheckmark: Agent instances on GPU memory\ :whitecheckmark: Uses SSBO (Shader Storage Buffer Object) for instanced objects (with GLSL 450 shaders)\ :whitecheckmark: CUDA OpenGL interops\ :whitecheckmark: Renders with GLFW3 window manager\ :whitecheckmark: Dynamic camera views in OpenGL (pan,zoom with mouse)\ :whitecheckmark: Libraries installed using vcpkg\ :whitecheckmark: Load configuration as YAML file\ :whitecheckmark: Load location data in GIS raster file (.asc file)\ :whitecheckmark: Update number of agents dynamically based on census data\ :warning: Code is dirty and buggy
| :books: Libraries :books: |
vcpkg install glfw3 opengl glew glm imgui[core,glfw-binding,opengl3-binding] easyloggingpp date yaml-cpp
| :pencil: Citation :pencil: |
This repo is a GPU implementation of original CPU based simulation from https://github.com/maciekboni/PSU-CIDD-Malaria-Simulation, which was originally developed by Nguyen Tran. The spatial (raster/Burkia Faso movement model) part was implemented by Robert Zupko. Kien Tran implemented display and GPU processing.
Tran, K. T., Tran, N., & Zupko, R. (2025). Agent based simulation using GPU and OpenGL.
Zenodo. [https://doi.org/10.5281/zenodo.14967981](https://zenodo.org/records/14967981)
or
@software{Tran_Agent_based_simulation_2023,
author = {{Tran, Kien Trung},{Tran, Nguyen Dang},{Zupko, Robert}},
doi = {10.5281/zenodo.14967981},
month = dec,
title = {{Agent based simulation using GPU and OpenGL}},
url = {https://github.com/KienTTran/ABMGPU},
version = {1.0.1},
year = {2025}
}
| :question: How it works :question: |
The simulation is a combination of instancing feature and parallel computing from OpenGL and CUDA respectively.\
Using OpenGL, you can instance as many objects as you want using SSBO and compute position and color of clone objects on shader via GLSL file. Instead of using shader, this demo using CUDA to compute postion and color (via glm::mat4 matrix and glm::vec4 color arrays) of all instances at the same time and all agents are computed in batch processing.
| :star2: How to build :star2: |
- Clone the repository
- Install
vcpkgand install requirement libraries\vcpkg install glfw3 opengl glew glm imgui[core,glfw-binding,opengl3-binding] easyloggingpp date yaml-cpp\ Note: Some libraries are extra for experiment and future development (imgui, easylogging, date, glew) - On Window:
- Use any IDE (I'm using
CLion) supportsCMakeproject to load the project folder - Edit the CMakeList file to match your
vcpkg cmakefile andCUDAinstallation folder on your computer. - Build and run with arguments:
-i <path to config file>(e.g.-i ../../input/config.yaml)
- Use any IDE (I'm using
- On Linux:
- Edit the CMakeList file to match your
vcpkg cmakefile andCUDAinstallation folder on your computer. - In the project folder, type
mkdir build && cd build && cmake ..then execute the binary built with arguments:-i <path to config file>(e.g../ABMGPU -i ../../input/config.yaml)
- Edit the CMakeList file to match your
- Star :star2:, issue and pull request are welcomed
Owner
- Login: KienTTran
- Kind: user
- Repositories: 2
- Profile: https://github.com/KienTTran
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Tran" given-names: "Kien Trung" orcid: "https://orcid.org/0000-0003-3046-8547" - family-names: "Tran" given-names: "Nguyen Dang" orcid: "https://orcid.org/0000-0002-5118-8432" - family-names: "Zupko" given-names: "Robert" orcid: "https://orcid.org/0000-0001-8757-483X" title: "Agent based simulation using GPU and OpenGL" version: 1.0.1 doi: 10.5281/zenodo.14967981 date-released: 2025-03-04 url: "https://github.com/KienTTran/ABMGPU"
GitHub Events
Total
- Release event: 2
- Watch event: 6
- Push event: 5
- Create event: 2
Last Year
- Release event: 2
- Watch event: 6
- Push event: 5
- Create event: 2
Issues and Pull Requests
Last synced: about 2 years ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0