Wiki
Tags Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Gem5笔记

Running gem5 simulation faster on multiple host CPU?

gem5 is a single-threaded simulator, for the most part. There is some support for assigning event queues to multiple threads, but it isn’t fully fleshed out except in very limited circumstances (e.g., two systems connected via ethernet).

However, there are a number of different ways to speed up simulation, especially for fast-forwarding to the region of interest (ROI). A few are listed below.

  1. Use checkpoints. You can run until the beginning of the ROI then take a checkpoint. In the future, you can just load that checkpoint.
  2. Fast-forward with a simpler CPU model (e.g., atomic or simple timing) then switch to a detailed CPU model when you reach the region of interest.
  3. Use the KVM CPU. If your native host machine uses the same ISA as the simulated system you can use the virtualization support in KVM to fast-forward gem5’s execution at native speeds. For instance, I can boot linux with 32 simulate cores in about 20 seconds with the KVM CPU.

IIRC, you can use up to 64 CPUs with gem5, the number may be different. You need to make sure to use a Linux kernel that is compiled to use that many CPUs, though.