Skip to content

Commit

Permalink
Merge branch 'main' of github.com:QuState/PhastFT
Browse files Browse the repository at this point in the history
  • Loading branch information
smu160 committed Feb 3, 2024
2 parents d81db7e + 1a37997 commit 39668a4
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions benches/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,31 @@

set -Eeuo pipefail

if [[ "$#" -ne 3 ]]
if [[ "$#" -ne 2 ]]
then
echo "Usage: $0 <n-lower-bound> <n-upper-bound> <iters>"
exit 1
echo "Usage: $0 <n-lower-bound> <n-upper-bound>"
exit 1
fi

start=$1
end=$2
iters=$3
max_iters=1000 # Set your desired maximum number of iterations

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}..." && \
# clamp to `max_iters`
iters=$((2**($end - $n)))
iters=$((iters > max_iters ? max_iters : iters))
echo "Running FFTW3 benchmark for N = 2^${n} for ${iters} iterations..."

for _ in $(seq 1 "$iters"); do
./bench_fftw "${n}" >> "${OUTPUT_DIR}"/fftw3/size_"${n}"
./bench_fftw "${n}" >> "${OUTPUT_DIR}/fftw3/size_${n}"
done
done
}
Expand All @@ -30,7 +35,10 @@ benchmark_phastft() {
cargo clean && cargo build --release --examples

for n in $(seq "$start" "$end"); do
echo "Running PhastFT benchmark for N = 2^${n}..." && \
iters=$((2**($end - $n)))
iters=$((iters > max_iters ? max_iters : iters))
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 @@ -41,7 +49,10 @@ benchmark_rustfft() {
cargo clean && cargo build --release --examples

for n in $(seq "$start" "$end"); do
echo "Running RustFFT benchmark for N = 2^${n}..." && \
iters=$((2**($end - $n)))
iters=$((iters > max_iters ? max_iters : iters))
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
Expand Down

0 comments on commit 39668a4

Please sign in to comment.