2014-11-19 16:01:28 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# set -x
|
|
|
|
|
2014-11-20 15:36:04 +01:00
|
|
|
. ./variables.sh
|
2014-11-19 16:01:28 +01:00
|
|
|
|
2022-02-19 16:13:42 +01:00
|
|
|
exit_code=0
|
|
|
|
$vips im_benchmarkn || exit_code=$?
|
|
|
|
if [ $exit_code -ne 0 ]; then
|
|
|
|
echo "im_benchmark is not available, skipping test"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2014-11-19 16:01:28 +01:00
|
|
|
chain=1
|
|
|
|
|
|
|
|
# im_benchmark needs a labq
|
2016-05-09 00:48:37 +02:00
|
|
|
$vips colourspace $image $tmp/t3.v labq
|
2014-11-19 16:01:28 +01:00
|
|
|
|
|
|
|
for tile in 10 64 128 512; do
|
|
|
|
# benchmark includes a dither which will vary with tile size
|
2016-05-09 00:48:37 +02:00
|
|
|
$vips --vips-concurrency=1 \
|
2014-11-19 16:01:28 +01:00
|
|
|
--vips-tile-width=$tile --vips-tile-height=$tile \
|
|
|
|
im_benchmarkn $tmp/t3.v $tmp/t5.v $chain
|
|
|
|
|
2015-12-18 10:11:15 +01:00
|
|
|
for cpus in 2 3 4 5 6 7 8 99; do
|
2014-11-19 16:01:28 +01:00
|
|
|
echo trying cpus = $cpus, tile = $tile ...
|
2016-05-09 00:48:37 +02:00
|
|
|
$vips --vips-concurrency=$cpus \
|
2014-11-19 16:01:28 +01:00
|
|
|
--vips-tile-width=$tile --vips-tile-height=$tile \
|
|
|
|
im_benchmarkn $tmp/t3.v $tmp/t7.v $chain
|
2016-05-09 00:48:37 +02:00
|
|
|
$vips subtract $tmp/t5.v $tmp/t7.v $tmp/t8.v
|
|
|
|
$vips abs $tmp/t8.v $tmp/t9.v
|
|
|
|
max=$($vips max $tmp/t9.v)
|
2015-04-14 12:14:25 +02:00
|
|
|
if [ $(echo "$max > 0" | bc) -eq 1 ]; then
|
2014-11-19 16:01:28 +01:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2015-04-14 12:14:25 +02:00
|
|
|
if [ $(echo "$max > 0" | bc) -eq 1 ]; then
|
2014-11-19 16:01:28 +01:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2015-04-14 12:14:25 +02:00
|
|
|
if [ $(echo "$max > 0" | bc) -eq 1 ]; then
|
2014-11-19 16:01:28 +01:00
|
|
|
echo error, max == $max
|
|
|
|
exit 1
|
|
|
|
else
|
2022-10-26 16:25:19 +02:00
|
|
|
echo all benchmark threading tests passed
|
2014-11-19 16:01:28 +01:00
|
|
|
fi
|
|
|
|
|
2022-10-26 16:25:19 +02:00
|
|
|
# setting VIPS_MAX_THREADS low should force a small thread limit
|
|
|
|
echo -n "checking threadset size limit ... "
|
|
|
|
VIPS_MAX_THREADS=5 VIPS_CONCURRENCY=3 vips copy $image x.v || exit_code=$?
|
|
|
|
if [ $exit_code -ne 0 ]; then
|
|
|
|
echo FAILED
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo ok
|
|
|
|
|