2020-05-22 23:00:32 +00:00
|
|
|
echo "Benchmarking GNAL spiral generation"
|
|
|
|
|
|
|
|
VERSION=`bash ./scripts/version.sh`
|
|
|
|
CPU=`bash ./scripts/cpu.sh`
|
|
|
|
DATE=`date -u +%s` #timestamp in seconds
|
|
|
|
NOTES="./notes/benchmark.csv"
|
|
|
|
|
2020-05-22 23:32:18 +00:00
|
|
|
ROTATIONS=( 1 2 5 10 20 )
|
|
|
|
DIAMETERS=( 47 225 300 )
|
2020-05-22 23:00:32 +00:00
|
|
|
COMPLETE=( 40 60 )
|
|
|
|
|
2020-05-22 23:09:02 +00:00
|
|
|
mkdir -p benchmark
|
|
|
|
|
2020-05-23 15:58:41 +00:00
|
|
|
if test -f "${NOTES}"; then
|
|
|
|
echo "Benchmark file exists"
|
|
|
|
else
|
|
|
|
echo "version,cpu,date,source,diameter,rotations,fn,size,facets,volume,time" > $NOTES
|
|
|
|
fi
|
2020-05-22 23:00:32 +00:00
|
|
|
|
|
|
|
for SPIRAL in ./spiral/*.scad
|
|
|
|
do
|
|
|
|
FILENAME=`basename ${SPIRAL}`
|
|
|
|
echo "Rendering ${SPIRAL}..."
|
|
|
|
for ROT in "${ROTATIONS[@]}"
|
|
|
|
do
|
|
|
|
:
|
|
|
|
for D in "${DIAMETERS[@]}"
|
|
|
|
do
|
|
|
|
:
|
|
|
|
echo "Rendering ${SPIRAL} for ${ROT} rotations @ ${D}mm"
|
2020-05-22 23:09:02 +00:00
|
|
|
#TMP=`mktemp`
|
|
|
|
TMP="benchmark/${FILENAME}_${D}_${ROT}_100"
|
2020-05-23 15:58:41 +00:00
|
|
|
if test -f "${TMP}.stl"; then
|
|
|
|
echo "Benchmark for ${TMP} exists"
|
|
|
|
else
|
|
|
|
start=`date +%s`
|
|
|
|
openscad -o "${TMP}.stl" -D N=${ROT} -D D=${D} -D FN=100 "${SPIRAL}"
|
|
|
|
end=`date +%s`
|
|
|
|
runtime=$((end-start))
|
2020-05-22 23:00:32 +00:00
|
|
|
|
2020-05-23 15:58:41 +00:00
|
|
|
size=`wc -c < "${TMP}.stl"`
|
|
|
|
size=`echo $size | xargs`
|
|
|
|
|
|
|
|
ao=`admesh -c "${TMP}.stl"`
|
|
|
|
facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'`
|
|
|
|
volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'`
|
2020-05-22 23:00:32 +00:00
|
|
|
|
2020-05-23 15:58:41 +00:00
|
|
|
line="${VERSION},${CPU},${DATE},${FILENAME},${D},${ROT},100,$size,$facets,$volume,$runtime"
|
|
|
|
echo $line
|
|
|
|
echo $line >> $NOTES
|
|
|
|
fi
|
2020-05-22 23:09:02 +00:00
|
|
|
#rm "${TMP}.stl"
|
2020-05-22 23:00:32 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for C in "${COMPLETE[@]}"
|
|
|
|
do
|
|
|
|
:
|
|
|
|
echo "Rendering complete ${SPIRAL} with ${C} rotations"
|
2020-05-22 23:09:02 +00:00
|
|
|
#TMP=`mktemp`
|
2020-05-23 20:58:01 +00:00
|
|
|
TMP="benchmark/${FILENAME}_47_${C}_100"
|
2020-05-23 15:58:41 +00:00
|
|
|
if test -f "${TMP}.stl"; then
|
|
|
|
echo "Benchmark for ${TMP} exists"
|
|
|
|
else
|
|
|
|
start=`date +%s`
|
|
|
|
openscad -o "${TMP}.stl" -D N=${C} -D D=47 -D FN=100 "${SPIRAL}"
|
|
|
|
end=`date +%s`
|
|
|
|
runtime=$((end-start))
|
|
|
|
size=`wc -c < "${TMP}.stl"`
|
|
|
|
size=`echo $size | xargs`
|
|
|
|
ao=`admesh -c "${TMP}.stl"`
|
|
|
|
facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'`
|
|
|
|
volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'`
|
2020-05-22 23:09:02 +00:00
|
|
|
|
2020-05-23 20:58:01 +00:00
|
|
|
line="${VERSION},${CPU},${DATE},${FILENAME},47,${C},100,$size,$facets,$volume,$runtime"
|
2020-05-23 15:58:41 +00:00
|
|
|
echo $line >> $NOTES
|
|
|
|
echo $line
|
2020-05-22 23:00:32 +00:00
|
|
|
|
2020-05-23 15:58:41 +00:00
|
|
|
#rm "${TMP}.stl"
|
|
|
|
fi
|
2020-05-22 23:00:32 +00:00
|
|
|
done
|
|
|
|
done
|