Inspiration
During the Chinese new year, I was stuck at home due to the Covid-19 situation. I saw a video which simulates the virus spreading. However that demo has very limited performance and not able to run as a server. I decided to create a better simulator.
What it does
I decided to create a production level virus spreading simulator to support following features:
- POI based person move behavior: person has the following status "Stay home", "Go Out(to a POI)","Walk around", "Go Home". simulator will use "Activity" to decide which status the person should take.
- Improved SIR spreading model: I use a location based spreading model, an infective can infect persons around. each person has a "infective progress" property, which it reaches 1(max value). this person is infected and become an infective.
- Map data support: User can use grey-scale image data to setup person home and POI positions.
- CSV export: the raw data of each frame is able to be exported after each run.
person
How I built it
I spent about 1 week to workout the high performance parallel calculating kernel. Then spend 1 week to add the plugin system one by one. (person behavior plugin, virus spreading plugin, render plugin)
Challenges I ran into
High performance computing is always challenging, you need to take care thread concurrency, memory management and user code. using GPU to accelerate calculation is a good way, however I found it has many restrictions. At last I decide to hold the GPU accelerate for now, because developer may need to learn a lot of GPU calculation rules before they can start develop plugin for this.
Accomplishments that I'm proud of
High performace: the kernel is able to simulate about 70K persons at 7~8 FPS on my laptop (UI rendering off). Easy to integrate: the kernel is a dotnetcore 3.1 library, it supports cross platform and can be easily integrate to other tools. It can also be ported to a webAPI and hosted in docker.
What I learned
Span and Memory is very useful in high performance computing. Stay at home is much safer than go out Hospital beds count is very important
What's next for VirusSimulator
- add webAPI & docker support
- supported distrusted computing
- add "navigation" to person move behavior
- UI improvement
Log in or sign up for Devpost to join the conversation.