Skip to content

Commit afb2cc5

Browse files
committed
benchmark doc
1 parent 163ca91 commit afb2cc5

5 files changed

+18
-9
lines changed

docs/doc_benchmark.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ In case that the benchmark is not entirely completed, the user can obtain partia
132132
explained below.
133133

134134

135-
### Obtain partial results
136-
If the benchmark is not yet completed (still running or has some failed jobs, e.g. BrokenPipe Error due to multiprocessing in PIL image reading), the `results.csv` file containing the aggregated results will not be created.
135+
### Aggregate obtained partial results
136+
If the benchmark is not yet completed (still running or has some failed jobs, e.g. Out of Memory, BrokenPipe Error due to multiprocessing in PIL image reading), the `results.csv` file containing the aggregated results will not be created.
137+
137138
The user can then obtain the aggregated partial results with plots from the partially completed benchmark by running
138139
the following after cd into the DomainLab directory:
139140
```commandline
@@ -144,9 +145,9 @@ e.g. `./zoutput/benchmarks/demo_benchmark`, where `demo_benchmark` is a name def
144145

145146
Alternatively, one could use
146147
```examples
147-
cat ./zoutput/benchmarks/[name of the benchmark]/rule_results/*.csv > result.csv
148+
sh scripts/sh_benchmark_partial_agg.sh OUTPUT_DIR/rule_results
148149
```
149-
clean up the extra csv head generated and plot the csv using command below
150+
where rule_results is the subfolder that contains partially finished csv result files. This script will partially aggregate the csv files in a faster fashion, output latex table which summarizes the results named "output_table_perf.tex" (which also contains a text format table before the latex table), and at the end generate plots using the following functionality.
150151

151152
### Generate plots from .csv file
152153
If the benchmark is not completed, the `graphics` subdirectory might not be created. The user can then manually

scripts/generate_latex_table.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pandas as pd
66

77

8-
def gen_latex_table(raw_df, fname="table_perf.tex",
8+
def gen_latex_table(raw_df, fname="output_table_perf.tex",
99
group="method", str_perf="acc"):
1010
"""
1111
aggregate benchmark csv file to generate latex table
@@ -15,6 +15,8 @@ def gen_latex_table(raw_df, fname="table_perf.tex",
1515
str_table = df_result.to_string()
1616
print(str_table)
1717
with open(fname, 'w') as file:
18+
file.write(str_table)
19+
file.write("\n")
1820
file.write(latex_table)
1921

2022

scripts/merge_csvs.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/bin/bash
2+
# $1 should be a folder with only csv files
3+
# $2 is the output file name
24

35
# Define the directory containing the text files
46
directory=$1
57

68
# Define the output CSV file
7-
output_file="merged_data.csv"
9+
output_file="${2:-merged_data.csv}"
810

911
# Initialize the merged CSV file with the header from the first file
1012
find "$directory" -maxdepth 1 -type f -name "*.csv" | sort | head -1 | xargs head -n 1 > "$output_file"

scripts/sh_benchmark_partial_agg.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# $1 should be the rule_results folder which contains several csv files
2+
# $2 default to be merged_data.csv
3+
4+
file_na_merged_csv="${2:-merged_data.csv}"
5+
sh scripts/merge_csvs.sh $1 $file_na_merged_csv
6+
python scripts/generate_latex_table.py $file_na_merged_csv
7+
python main_out.py --gen_plots $file_na_merged_csv --outp_dir partial_agg_plots

scripts/sh_genplot.sh

-3
This file was deleted.

0 commit comments

Comments
 (0)