Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,20 @@ python3 simpoint_cpt/compute_weighted.py \
python3 simpoint_cpt/compute_weighted.py \
-r results/example.csv \
-j simpoint_cpt/resources/spec06_rv64gcb_o2_20m.json \
--score results/example-score.csv # The SPEC score for each benchmark and overll score
--score results/example-score.csv # The SPEC score for each benchmark and overall score

```

## Quick Scoring for (Deterload + gem5) Results

Since there are naming differences between Deterload and the programs in this repository for benchmarks, the following script renames the simulation results obtained from (Deterload + gem5) by removing related prefixes (e.g., 400.perlbench -> perlbench).

Running this script will quickly rename the results and compute the scores.

```shell
bash example-scripts/gem5-deterload-score.sh $example_stats_dir $weighted.json $tag
```

## Analysis topdown performance

First, we need to get the topdown outputs for one tests
Expand Down
81 changes: 81 additions & 0 deletions example-scripts/gem5-deterload-score.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

# reference from: gem5-score-ci.sh
#
# deterload version: d2fc4767eb72d6922418003f013687e8d3d6349f
#
# Usage:
# bash example-scripts/gem5-score-ci.sh <example_stats_dir> <json_path> <tag>
# example_stats_dir: the top dir of stats
# json_path: weight json file generated by deterload
# tag: user interesting tag

ulimit -n 4096


example_stats_dir=$1
json_path=$2
json_modified=weight-modified.json
tag=$3

# Function to rename stat directories
rename_statdir() {
local TARGET_DIR="$1"

# Check if the directory exists
if [ ! -d "$TARGET_DIR" ]; then
echo "Error: Directory $TARGET_DIR does not exist!"
return 1
fi

# Iterate through all subdirectories in the target directory
for dir in "$TARGET_DIR"/*; do
# Check if it's a directory
if [ -d "$dir" ]; then
# Get the directory name
local dirname
dirname=$(basename "$dir")

# Remove the numeric prefix (three digits + dot) and the "_checkpoint" suffix
local newname
newname=$(echo "$dirname" | sed -E 's/^[0-9]{3}\.//; s/_checkpoint$//')

# Ensure the new name is different and does not overwrite an existing directory
if [ "$dirname" != "$newname" ] && [ ! -e "$TARGET_DIR/$newname" ]; then
mv "$dir" "$TARGET_DIR/$newname"
echo "Renamed: $dirname -> $newname"
fi
fi
done
}

# Function to clean JSON keys by removing three-digit prefixes
clean_json_keys() {
local JSON_FILE="$1"

if [ ! -f "$JSON_FILE" ]; then
echo "Error: JSON file $JSON_FILE does not exist!"
return 1
fi

# Modify JSON file in place to remove three-digit prefixes followed by a dot
sed -E 's/"[0-9]{3}\./"/g' "$JSON_FILE" > $json_modified
}



# Create results directory if not exists
mkdir -p results

# Rename
rename_statdir $example_stats_dir
clean_json_keys $json_path

set -x

python3 batch.py -s "$example_stats_dir" -o "results/$tag.csv"

python3 simpoint_cpt/compute_weighted.py \
-r "results/$tag.csv" \
-j "$json_modified" \
--score "results/$tag-score.csv"