#!/bin/bash
if [ $# -lt 1 ]; then
    echo "Usage: bash $0 STRING_STEPS"
    exit 1
fi

REPEAT=4
FILE=bench.txt
dx=`echo "1/$1" | bc -l`
args="sinus 10000 1 $dx 1 2"

# Execute sequential program
/usr/bin/time -f "1 %e" -o $FILE ./seq $args
for i in `seq 2 $REPEAT`; do
    /usr/bin/time -f "1 %e" -ao $FILE ./seq $args
done

# Execute parallel program for different numbers of nodes
for i in `seq 2 13`; do
    for j in `seq $REPEAT`; do
        /usr/bin/time -f "$i %e" -ao $FILE ./par.sh $i $args
    done
done
