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

REPEAT=4
FILE=compare.txt

# Clear results file
echo "" > $FILE

# Execute parallel program for different numbers of nodes
for (( i = 5000; i <= 15000; i += 500 )); do
    dx=`echo "1/$i" | bc -l`
    args="sinus 10000 1 $dx 1 2"

    for j in `seq $REPEAT`; do
        echo $i >> $FILE
        /usr/bin/time -f "%e" -ao $FILE ./seq $args
        /usr/bin/time -f "%e" -ao $FILE ./par.sh $1 $args
    done
done
