diff --git a/runtime/experiments/applications/ekf/README.md b/runtime/experiments/applications/ekf/README.md index 10c2652..20079c5 100644 --- a/runtime/experiments/applications/ekf/README.md +++ b/runtime/experiments/applications/ekf/README.md @@ -1,3 +1,9 @@ # EKF -TODO +Executes TinyEKF as shows by [You Chong's GPS example](http://www.mathworks.com/matlabcentral/fileexchange/31487-extended-kalman-filter-ekf--for-gps) + +In order to be compatible with the stdin/stdout model of serverless, the input and output files are binary concatenations of various C structs. + +See `main()` in `runtime/tests/TinyEKF/extras/c/gps_ekf_fn.c` for specifics. + +This test executes multiple iterations, comparing the binary result against a known memoized result stored at `expected_result.dat`. diff --git a/runtime/experiments/applications/ekf/result.dat b/runtime/experiments/applications/ekf/expected_result.dat similarity index 100% rename from runtime/experiments/applications/ekf/result.dat rename to runtime/experiments/applications/ekf/expected_result.dat diff --git a/runtime/experiments/applications/ekf/run.sh b/runtime/experiments/applications/ekf/run.sh index 1feb93e..dde0d66 100755 --- a/runtime/experiments/applications/ekf/run.sh +++ b/runtime/experiments/applications/ekf/run.sh @@ -20,34 +20,18 @@ else echo "Running under gdb" fi -# expected_result="$(cat ./expected_result.jpg)" -# expected_size="$(find expected_result.jpg -printf "%s")" +expected_result="$(tr -d '\0' <./expected_result.dat)" + success_count=0 total_count=50 -curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@ekf_raw.dat" --output "result.dat" localhost:10000 -# ab -c 1 -n 10000 -p ekf_raw.dat -T "application/octet-stream" - -# WIP -exit - for ((i = 0; i < total_count; i++)); do echo "$i" - ext="$RANDOM" - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@flower.jpg" --output "result_$ext.jpg" localhost:10000 2>/dev/null - actual_size="$(find result_"$ext".jpg -printf "%s")" - - # echo "$result" - if [[ "$expected_size" == "$actual_size" ]]; then + result="$(curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@ekf_raw.dat" localhost:10000 2>/dev/null | tr -d '\0')" + if [[ "$expected_result" == "$result" ]]; then success_count=$((success_count + 1)) - rm result.jpg else echo "FAIL" - echo "Expected Size:" - echo "$expected_size" - echo "===============================================" - echo "Actual Size:" - echo "$actual_size" fi done @@ -56,7 +40,6 @@ echo "$success_count / $total_count" if [ "$1" != "-d" ]; then sleep 5 echo -n "Running Cleanup: " - rm result_*.jpg pkill sledgert >/dev/null 2>/dev/null echo "[DONE]" fi