make
./scripts/run_benchmarks.sh 8 1
./scripts/analyze_latest.shThis builds the project, runs all main datasets (including LiveJournal), and generates analysis artifacts under results/analysis/.
make./triangle_counter <edge_list_file> [threads]Examples:
./triangle_counter data/sanity_edges.txt
./triangle_counter data/sanity_edges.txt 8-
src/main.cpp- Program entry point.
- Parses CLI args (
input_path, optionalthreads). - Prints architecture info, runs scalar baseline, then runs all optimized variants.
- Reports vertices, edges, triangle count, time, and speedup.
-
src/triangle_counter.hpp- Public API and shared data structures.
- Declares
Graph,Variant, preprocessing and counting function signatures.
-
src/triangle_counter.cpp- Graph loading and preprocessing:
- reads edge list,
- removes self-loops,
- removes duplicate undirected edges,
- builds degree-based ordering,
- builds oriented forward adjacency.
- Triangle counting kernels:
- scalar,
- SIMD intrinsics,
- OpenMP SIMD,
- OpenMP threading,
- hybrid variants.
- Graph loading and preprocessing:
-
src/arch_info.hpp- Architecture info struct and function declarations.
-
src/arch_info.cpp- Detects ISA/SIMD capability and machine core/thread topology.
- Prints architecture details used in experiments/report.
-
Makefile- Builds the
triangle_counterexecutable with OpenMP enabled.
- Builds the
-
scripts/run_benchmarks.sh- Runs datasets automatically.
- Decompresses
.txt.gzdatasets to temp text files. - Executes all variants and writes benchmark CSV under
results/.
-
scripts/analyze_latest.sh- Finds latest benchmark CSV and runs analysis.
-
scripts/analyze_results.py- Aggregates benchmark rows, computes best variant per dataset,
writes
aggregated_results.csvandsummary.md, and optionally plots PNGs.
- Aggregates benchmark rows, computes best variant per dataset,
writes
-
scripts/extract_datasets.sh- One-time extraction helper for all
.txt.gzdatasets.
- One-time extraction helper for all
-
scripts/create_submission_zip.sh- Creates submission staging folder/zip with strict assignment naming.
-
data/- Small sanity input(s) for quick correctness testing.
-
datasets/- Assignment datasets (
.txt.gzcompressed edge lists).
- Assignment datasets (
-
results/- Raw benchmark CSV outputs and analysis artifacts.
triangle_counterexpects a plain text edge list file as input.- Passing
.tar.gzor.gzdirectly totriangle_countercan produce invalid parsing or meaningless output. - Correct usage options:
- Decompress first, then pass the extracted
.txtfile totriangle_counter. - Or use
scripts/run_benchmarks.sh, which handles.txt.gzdecompression automatically.
- Decompress first, then pass the extracted
datasets/email-Eu-core.txt.gzdatasets/facebook_combined.txt.gzdatasets/com-lj.ungraph.txt.gz
(com-friendster.ungraph.txt.gz is intentionally not included due to size.)
Run all available assignment datasets and export a CSV:
./scripts/run_benchmarks.sh [threads] [include_large]threads: optional (default prefers detected physical cores; falls back tonproc)include_large: optional0/1; when1, also runscom-lj.ungraph.txt.gz
The output CSV is written under results/.
Optional one-time extraction of all .txt.gz files:
./scripts/extract_datasets.shAnalyze the latest benchmark CSV and generate report-ready artifacts:
./scripts/analyze_latest.shOr analyze a specific CSV:
python3 scripts/analyze_results.py results/benchmark_YYYYMMDD_HHMMSS.csv --out-dir results/analysisGenerated outputs:
results/analysis/aggregated_results.csvresults/analysis/summary.md- per-dataset PNG plots (if
matplotlibis installed)
- Plain text edge list with two vertex IDs per line.
- Lines starting with
#or%are treated as comments. - Self-loops are removed.
- Duplicate undirected edges are removed.
scalarsimd-intrinsicsopenmp-simdopenmp-threadshybrid-intrinsics-openmphybrid-openmp-simd-openmp
- Vertex ordering is degree-based (tie-break by vertex ID).
- Triangle counting uses oriented forward adjacency and counts each triangle exactly once.
- OpenMP thread count is controlled by CLI argument; if omitted, defaults to detected physical cores.
- Architecture awareness: ISA/SIMD width, vector lanes, physical cores, and hardware threads are printed at startup.
- Input preprocessing correctness: self-loops and duplicate undirected edges are removed.
- Duplicate triangle avoidance: degree-based vertex ordering with forward-oriented adjacency is used.
- Variant coverage: scalar baseline + all 5 required comparison variants are executed from one binary.
- Thread control: all OpenMP variants use explicit
omp_set_num_threads; benchmark script defaults to physical cores when not specified.
- Source code and build system:
src/,Makefile - Reproducibility scripts:
scripts/run_benchmarks.sh,scripts/analyze_latest.sh,scripts/analyze_results.py - Current experimental outputs:
results/andresults/analysis/