forked from haiwan/sledge
parent
1f2d2cea90
commit
b0a4f9f662
@ -0,0 +1,3 @@
|
|||||||
|
*res.dat
|
||||||
|
rt.log
|
||||||
|
log.csv
|
@ -0,0 +1,9 @@
|
|||||||
|
# EKF
|
||||||
|
|
||||||
|
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`.
|
@ -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
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,53 @@
|
|||||||
|
#!/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)
|
||||||
|
runtime_directory=$(cd ../../../.. && pwd)
|
||||||
|
binary_directory=$(cd "$runtime_directory"/bin && pwd)
|
||||||
|
log="$experiment_directory/log.csv"
|
||||||
|
|
||||||
|
# Copy data if not here
|
||||||
|
if [[ ! -f "./initial_state.dat" ]]; then
|
||||||
|
cp $runtime_directory/tests/TinyEKF/extras/c/ekf_raw.dat ./initial_state.dat
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" != "-d" ]; then
|
||||||
|
SLEDGE_SANDBOX_PERF_LOG=$log PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" >rt.log 2>&1 &
|
||||||
|
sleep 2
|
||||||
|
else
|
||||||
|
echo "Running under gdb"
|
||||||
|
fi
|
||||||
|
|
||||||
|
one_iteration_expected_result="$(tr -d '\0' <./one_iteration.dat)"
|
||||||
|
two_iterations_expected_result="$(tr -d '\0' <./two_iterations.dat)"
|
||||||
|
three_iterations_expected_result="$(tr -d '\0' <./three_iterations.dat)"
|
||||||
|
|
||||||
|
success_count=0
|
||||||
|
total_count=50
|
||||||
|
|
||||||
|
for ((i = 0; i < total_count; i++)); do
|
||||||
|
echo "$i"
|
||||||
|
curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@initial_state.dat" localhost:10000 2>/dev/null >./one_iteration_res.dat
|
||||||
|
curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@one_iteration_res.dat" localhost:10001 2>/dev/null >./two_iterations_res.dat
|
||||||
|
curl -H 'Expect:' -H "Content-Type: application/octet-stream" --data-binary "@two_iterations_res.dat" localhost:10002 2>/dev/null >./three_iterations_res.dat
|
||||||
|
if diff -s one_iteration_res.dat one_iteration.dat && diff -s two_iterations_res.dat two_iterations.dat && diff -s three_iterations_res.dat three_iterations.dat; then
|
||||||
|
success_count=$((success_count + 1))
|
||||||
|
else
|
||||||
|
echo "FAIL"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm *_res.dat
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$success_count / $total_count"
|
||||||
|
|
||||||
|
if [ "$1" != "-d" ]; then
|
||||||
|
sleep 5
|
||||||
|
echo -n "Running Cleanup: "
|
||||||
|
pkill sledgert >/dev/null 2>/dev/null
|
||||||
|
echo "[DONE]"
|
||||||
|
fi
|
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"active": "yes",
|
||||||
|
"name": "ekf_first_iter",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"active": "yes",
|
||||||
|
"name": "ekf_second_iter",
|
||||||
|
"path": "ekf_wasm.so",
|
||||||
|
"port": 10001,
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"active": "yes",
|
||||||
|
"name": "ekf_third_iter",
|
||||||
|
"path": "ekf_wasm.so",
|
||||||
|
"port": 10002,
|
||||||
|
"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"
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue