Skip to content

Commit a240987

Browse files
Added new benchmark
1 parent 17faba7 commit a240987

File tree

8 files changed

+132
-17
lines changed

8 files changed

+132
-17
lines changed

.github/workflows/benchmarks.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ jobs:
2929
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3030
pip install -e .
3131
32-
- name: Run benchmark script
32+
- name: Run benchmark script Mouse.PacBio_1_perwidth
3333
working-directory: benchmarks
34-
run: bash run_Mouse.PacBio_1_perwidth.sh results-docs 120
34+
run: bash run_Mouse.PacBio_1_perwidth.sh results-docs 180
35+
36+
- name: Run benchmark script SRR020730
37+
working-directory: benchmarks
38+
run: bash run_SRR020730.sh results-docs 180
3539

3640
- name: Commit benchmark results
3741
run: |
@@ -40,7 +44,26 @@ jobs:
4044
git add benchmarks/results-docs/Mouse.PacBio_reads_1_perwidth.flow_corrected.grp.md
4145
git diff --staged --quiet || git commit -m "Update benchmark results [skip ci]"
4246
git push
43-
47+
48+
- name: Trigger documentation workflow
49+
uses: actions/github-script@v7
50+
with:
51+
script: |
52+
await github.rest.actions.createWorkflowDispatch({
53+
owner: context.repo.owner,
54+
repo: context.repo.repo,
55+
workflow_id: 'docs.yml',
56+
ref: 'main'
57+
})
58+
59+
- name: Commit benchmark results
60+
run: |
61+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
62+
git config --local user.name "github-actions[bot]"
63+
git add benchmarks/results-docs/SRR020730.md
64+
git diff --staged --quiet || git commit -m "Update benchmark results [skip ci]"
65+
git push
66+
4467
- name: Trigger documentation workflow
4568
uses: actions/github-script@v7
4669
with:

benchmarks/BENCHMARK_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.7
1+
1.0.8

benchmarks/aggregate_results.py

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,32 @@ def _compute_speedup_stats(
181181

182182
return dict(speedups_by_interval)
183183

184+
def load_from_file(self, file_path: str) -> Tuple[str, str, List[BenchmarkResult]]:
185+
"""
186+
Load results from a specific JSON file.
187+
188+
Parameters
189+
----------
190+
file_path : str
191+
Path to the results JSON file
192+
193+
Returns
194+
-------
195+
tuple
196+
(model_name, dataset_name, list of BenchmarkResult)
197+
"""
198+
path = Path(file_path)
199+
if not path.exists():
200+
raise FileNotFoundError(f"Results file not found: {file_path}")
201+
202+
with open(path, 'r') as f:
203+
data = json.load(f)
204+
205+
model_name = data['model']
206+
dataset_name = data['dataset']
207+
results = [BenchmarkResult.from_dict(r) for r in data['results']]
208+
return model_name, dataset_name, results
209+
184210
def load_model_results(self, model_name: str) -> Dict[str, List[BenchmarkResult]]:
185211
"""
186212
Load all results for a specific model across all datasets.
@@ -755,7 +781,13 @@ def main():
755781

756782
parser.add_argument(
757783
'model',
758-
help='Model name (e.g., MinFlowDecomp)'
784+
nargs='?',
785+
help='Model name (e.g., MinFlowDecomp). Required unless --results-file is given.'
786+
)
787+
parser.add_argument(
788+
'--results-file',
789+
help='Path to a specific results JSON file. When provided, a table is generated '
790+
'from that file only and --results-dir / model are ignored.'
759791
)
760792
parser.add_argument(
761793
'--results-dir',
@@ -789,10 +821,20 @@ def main():
789821

790822
# Load results
791823
aggregator = ResultsAggregator(args.results_dir)
792-
results_by_dataset = aggregator.load_model_results(args.model)
824+
825+
if args.results_file:
826+
# Load from a specific JSON file
827+
model_name, dataset_name, results = aggregator.load_from_file(args.results_file)
828+
results_by_dataset = {dataset_name: results}
829+
effective_model = model_name
830+
else:
831+
if not args.model:
832+
parser.error("model is required when --results-file is not provided")
833+
results_by_dataset = aggregator.load_model_results(args.model)
834+
effective_model = args.model
793835

794836
if not results_by_dataset:
795-
print(f"No results found for model: {args.model}")
837+
print(f"No results found")
796838
return
797839

798840
# Generate output
@@ -801,17 +843,17 @@ def main():
801843
for dataset_name, results in sorted(results_by_dataset.items()):
802844
if args.format == 'markdown':
803845
table = aggregator.generate_markdown_table(
804-
args.model, dataset_name, results, args.interval_size, args.metric
846+
effective_model, dataset_name, results, args.interval_size, args.metric
805847
)
806848
output_lines.append(table)
807849
elif args.format == 'latex':
808850
table = aggregator.generate_latex_table(
809-
args.model, dataset_name, results, args.interval_size, args.metric
851+
effective_model, dataset_name, results, args.interval_size, args.metric
810852
)
811853
output_lines.append(table)
812854
else: # console
813855
aggregator.print_console_table(
814-
args.model, dataset_name, results, args.interval_size, args.metric
856+
effective_model, dataset_name, results, args.interval_size, args.metric
815857
)
816858

817859
# Write to file if specified, or default to results directory
@@ -823,7 +865,7 @@ def main():
823865
output_dir = Path(args.results_dir)
824866
output_dir.mkdir(exist_ok=True)
825867
ext = 'md' if args.format == 'markdown' else 'tex'
826-
output_path = output_dir / f"{args.model}.{ext}"
868+
output_path = output_dir / f"{effective_model}.{ext}"
827869

828870
if output_lines:
829871
# Make overwrite behavior explicit for generated markdown/latex exports.
Binary file not shown.

benchmarks/run_Mouse.PacBio_1_perwidth.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,23 @@ echo ""
2626
python benchmark_minflowdecomp.py \
2727
--datasets datasets/esa2025/Mouse.PacBio_reads_1_perwidth.flow_corrected.grp.gz \
2828
--min-width 1 \
29-
--max-width 9 \
29+
--max-width 6 \
3030
--time-limit "$TIME_LIMIT"
3131

3232
echo ""
3333
echo "Step 2: Viewing results in console"
3434
echo ""
3535

3636
# Display results in console
37-
python aggregate_results.py MinFlowDecomp
37+
python aggregate_results.py --results-file "results/MinFlowDecomp_Mouse.PacBio_reads_1_perwidth.flow_corrected.json"
3838

3939
echo ""
4040
echo "Step 3: Generating markdown table"
4141
echo ""
4242

4343
# Generate markdown table
44-
python aggregate_results.py MinFlowDecomp \
44+
python aggregate_results.py \
45+
--results-file "results/MinFlowDecomp_Mouse.PacBio_reads_1_perwidth.flow_corrected.json" \
4546
--format markdown \
4647
--output "$OUTPUT_DIR/Mouse.PacBio_reads_1_perwidth.flow_corrected.grp.md" \
4748
--metric mean

benchmarks/run_Mouse.PacBio_5_perwidth.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ echo "Step 2: Viewing results in console"
2828
echo ""
2929

3030
# Display results in console
31-
python aggregate_results.py MinFlowDecomp
31+
python aggregate_results.py --results-file "results/MinFlowDecomp_Mouse.PacBio_reads_5_perwidth.flow_corrected.json"
3232

3333
echo ""
3434
echo "Step 3: Generating markdown table"
3535
echo ""
3636

3737
# Generate markdown table
38-
python aggregate_results.py MinFlowDecomp \
38+
python aggregate_results.py \
39+
--results-file "results/MinFlowDecomp_Mouse.PacBio_reads_5_perwidth.flow_corrected.json" \
3940
--format markdown \
4041
--output results/Mouse.PacBio_reads_5_perwidth.flow_corrected.grp.md \
4142
--metric mean

benchmarks/run_SRR020730.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
# Example script showing how to run the benchmark suite
4+
# This demonstrates a complete workflow from running benchmarks to generating tables
5+
6+
echo "=================================="
7+
echo "Flowpaths Benchmark Suite Example"
8+
echo "=================================="
9+
echo ""
10+
11+
# Navigate to benchmarks directory
12+
cd "$(dirname "$0")"
13+
14+
# Get output directory from parameter or use default
15+
OUTPUT_DIR="${1:-results}"
16+
# Get benchmark time limit (seconds) from parameter or use default
17+
TIME_LIMIT="${2:-300}"
18+
19+
# Create results directory if it doesn't exist
20+
mkdir -p "$OUTPUT_DIR"
21+
22+
echo "Step 1: Running MinFlowDecomp benchmark on small dataset"
23+
echo ""
24+
25+
# Run benchmark on the small dataset
26+
python benchmark_minflowdecomp.py \
27+
--datasets datasets/catfish-data/rnaseq/salmon/sparse_quant_SRR020730.graph.gz \
28+
--time-limit "$TIME_LIMIT"
29+
30+
echo ""
31+
echo "Step 2: Viewing results in console"
32+
echo ""
33+
34+
# Display results in console
35+
python aggregate_results.py --results-file "results/MinFlowDecomp_sparse_quant_SRR020730.json"
36+
37+
echo ""
38+
echo "Step 3: Generating markdown table"
39+
echo ""
40+
41+
# Generate markdown table
42+
python aggregate_results.py \
43+
--results-file "results/MinFlowDecomp_sparse_quant_SRR020730.json" \
44+
--format markdown \
45+
--output "$OUTPUT_DIR/sparse_quant_SRR020730.md" \
46+
--metric mean

docs/benchmarks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ hide:
77

88
This page shows the latest benchmark results for the MinFlowDecomp solver on small test datasets.
99

10-
--8<-- "benchmarks/results-docs/Mouse.PacBio_reads_1_perwidth.flow_corrected.grp.md"
10+
--8<-- "benchmarks/results-docs/Mouse.PacBio_reads_1_perwidth.flow_corrected.grp.md"
11+
12+
--8<-- "benchmarks/results-docs/SRR020730.md"

0 commit comments

Comments
 (0)