Skip to content

Commit

Permalink
Add fftw3 to benchmark script
Browse files Browse the repository at this point in the history
  • Loading branch information
smu160 committed Feb 2, 2024
1 parent d886c52 commit 7757bf0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions benches/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,22 @@ iters=$3
OUTPUT_DIR=benchmark-data.$(date +"%Y.%m.%d.%H-%M-%S")
mkdir -p "$OUTPUT_DIR"/fftw3 && mkdir "$OUTPUT_DIR"/rustfft && mkdir "$OUTPUT_DIR"/phastft

benchmark_fftw3() {
make clean && make

for n in $(seq "$start" "$end"); do
echo "Running FFTW3 benchmark for N = 2^${n}..." && \
for _ in $(seq 1 "$iters"); do
./bench_fftw "${n}" >> "${OUTPUT_DIR}"/fftw3/size_"${n}"
done
done
}

benchmark_phastft() {
cargo clean && cargo build --release --examples

for n in $(seq "$start" "$end"); do
echo "running PhastFT benchmark for N = 2^${n}" && \
echo "Running PhastFT benchmark for N = 2^${n}..." && \
for _ in $(seq 1 "$iters"); do
../target/release/examples/benchmark "${n}" >> "${OUTPUT_DIR}"/phastft/size_"${n}"
done
Expand All @@ -30,12 +41,13 @@ benchmark_rustfft() {
cargo clean && cargo build --release --examples

for n in $(seq "$start" "$end"); do
echo "running RustFFT benchmark for N = 2^${n}" && \
echo "Running RustFFT benchmark for N = 2^${n}..." && \
for _ in $(seq 1 "$iters"); do
../target/release/examples/rustfft "${n}" >> "${OUTPUT_DIR}"/rustfft/size_"${n}"
done
done
}

benchmark_fftw3
benchmark_phastft
benchmark_rustfft
benchmark_phastft
2 changes: 1 addition & 1 deletion benches/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ int main(int argc, char** argv) {
fftw_plan p = fftw_plan_dft_1d(N, in, in, FFTW_FORWARD, FFTW_ESTIMATE);
fftw_execute(p);
double toc = clock();

double elapsed = ((double)(toc - tic) / CLOCKS_PER_SEC) * 1000000;

printf("%f\n", elapsed);
fftw_free(in);
fftw_destroy_plan(p);
Expand Down

0 comments on commit 7757bf0

Please sign in to comment.