scarab-infra is a set of tools that automate the execution of Scarab simulations. It utilizes Docker and Slurm to effectively simulate applications according to the SimPoint methodology. Furthermore, scarab-infra provides tools to analyze generated simulation statistics and to obtain simpoints and execution traces from binary applications.
- Bootstrap the environment
./sci --init
This installs Docker when possible, configures socket permissions, installs Miniconda if needed, creates/updates the scarabinfra conda environment, validates activation, ensures you have an SSH key, and optionally fetches SimPoint traces, Slurm, ghcr.io credentials, and verifies AI CLI auth status (Codex/Gemini/Claude).
-
Prepare (or update) your descriptor
cp json/exp.json json/<descriptor>.json # edit json/<descriptor>.json to match your workloads, configs, and pathsEach descriptor specifies
root_dir,scarab_path, workloads, and build mode. Adjust these fields before building or running. When you modify Scarab source codes that matter to this descriptor, make sure that you are modifying the right Scarab repo residing inscarab_path. -
Build Scarab for your descriptor
./sci --build-scarab <descriptor>Provide the JSON filename (without extension) from
json/. The build runs inside the correct Docker image and respects thescarab_buildmode in the descriptor (defaults toopt). -
Run simulations
./sci --sim <descriptor>
Launches the simulations defined in json/<descriptor>.json. Scarab runs in parallel across simpoints and reports status/logs under <root_dir>/simulations/<descriptor>/ (with root_dir taken from the descriptor).
You only need additional steps if you want to inspect workloads, collect traces, or manage jobs manually. The sections below cover those workflows in more detail.
- Check status (queued/running jobs, logs, and errors):
./sci --status <descriptor> - Kill active simulations:
./sci --kill <descriptor> - Remove containers and temporary state:
./sci --clean <descriptor>
./sci --visualize <descriptor>
Generates bar charts (value and speedup) for each counter listed in visualize.counters and saves them next to collected_stats.csv under <root_dir>/simulations/<descriptor>/.
Use the descriptor structure:
"visualize": {
"baseline": "baseline",
"counters": ["IPC"]
}Each entry in visualize.counters can be either:
- a single counter name (e.g.
"IPC") to produce the existing bar and speedup plots, or - a list of multiple counters (e.g.
["BTB_OFF_PATH_MISS_count", "BTB_OFF_PATH_HIT_count"]) which will emit a stacked plot (*_stacked.png) combining those counters across workloads/configs.
For additional control you may instead supply objects such as:
{
"type": "stacked",
"name": "btb_miss_hit",
"title": "BTB Miss/Hit Breakdown",
"y_label": "Events",
"stats": ["BTB_OFF_PATH_MISS_count", "BTB_OFF_PATH_HIT_count"]
}The name (optional) governs the output filename stem, while title and y_label adjust plot annotations.
Set visualize.baseline to force the speedup plots to use a specific configuration as their reference (defaults to the first configuration present in the stats file).
./sci --perf-analyze <descriptor>
Diffs collected stats against a baseline configuration, writes a deterministic drift report, and optionally invokes an analyzer CLI (for example Codex, Gemini, or Claude) for root-cause hypotheses.
Use:
"perf_analyze": {
"baseline": "baseline",
"counters": ["IPC", "ICACHE_MISS", "BRANCH_MISPRED"],
"stat_groups": ["bp", "fetch", "core"],
"compare_all_stats": false,
"drift_top_workloads": 5,
"drift_top_simpoints": 5,
"prompt_budget_tokens": 12000,
"threshold_pct": 2.0,
"analyzer_cli_cmd": "codex"
}Notes:
perf_analyze.counters[0]is used as the trigger counter for drift detection.stat_groupsoptionally restricts compared stats to selected Scarab groups:bp,core,fetch,inst,l2l1pref,memory,power,pref,stream.- Set
compare_all_stats: trueto compare every stat present incollected_stats.csv;counters[0]remains the drift trigger. drift_top_workloadscontrols how many highest-drift workloads (by trigger counter abs delta) are expanded in the report/prompt.drift_top_simpointscontrols how many highest-impact simpoints per selected workload are expanded.prompt_budget_tokenslimits prompt size (approximate token budgeting) before invoking the analyzer CLI.threshold_pctis an absolute percent-delta threshold.analyzer_cli_cmdsupports{prompt_file},{summary_file}, and{report_file}placeholders. If{prompt_file}is omitted, the prompt path is appended as the last argument.- Example commands:
codex(auto-converted to non-interactivecodex exec -),codex exec -,gemini -p "@{prompt_file}",claude(auto-converted to non-interactiveclaude -pand prompt content over stdin). - During
./sci --init, Codex/Gemini/Claude checks are non-interactive: init only verifies whether each CLI is installed and logged in, then prints manual login instructions when needed. - Account-login commands:
- Codex:
codex loginthencodex login status - Gemini:
gemini, then/auth, thengemini auth status - Claude:
claude login(orclaudethen/login), thenclaude auth status
- Codex:
- If compared configurations use different Scarab binary hashes,
--perf-analyzerunsgit diffinscarab_pathand includes changed files/commit summaries in the report and AI prompt. - Outputs are written beside
collected_stats.csv:perf_diff_summary.json,perf_drift_report.md,perf_drift_prompt.md, and optionallyperf_ai_report.md.
./sci --list
Shows the workload group hierarchy and the docker image each mode uses.
Make sure to edit your json/.json to have scarab_build's value dbg, and rebuild it with ./sci --build-scarab <descriptor>
./sci --interactive <descriptor>
Then, go to the simulation directory under ~/simulations inside the container where it is mounted to the descriptor’s root_dir, for example
cd ~/simulations/<exp_name>/baseline/<workload>/<simpoint>
Create a debug directory and copy the original PARAMS.out file as a new PARAMS.in, then cut the lines following after --- Cut out everything below to use this file as PARAMS.in ---
mkdir debug && cd debug
cp ../PARAMS.out ./PARAMS.in
Now, you can attach gdb with the same scarab parameters where you want to debug.
gdb /scarab/src/scarab
Cached images and containers are handled automatically by the commands above; use ./sci --clean <descriptor> when you want to force a reset.
./sci --trace your_trace_descriptor
Uses json/<descriptor>.json with descriptor_type: "trace" to launch the trace pipeline (see docs/README.trace.md for details).
./sci --perf perf
Uses json/perf.json or another json/<descriptor>.json with descriptor_type: "perf" to open the interactive perf container described in the descriptor (see docs/README.perf.md).
./sci --build-scarab <descriptor> or ./sci --sim <descriptor> automatically pulls or rebuilds the docker image it needs, but these commands are handy when you want to inspect or pre-stage images manually.
export GIT_HASH=$(git rev-parse --short HEAD)
docker pull ghcr.io/litz-lab/scarab-infra/allbench_traces:$GIT_HASH
docker tag ghcr.io/litz-lab/scarab-infra/allbench_traces:$GIT_HASH allbench_traces:$GIT_HASH
./sci --build-image <workload_group>
Manual alternative:
export GIT_HASH=$(git rev-parse --short HEAD)
docker build . -f ./workloads/<workload_group>/Dockerfile --no-cache -t <workload_group>:$GIT_HASH
@inproceedings{oh2024udp,
author = {Oh, Surim and Xu, Mingsheng and Khan, Tanvir Ahmed and Kasikci, Baris and Litz, Heiner},
title = {UDP: Utility-Driven Fetch Directed Instruction Prefetching},
booktitle = {Proceedings of the 51st International Symposium on Computer Architecture (ISCA)},
series = {ISCA 2024},
year = {2024},
month = jun,
}
All of these checks are automated by
./sci --init; follow them manually only if you need to diagnose issues locally.
- Install Docker (docs).
- Configure the Docker socket for non-root use (ref):
sudo chmod 666 /var/run/docker.sock - Install Miniconda (or Anaconda) so you have a writable Conda installation (see the Miniconda docs).
./sci --initinstalls Miniconda to~/miniconda3if none is available. - Create or update the
scarabinfraConda environment fromquickstart_env.yaml:The helper keeps this environment in sync (includingconda env create --file quickstart_env.yamlgdownand other pip dependencies). - Activate or validate the environment as needed:
conda activate scarabinfra - Add an SSH key for the machine running Docker to your GitHub account (guide).
- Place SimPoint traces under
$trace_home(defaults to~/traces). A pre-packaged archive is available:cd ~/traces gdown https://drive.google.com/uc?id=1tfKL7wYK1mUqpCH8yPaPVvxk2UIAJrOX tar -xzvf simpoint_traces.tar.gz - Optional: Install Slurm if you plan to run simulations on a Slurm cluster.
- Optional: Log in to ghcr.io so you can pull prebuilt images (requires a token with
read:packages):echo <YOUR_GITHUB_TOKEN> | docker login ghcr.io -u <YOUR_GITHUB_USERNAME> --password-stdin