Skip to content

Instantly share code, notes, and snippets.

@zoep
Created January 22, 2013 12:45
Show Gist options
  • Save zoep/4594383 to your computer and use it in GitHub Desktop.
Save zoep/4594383 to your computer and use it in GitHub Desktop.
Runs sequential and parallel versions. Finds speedup
#!/bin/bash
function speedup() {
serial=$1
parallel=$2
echo "${parallel} ${serial}" | awk '{printf "%.6f\n", $2/$1}'
}
path=.
#sequential version
seq_v=lu_tiled
#parallel versions
par_v={lu_tiled_par,lu_tiled_grp,lu_tiled_grp_single}
lines=2048
#output file
outfile=block_size
for block in 128
do
echo -en "#threads " > "$outfile"_"$block".out
eval echo $par_v >> "$outfile"_"$block".out
echo $block
seq=`($path/$seq_v $lines $block)`
seq_time=`echo $seq | awk '{print $3;}'`
for threads in 8
do
echo -en "${threads}\t" >> "$outfile"_"$block".out
for file in $(eval echo $par_v)
do
par=`$path/$file $lines $block $threads`
par_time=`echo $par | awk '{print $3;}'`
sp=$(speedup $seq_time $par_time)
echo -en "${sp} \t" >> "$outfile"_"$block".out
done
echo "" >> "$outfile"_"$block".out
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment