microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.04k stars 4.48k forks source link

more than 500 multi-agents simulation at one time #4942

Open ZhangShaungnj opened 3 months ago

ZhangShaungnj commented 3 months ago

How can I simulate more than 500 multi-rotors at one time. Here is my computer hardware list: cpu:AMD EPYC 9654 96-Core Processor
ram:128g gpu:4090 I find the simulation will not display smoothly in UE everytime the number over 70~80 I have tried join(),multi-process,threading.They don't work

### Tasks
ZhangShaungnj commented 3 months ago

Snipaste_2024-03-14_22-50-23 Snipaste_2024-03-14_22-50-53 Snipaste_2024-03-14_22-51-22

Midas75 commented 4 weeks ago

AirSim adopts a spin wait similar to sleep (0) in some low-level sleep implementations, which causes threads to be repeatedly scheduled on the CPU core when multiple drones are simulated simultaneously, resulting in high kernel state consumption. When the number of simulated drones approaches the number of CPU cores/CPU threads, performance will plummet, so it can be seen that in your configuration, 80 drones correspond to your CPU96 core. The solution is to replace its internal spin implementation (approximately four times) with a plain sleep implementation and recompile AirLib for use in the Unreal project. Using this method, I can achieve 400+drone simulation based on i7-12700 in Unity scenarios.