diff --git a/runtime/experiments/applications/ekf/.gitignore b/runtime/experiments/applications/ekf/.gitignore new file mode 100644 index 0000000..f66ff46 --- /dev/null +++ b/runtime/experiments/applications/ekf/.gitignore @@ -0,0 +1 @@ +result.dat diff --git a/runtime/experiments/applications/ekf/README.md b/runtime/experiments/applications/ekf/README.md new file mode 100644 index 0000000..10c2652 --- /dev/null +++ b/runtime/experiments/applications/ekf/README.md @@ -0,0 +1,3 @@ +# EKF + +TODO diff --git a/runtime/experiments/applications/ekf/debug.sh b/runtime/experiments/applications/ekf/debug.sh new file mode 100755 index 0000000..a561392 --- /dev/null +++ b/runtime/experiments/applications/ekf/debug.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Executes the runtime in GDB +# Substitutes the absolute path from the container with a path relatively derived from the location of this script +# This allows debugging outside of the Docker container +# Also disables pagination and stopping on SIGUSR1 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +export LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" +export PATH="$binary_directory:$PATH" + +gdb --eval-command="handle SIGUSR1 nostop" \ + --eval-command="handle SIGPIPE nostop" \ + --eval-command="set pagination off" \ + --eval-command="set substitute-path /sledge/runtime $project_directory" \ + --eval-command="run $experiment_directory/spec.json" \ + sledgert diff --git a/runtime/experiments/applications/ekf/ekf_raw.dat b/runtime/experiments/applications/ekf/ekf_raw.dat new file mode 100644 index 0000000..9a960e1 Binary files /dev/null and b/runtime/experiments/applications/ekf/ekf_raw.dat differ diff --git a/runtime/experiments/applications/ekf/result.dat b/runtime/experiments/applications/ekf/result.dat new file mode 100644 index 0000000..1229f11 Binary files /dev/null and b/runtime/experiments/applications/ekf/result.dat differ diff --git a/runtime/experiments/applications/ekf/run.sh b/runtime/experiments/applications/ekf/run.sh new file mode 100755 index 0000000..1feb93e --- /dev/null +++ b/runtime/experiments/applications/ekf/run.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# Executes the runtime in GDB +# Substitutes the absolute path from the container with a path relatively derived from the location of this script +# This allows debugging outside of the Docker container +# Also disables pagination and stopping on SIGUSR1 + +experiment_directory=$(pwd) +project_directory=$(cd ../../.. && pwd) +binary_directory=$(cd "$project_directory"/bin && pwd) + +# Copy data if not here +if [[ ! -f "./ekf_raw.dat" ]]; then + cp ../../../tests/TinyEKF/extras/c/ekf_raw.dat ./ekf_raw.dat +fi + +if [ "$1" != "-d" ]; then + PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & + sleep 1 +else + echo "Running under gdb" +fi + +# expected_result="$(cat ./expected_result.jpg)" +# expected_size="$(find expected_result.jpg -printf "%s")" +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 + 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 + +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 diff --git a/runtime/experiments/applications/ekf/spec.json b/runtime/experiments/applications/ekf/spec.json new file mode 100644 index 0000000..de317c7 --- /dev/null +++ b/runtime/experiments/applications/ekf/spec.json @@ -0,0 +1,14 @@ +{ + "active": "yes", + "name": "resize", + "path": "ekf_wasm.so", + "port": 10000, + "relative-deadline-us": 50000, + "argsize": 1, + "http-req-headers": [], + "http-req-content-type": "application/octet-stream", + "http-req-size": 1024000, + "http-resp-headers": [], + "http-resp-size": 1024000, + "http-resp-content-type": "application/octet-stream" +}