Simulator#

The Simulator provides a bit-accurate / approximately timed model for MXAs. It is built using SystemC and models the chip’s arithmetic operations / finite-state machines (FSM) to simulate chip performance accurately. After loading a Dataflow Program, the Simulator consumes provided input feature maps, runs inference, and produces output feature maps. It will also measure the estimated FPS and latency of the accelerator. After installing the SDK, the Simulator CLI can be run using mx_sim.

mx_sim -h
  usage: mix_sim [-h] [-v] [-d] [-f] [--no_progress_bar] [--sim_directory] [--keep_rundir]

Usage#

The Simulator requires a compiled DFP, which is generated by the Neural Compiler. For a quick start using the neural compiler and Simulator, please refer to Hello, Mobilenet!.

Arguments#

Option

Description

-h, --help

show this help message and exit

-v, --verbose

set the level of verbose messaging

-d, --dfp

select which .dfp file to use (default: model.dfp)

-f, --frames

Set the number of frames to run (default: 1)

--no_progress_bar

Suppress progress bar display.

--sim_directory

Path to Simulator working directory (default: ./simdir)

--keep_rundir

Leave the Simulator working directory.

Note

  • The Simulator will use the number of chips specified while compiling the DFP.

  • If a DFP file is not specified, mx_sim will default to use model.dfp in the current running directory.

Simulate with random input data#

You can get a quick estimate of the FPS and latency of your model by letting the Simulator use randomly generated data (of the correct size) to run inference. This saves you the hassle of generating feature maps for the Simulator to consume.

You will need to run at least four frames through the Simulator to get an estimate for FPS, while one frame is sufficient to estimate the latency. This can be done as shown in the following example:

mx_sim -v -d model.dfp -f 4

Note

Generally, the Neural Compiler will generate a .dfp file using the original model name (e.g. mobilenetv1.dfp).

Simulate with real input data#

Currently, to simulate using real images or video streams, refer to the Simulator API and the classification tutorial.