aboutsummaryrefslogtreecommitdiff
path: root/measurements
diff options
context:
space:
mode:
authorGravatar Andres Erbsen <andreser@google.com>2017-11-16 12:03:11 -0500
committerGravatar Andres Erbsen <andreser@google.com>2017-11-16 12:03:11 -0500
commit0ee99a2cdb1a2189c210cadfac8de5810ce706e0 (patch)
tree730aa9b31e63c80bbd519fe30b22eb03416964d3 /measurements
parentdb529da384411d9f6f7c8e7ea60415b466233ec5 (diff)
android benchmarking script in new format
Diffstat (limited to 'measurements')
-rwxr-xr-xmeasurements/2017-11-16/bench-android.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/measurements/2017-11-16/bench-android.sh b/measurements/2017-11-16/bench-android.sh
new file mode 100755
index 000000000..f644ce49f
--- /dev/null
+++ b/measurements/2017-11-16/bench-android.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+set -e
+export PATH="$PATH:$HOME/android-toolchain/bin/"
+for p in $(cat primes.txt | sed 's:#.*::g' | grep . | tr -d ' ' | tr '^*+-' 'expm'); do
+ for synth in solinas32 montgomery32; do
+ impls=$(ls -d "src/Specific/${synth}_${p}_"*"limbs" 2>/dev/null || true)
+ if [ -z "$impls" ]; then
+ printf "# MISSING src/Specific/%s_%s_*limbs\n" "$synth" "$p";
+ continue
+ fi
+ for impl in $impls; do
+ if ! sh -c "arm-linux-androideabi-gcc -pie \
+ $(tail -1 "$impl/compiler.sh" | tr ' ' '\n' | grep -A99999 -- -D | grep -v '"$@"' | tr '\n' ' ') \
+ -I \"$impl\" \
+ -std=gnu11 -O3 -flto -fomit-frame-pointer -fwrapv -Wno-attributes -fno-strict-aliasing \
+ src/Specific/Framework/bench/fibe.c \
+ -o /tmp/main" \
+ > /dev/null 2> /dev/null
+ then
+ printf "# MISSING %s\n" "$impl/fibe"
+ continue
+ fi
+ adb push /tmp/main /data/local/tmp/main >/dev/null 2>/dev/null
+ printf "$impl/fibe"
+ adb shell "time /data/local/tmp/main 2>/dev/null" | sed 's:0m::g' | sed 's:s\sreal.*::g'
+ done
+ done
+ for ref in gmpvar gmpsec; do
+ impl=$(ls -d "src/Specific/montgomery32_$p"* 2>/dev/null || true)
+ if ! sh -c "arm-linux-androideabi-gcc -pie \
+ $(tail -1 "$impl/compiler.sh" | tr ' ' '\n' | grep -A99999 -- -D | grep -v '"$@"' | tr '\n' ' ') \
+ -I \"$impl\" \
+ -I ~/android-toolchain/gmp-6.1.2/ \
+ -std=gnu11 -O3 -flto -fomit-frame-pointer -fwrapv -Wno-attributes -fno-strict-aliasing \
+ src/Specific/Framework/bench/$ref.c \
+ $HOME/android-toolchain/gmp-6.1.2/.libs/libgmp.a \
+ -o /tmp/main" \
+ > /dev/null 2> /dev/null
+ then
+ printf "# MISSING %s\n" "$impl/$ref"
+ continue
+ fi
+ adb push /tmp/main /data/local/tmp/main >/dev/null 2>/dev/null
+ printf "$impl/$ref"
+ adb shell "time /data/local/tmp/main 2>/dev/null" | sed 's:0m::g' | sed 's:s\sreal.*::g'
+ done
+done
+