Benchmark will only run on non-existent files to allow for the job to be discontinued.

This commit is contained in:
mmcwilliams 2020-05-23 11:58:41 -04:00
parent 8ca9992d48
commit 6d54a99960
1 changed files with 39 additions and 26 deletions

View File

@ -11,7 +11,11 @@ COMPLETE=( 40 60 )
mkdir -p benchmark mkdir -p benchmark
if test -f "${NOTES}"; then
echo "Benchmark file exists"
else
echo "version,cpu,date,source,diameter,rotations,fn,size,facets,volume,time" > $NOTES echo "version,cpu,date,source,diameter,rotations,fn,size,facets,volume,time" > $NOTES
fi
for SPIRAL in ./spiral/*.scad for SPIRAL in ./spiral/*.scad
do do
@ -26,12 +30,17 @@ do
echo "Rendering ${SPIRAL} for ${ROT} rotations @ ${D}mm" echo "Rendering ${SPIRAL} for ${ROT} rotations @ ${D}mm"
#TMP=`mktemp` #TMP=`mktemp`
TMP="benchmark/${FILENAME}_${D}_${ROT}_100" TMP="benchmark/${FILENAME}_${D}_${ROT}_100"
if test -f "${TMP}.stl"; then
echo "Benchmark for ${TMP} exists"
else
start=`date +%s` start=`date +%s`
openscad -o "${TMP}.stl" -D N=${ROT} -D D=${D} -D FN=100 "${SPIRAL}" openscad -o "${TMP}.stl" -D N=${ROT} -D D=${D} -D FN=100 "${SPIRAL}"
end=`date +%s` end=`date +%s`
runtime=$((end-start)) runtime=$((end-start))
size=`wc -c < "${TMP}.stl"` size=`wc -c < "${TMP}.stl"`
size=`echo $size | xargs` size=`echo $size | xargs`
ao=`admesh -c "${TMP}.stl"` ao=`admesh -c "${TMP}.stl"`
facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'` facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'`
volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'` volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'`
@ -39,7 +48,7 @@ do
line="${VERSION},${CPU},${DATE},${FILENAME},${D},${ROT},100,$size,$facets,$volume,$runtime" line="${VERSION},${CPU},${DATE},${FILENAME},${D},${ROT},100,$size,$facets,$volume,$runtime"
echo $line echo $line
echo $line >> $NOTES echo $line >> $NOTES
fi
#rm "${TMP}.stl" #rm "${TMP}.stl"
done done
done done
@ -50,20 +59,24 @@ do
echo "Rendering complete ${SPIRAL} with ${C} rotations" echo "Rendering complete ${SPIRAL} with ${C} rotations"
#TMP=`mktemp` #TMP=`mktemp`
TMP="benchmark/${FILENAME}_${D}_${ROT}_100" TMP="benchmark/${FILENAME}_${D}_${ROT}_100"
if test -f "${TMP}.stl"; then
echo "Benchmark for ${TMP} exists"
else
start=`date +%s` start=`date +%s`
echo -o "${TMP}.stl" -D N=${C} -D D=47 "${SPIRAL}" openscad -o "${TMP}.stl" -D N=${C} -D D=47 -D FN=100 "${SPIRAL}"
end=`date +%s` end=`date +%s`
runtime=$((end-start)) runtime=$((end-start))
size=`wc -c < "${TMP}.stl"` size=`wc -c < "${TMP}.stl"`
size=`echo $size | xargs` size=`echo $size | xargs`
ao=`admesh -c "${TMP}.stl"` ao=`admesh -c "${TMP}.stl"`
facets=`echo $ao | grep "Number of facets" | awk '{print $5}'` facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'`
volume=`echo $ao | grep "Number of parts" | awk '{print $8}'` volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'`
line="${VERSION},${CPU},${DATE},${FILENAME},${D},${ROT},100,$size,$facets,$volume,$runtime" line="${VERSION},${CPU},${DATE},${FILENAME},${D},${ROT},100,$size,$facets,$volume,$runtime"
#echo $line >> $NOTES echo $line >> $NOTES
echo $line echo $line
#rm "${TMP}.stl" #rm "${TMP}.stl"
fi
done done
done done