From cc4cc96cc310c1156431cffa4957468633153084 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 21 Apr 2021 18:07:11 +0000 Subject: [PATCH 01/35] feat: better test driver and more resilient tests --- runtime/Makefile | 2 +- .../applications/imageresize/test/run.sh | 2 +- .../applications/ocr/fivebyeight/run.sh | 16 ++ .../applications/ocr/handwriting/run.sh | 17 ++ .../experiments/applications/ocr/hyde/run.sh | 17 ++ test.sh | 240 ++++++++++++++---- 6 files changed, 241 insertions(+), 53 deletions(-) diff --git a/runtime/Makefile b/runtime/Makefile index 2d24542..de58895 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -108,7 +108,7 @@ CFILES += thirdparty/dist/lib/http_parser.o JSMNCFLAGS += -DJSMN_STATIC JSMNCFLAGS += -DJSMN_STRICT -all: clean runtime +all: runtime runtime: @echo "Compiling runtime" diff --git a/runtime/experiments/applications/imageresize/test/run.sh b/runtime/experiments/applications/imageresize/test/run.sh index 501f344..be2390f 100755 --- a/runtime/experiments/applications/imageresize/test/run.sh +++ b/runtime/experiments/applications/imageresize/test/run.sh @@ -16,7 +16,7 @@ fi if [ "$1" != "-d" ]; then PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & - sleep 1 + sleep 2 else echo "Running under gdb" fi diff --git a/runtime/experiments/applications/ocr/fivebyeight/run.sh b/runtime/experiments/applications/ocr/fivebyeight/run.sh index a97be2c..722ed7f 100755 --- a/runtime/experiments/applications/ocr/fivebyeight/run.sh +++ b/runtime/experiments/applications/ocr/fivebyeight/run.sh @@ -20,6 +20,22 @@ fi expected_result="$(cat ./expected_result.txt)" +# Retry 5 times in case the runtime startup is slow +retries=5 +for ((i = 0; i < retries; i++)); do + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@5x8.pnm" localhost:10000 2> /dev/null) + if [[ "$result" == "$expected_result" ]]; then + break + fi + + if ((i == 4)); then + echo "Retries exhaused" + exit 1 + fi + + sleep 1 +done + success_count=0 total_count=50 diff --git a/runtime/experiments/applications/ocr/handwriting/run.sh b/runtime/experiments/applications/ocr/handwriting/run.sh index bc29711..6a2fa00 100755 --- a/runtime/experiments/applications/ocr/handwriting/run.sh +++ b/runtime/experiments/applications/ocr/handwriting/run.sh @@ -19,6 +19,23 @@ else fi expected_result="$(cat ./expected_result.txt)" + +# Retry 5 times in case the runtime startup is slow +retries=5 +for ((i = 0; i < retries; i++)); do + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@handwrt1.pnm" localhost:10000 2> /dev/null) + if [[ "$result" == "$expected_result" ]]; then + break + fi + + if ((i == 4)); then + echo "Retries exhaused" + exit 1 + fi + + sleep 1 +done + success_count=0 total_count=50 diff --git a/runtime/experiments/applications/ocr/hyde/run.sh b/runtime/experiments/applications/ocr/hyde/run.sh index 67b7faa..a0c59b7 100755 --- a/runtime/experiments/applications/ocr/hyde/run.sh +++ b/runtime/experiments/applications/ocr/hyde/run.sh @@ -18,6 +18,23 @@ else fi expected_result="$(cat ./expected_result.txt)" + +# Retry 5 times in case the runtime startup is slow +retries=5 +for ((i = 0; i < retries; i++)); do + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@hyde.pnm" localhost:10000 2> /dev/null) + if [[ "$result" == "$expected_result" ]]; then + break + fi + + if ((i == 4)); then + echo "Retries exhaused" + exit 1 + fi + + sleep 1 +done + success_count=0 total_count=50 diff --git a/test.sh b/test.sh index 3418edb..a3f9d79 100755 --- a/test.sh +++ b/test.sh @@ -1,5 +1,6 @@ #!/bin/bash # Test Driver Script +# TODO: Consider refactoring into Make infrastructure if [[ $0 != "./test.sh" ]]; then echo "Must run in same directory as ./test.sh" @@ -8,62 +9,199 @@ fi base_dir=$(pwd) -# Awsm -cd "$base_dir/awsm" && cargo build --release || exit 1 +declare -ra tests=( + ocr_hyde + ocr_handwriting + ocr_fivebyeight + ocr_by_word + ocr_by_font + ocr_by_dpi + ekf_by_iteration + ekf_one_iteration + image_classification + image_resize + lpd_by_resolution + lpd_by_plate_count + bimodal + concurrency + payload +) -# Sledge -cd "$base_dir/runtime" && make clean all || exit 1 - -# OCR Build -# FIXME: gocr incorectly reports up to date -make clean gocr -B -C "$base_dir/runtime/tests" || exit 1 +declare -a failed_tests=() # OCR Tests -# FIXME: OCR tests seem to sporadically fail and then work on rerun. Don't bail on fail for now -# cd "$base_dir/runtime/experiments/applications/ocr/hyde" && ./run.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/ocr/handwriting" && ./run.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/ocr/fivebyeight" && ./run.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/ocr/by_word" && ./install.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/ocr/by_word" && ./run.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/ocr/by_font" && ./install.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/ocr/by_font" && ./run.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/ocr/by_dpi" && ./install.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/ocr/by_dpi" && ./run.sh || exit 1 -cd "$base_dir/runtime/experiments/applications/ocr/hyde" && ./run.sh -cd "$base_dir/runtime/experiments/applications/ocr/handwriting" && ./run.sh -cd "$base_dir/runtime/experiments/applications/ocr/fivebyeight" && ./run.sh -cd "$base_dir/runtime/experiments/applications/ocr/by_word" && ./install.sh -cd "$base_dir/runtime/experiments/applications/ocr/by_word" && ./run.sh -cd "$base_dir/runtime/experiments/applications/ocr/by_font" && ./install.sh -cd "$base_dir/runtime/experiments/applications/ocr/by_font" && ./run.sh -cd "$base_dir/runtime/experiments/applications/ocr/by_dpi" && ./install.sh -cd "$base_dir/runtime/experiments/applications/ocr/by_dpi" && ./run.sh - -# EKF Build -make clean tinyekf -B -C "$base_dir/runtime/tests" || exit 1 +# FIXME: OCR tests seem to sporadically fail and then work on rerun. +ocr_hyde() { + make gocr -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/ocr/hyde" || exit 1 + ./run.sh || failed_tests+=("ocr_hyde") + popd || exit 1 + return 0 +} + +ocr_handwriting() { + make gocr -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/ocr/handwriting" || exit 1 + ./run.sh || failed_tests+=("ocr_handwriting") + popd || exit 1 + return 0 +} + +ocr_fivebyeight() { + make gocr -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/ocr/fivebyeight" || exit 1 + ./run.sh || failed_tests+=("ocr_fivebyeight") + popd || exit 1 + return 0 +} + +ocr_by_word() { + make gocr -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/ocr/by_word" || exit 1 + ./install.sh || exit 1 + ./run.sh || failed_tests+=("ocr_by_word") + popd || exit 1 + return 0 +} + +ocr_by_font() { + make gocr -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/ocr/by_font" || exit 1 + ./install.sh || exit 1 + ./run.sh || failed_tests+=("ocr_by_font") + popd || exit 1 + return 0 +} + +ocr_by_dpi() { + make gocr -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/ocr/by_dpi" || exit 1 + ./install.sh || exit 1 + ./run.sh || failed_tests+=("ocr_by_dpi") + popd || exit 1 + return 0 +} # EKF Tests -cd "$base_dir/runtime/experiments/applications/ekf/by_iteration" && ./run.sh || exit 1 -cd "$base_dir/runtime/experiments/applications/ekf/one_iteration" && ./run.sh || exit 1 +ekf_by_iteration() { + make tinyekf -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/ekf/by_iteration" || exit 1 + ./run.sh || failed_tests+=("ocr_by_dpi") + popd || exit 1 + return 0 +} -# cifar10 Build -make clean cifar10 -B -C "$base_dir/runtime/tests" || exit 1 +ekf_one_iteration() { + make tinyekf -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/ekf/one_iteration" || exit 1 + ./run.sh || failed_tests+=("ekf_one_iteration") + popd || exit 1 + return 0 +} # cifar10 Tests -cd "$base_dir/runtime/experiments/applications/imageclassification" && ./run.sh || exit 1 - -# sod Build -make clean sod -B -C "$base_dir/runtime/tests" || exit 1 - -# sod Tests -# FIXME: sod sporadically fails. May be related to a file descriptor bug -# cd "$base_dir/runtime/experiments/applications/imageresize/test" && ./install.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/imageresize/test" && ./run.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" && ./install.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" && ./run.sh || exit 1 -# cd "$base_dir/runtime/experiments/applications/licenseplate/by_plate_count" && ./run.sh || exit 1 -cd "$base_dir/runtime/experiments/applications/imageresize/test" && ./install.sh -cd "$base_dir/runtime/experiments/applications/imageresize/test" && ./run.sh -cd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" && ./install.sh -cd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" && ./run.sh -cd "$base_dir/runtime/experiments/applications/licenseplate/by_plate_count" && ./run.sh +image_classification() { + make cifar10 -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/imageclassification" || exit 1 + ./run.sh || failed_tests+=("image_classification") + popd || exit 1 + return 0 +} + +image_resize() { + make sod -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/imageresize/test" || exit 1 + ./install.sh || exit 1 + ./run.sh || failed_tests+=("image_resize") + popd || exit 1 + return 0 +} + +lpd_by_resolution() { + # Disabled... Seems to be dumping raw image data + return 0 + make sod -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" || exit 1 + ./install.sh || exit 1 + ./run.sh || failed_tests+=("lpd_by_resolution") + popd || exit 1 + return 0 +} + +lpd_by_plate_count() { + # Disabled... Seems to be dumping raw image data + return 0 + make sod -C "$base_dir/runtime/tests" || exit 1 + pushd "$base_dir/runtime/experiments/applications/licenseplate/by_plate_count" || exit 1 + ./run.sh || failed_tests+=("lpd_by_plate_count") + popd || exit 1 + return 0 +} + +bimodal() { + echo "Bimodal" + # TODO: Make Dependency "fibonacci_wasm.so" + pushd "$base_dir/runtime/experiments/bimodal/" || exit 1 + ./run.sh || failed_tests+=("bimodal") + popd || exit 1 + return 0 +} + +concurrency() { + echo "Concurrency" + # TODO: Make Dependency "empty_wasm.so" + pushd "$base_dir/runtime/experiments/concurrency/" || exit 1 + ./run.sh || failed_tests+=("concurrency") + popd || exit 1 + return 0 +} + +payload() { + echo "Payload" + # TODO: Make Dependency "work1k_wasm.so" "work10k_wasm.so" "work100k_wasm.so" "work1m_wasm.so" + pushd "$base_dir/runtime/experiments/payload/" || exit 1 + ./run.sh || failed_tests+=("concurrency") + popd || exit 1 + return 0 +} + +main() { + cd "$base_dir/awsm" && cargo build --release || exit 1 + make all -C "$base_dir/runtime" || exit 1 + + # If no arguments are provided, run all tests + if (($# == 0)); then + for test in "${tests[@]}"; do + "$test" + done + + local -i failure_count=${#failed_tests[@]} + + if ((failure_count > 0)); then + printf "Failed Tests\n" + for test in "${failed_tests[@]}"; do + printf "\t%s\n" "$test" + done + exit 1 + fi + + exit 0 + fi + + # Otherwise, only run the tests passed as arguments + for test in "$@"; do + if [[ ! " ${tests[*]} " =~ " ${test} " ]]; then + printf "Error: %s is not a known test\n" "$test" + else + if "$test"; then + printf "%s: Pass\n" "$test" + else + printf "%s: Fail\n" "$test" + + fi + fi + + done +} + +main "$@" From 97df7292a7ec30b9e360562f5bbc8db1580793fb Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 21 Apr 2021 18:30:18 +0000 Subject: [PATCH 02/35] fix: correct Makefile build cachine issues --- runtime/experiments/applications/ocr/by_word/run.sh | 3 +++ runtime/tests/Makefile | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/runtime/experiments/applications/ocr/by_word/run.sh b/runtime/experiments/applications/ocr/by_word/run.sh index 9276b0a..ed0e7e6 100755 --- a/runtime/experiments/applications/ocr/by_word/run.sh +++ b/runtime/experiments/applications/ocr/by_word/run.sh @@ -37,6 +37,9 @@ for ((i = 0; i < total_count; i++)); do result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @"${word_count}"_words.pnm localhost:${word_count_to_port["$word_count"_words.pnm]} 2> /dev/null) + # If the OCR does not produce a guess, fail + [[ -z "$result" ]] && exit 1 + diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") echo "===============================================" done diff --git a/runtime/tests/Makefile b/runtime/tests/Makefile index 65edc8f..10e2465 100644 --- a/runtime/tests/Makefile +++ b/runtime/tests/Makefile @@ -4,7 +4,7 @@ TESTS=fibonacci empty work work1k work10k work100k work1m forever filesys sockse TESTSRT=$(TESTS:%=%_rt) -.PHONY: all clean rttests +.PHONY: all clean rttests tinyekf cifar10 gocr sod all: rttests tinyekf cifar10 gocr sod @echo "Compilation done!" @@ -16,15 +16,15 @@ clean: @rm -rf ${SLEDGE_BIN_DIR}/*_wasm.so tinyekf: - make clean gps_ekf_fn.so -C ./TinyEKF/extras/c/ -f wasm.mk + make gps_ekf_fn.so -C ./TinyEKF/extras/c/ -f wasm.mk cp ./TinyEKF/extras/c/gps_ekf_fn.so ${SLEDGE_BIN_DIR}/ekf_wasm.so cifar10: - make clean cifar10.so -C ./CMSIS_5_NN/ -f Makefile + make cifar10.so -C ./CMSIS_5_NN/ -f Makefile cp ./CMSIS_5_NN/cifar10.so ${SLEDGE_BIN_DIR}/cifar10_wasm.so gocr: - make clean gocr.so -C ./gocr/src/ -f wasm.mk + make gocr.so -C ./gocr/src/ -f wasm.mk cp ./gocr/src/gocr.so ${SLEDGE_BIN_DIR}/gocr_wasm.so sod: From 199449a2bca8764cfa253c921e6059e74433f8e5 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 01:39:00 +0000 Subject: [PATCH 03/35] feat: Quieter gocr build --- runtime/tests/Makefile | 3 ++- runtime/tests/gocr | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/tests/Makefile b/runtime/tests/Makefile index 10e2465..0002492 100644 --- a/runtime/tests/Makefile +++ b/runtime/tests/Makefile @@ -24,8 +24,9 @@ cifar10: cp ./CMSIS_5_NN/cifar10.so ${SLEDGE_BIN_DIR}/cifar10_wasm.so gocr: + @echo "Making and Installing gocr" make gocr.so -C ./gocr/src/ -f wasm.mk - cp ./gocr/src/gocr.so ${SLEDGE_BIN_DIR}/gocr_wasm.so + @cp ./gocr/src/gocr.so ${SLEDGE_BIN_DIR}/gocr_wasm.so sod: make clean dir samples.so -C ./sod/ diff --git a/runtime/tests/gocr b/runtime/tests/gocr index d74bcda..0976fd0 160000 --- a/runtime/tests/gocr +++ b/runtime/tests/gocr @@ -1 +1 @@ -Subproject commit d74bcdad2d92fe909eccde19ad954c06d9f4c859 +Subproject commit 0976fd036462264f581a588fa6cfa46718c67716 From bfe0823c813e3a20aa2e95e9174051485d7005fb Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 01:57:39 +0000 Subject: [PATCH 04/35] chore: Attempt to cache gocr --- .github/workflows/main.yaml | 8 ++++++++ test.sh | 24 ++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e816e1c..de197b7 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -92,6 +92,14 @@ jobs: LD_LIBRARY_PATH="$(pwd)/lib:$LD_LIBRARY_PATH" echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV make build-validate + - name: Cache gocr + uses: actions/cache@v2 + env: + cache-name: gocr + with: + # Cache the gocr webassembly module based on the submodule file + path: ./runtime/bin/gocr_wasm.so + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles(./runtime/tests/gocr') }} - name: Compile sample apps and run tests run: | ./test.sh diff --git a/test.sh b/test.sh index a3f9d79..d6a89a2 100755 --- a/test.sh +++ b/test.sh @@ -32,7 +32,9 @@ declare -a failed_tests=() # OCR Tests # FIXME: OCR tests seem to sporadically fail and then work on rerun. ocr_hyde() { - make gocr -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then + make gocr -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/ocr/hyde" || exit 1 ./run.sh || failed_tests+=("ocr_hyde") popd || exit 1 @@ -40,7 +42,9 @@ ocr_hyde() { } ocr_handwriting() { - make gocr -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then + make gocr -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/ocr/handwriting" || exit 1 ./run.sh || failed_tests+=("ocr_handwriting") popd || exit 1 @@ -48,7 +52,9 @@ ocr_handwriting() { } ocr_fivebyeight() { - make gocr -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then + make gocr -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/ocr/fivebyeight" || exit 1 ./run.sh || failed_tests+=("ocr_fivebyeight") popd || exit 1 @@ -56,7 +62,9 @@ ocr_fivebyeight() { } ocr_by_word() { - make gocr -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then + make gocr -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/ocr/by_word" || exit 1 ./install.sh || exit 1 ./run.sh || failed_tests+=("ocr_by_word") @@ -65,7 +73,9 @@ ocr_by_word() { } ocr_by_font() { - make gocr -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then + make gocr -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/ocr/by_font" || exit 1 ./install.sh || exit 1 ./run.sh || failed_tests+=("ocr_by_font") @@ -74,7 +84,9 @@ ocr_by_font() { } ocr_by_dpi() { - make gocr -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then + make gocr -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/ocr/by_dpi" || exit 1 ./install.sh || exit 1 ./run.sh || failed_tests+=("ocr_by_dpi") From bd94b96f59059bcddecb57f50550dd64aa3b9da7 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 01:59:40 +0000 Subject: [PATCH 05/35] chore: fix missing quote --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index de197b7..92e21ad 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -99,7 +99,7 @@ jobs: with: # Cache the gocr webassembly module based on the submodule file path: ./runtime/bin/gocr_wasm.so - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles(./runtime/tests/gocr') }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./runtime/tests/gocr') }} - name: Compile sample apps and run tests run: | ./test.sh From 6a2f93b547d5bf3abc6c157b5b7c8e8ff203ea0e Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 02:10:05 +0000 Subject: [PATCH 06/35] chore: cache cargo --- .github/workflows/main.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 92e21ad..3cd4ac0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -80,6 +80,15 @@ jobs: netpbm \ pango1.0-tools \ wamerican + - name: Cache Cargo + uses: actions/cache@v2 + env: + cache-name: cargo + with: + path: ~/.cargo + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./awsm/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- - name: Compile sledge run: | make build From 15bcad2a388e74dc1f485d5948e471f479396844 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 02:26:25 +0000 Subject: [PATCH 07/35] chore: disable several tests in CI --- test.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index d6a89a2..b5d3cd0 100755 --- a/test.sh +++ b/test.sh @@ -121,6 +121,7 @@ image_classification() { } image_resize() { + return 0 make sod -C "$base_dir/runtime/tests" || exit 1 pushd "$base_dir/runtime/experiments/applications/imageresize/test" || exit 1 ./install.sh || exit 1 @@ -151,6 +152,7 @@ lpd_by_plate_count() { } bimodal() { + return 0 echo "Bimodal" # TODO: Make Dependency "fibonacci_wasm.so" pushd "$base_dir/runtime/experiments/bimodal/" || exit 1 @@ -160,6 +162,7 @@ bimodal() { } concurrency() { + return 0 echo "Concurrency" # TODO: Make Dependency "empty_wasm.so" pushd "$base_dir/runtime/experiments/concurrency/" || exit 1 @@ -169,10 +172,11 @@ concurrency() { } payload() { + return 0 echo "Payload" # TODO: Make Dependency "work1k_wasm.so" "work10k_wasm.so" "work100k_wasm.so" "work1m_wasm.so" pushd "$base_dir/runtime/experiments/payload/" || exit 1 - ./run.sh || failed_tests+=("concurrency") + ./run.sh || failed_tests+=("payload") popd || exit 1 return 0 } From 50768f9bef1a45cd17b40880b1624437ac85253a Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 02:44:39 +0000 Subject: [PATCH 08/35] chore: remove iteration echo --- runtime/experiments/applications/ocr/by_dpi/run.sh | 1 - runtime/experiments/applications/ocr/by_font/run.sh | 1 - runtime/experiments/applications/ocr/by_word/run.sh | 3 --- runtime/experiments/applications/ocr/fivebyeight/run.sh | 1 - runtime/experiments/applications/ocr/handwriting/run.sh | 1 - runtime/experiments/applications/ocr/hyde/run.sh | 1 - 6 files changed, 8 deletions(-) diff --git a/runtime/experiments/applications/ocr/by_dpi/run.sh b/runtime/experiments/applications/ocr/by_dpi/run.sh index 72df78d..7725cee 100755 --- a/runtime/experiments/applications/ocr/by_dpi/run.sh +++ b/runtime/experiments/applications/ocr/by_dpi/run.sh @@ -28,7 +28,6 @@ dpi_to_port[144]=10002 total_count=100 for ((i = 0; i < total_count; i++)); do - echo "$i" words="$(shuf -n"$word_count" /usr/share/dict/american-english)" for dpi in "${dpis[@]}"; do diff --git a/runtime/experiments/applications/ocr/by_font/run.sh b/runtime/experiments/applications/ocr/by_font/run.sh index ca2f8be..f706b27 100755 --- a/runtime/experiments/applications/ocr/by_font/run.sh +++ b/runtime/experiments/applications/ocr/by_font/run.sh @@ -22,7 +22,6 @@ fonts=("DejaVu Sans Mono" "Roboto" "Cascadia Code") total_count=10 for ((i = 1; i <= total_count; i++)); do - echo "Test $i" words="$(shuf -n"$word_count" /usr/share/dict/american-english)" for font in "${fonts[@]}"; do diff --git a/runtime/experiments/applications/ocr/by_word/run.sh b/runtime/experiments/applications/ocr/by_word/run.sh index ed0e7e6..317c6fd 100755 --- a/runtime/experiments/applications/ocr/by_word/run.sh +++ b/runtime/experiments/applications/ocr/by_word/run.sh @@ -27,8 +27,6 @@ word_count_to_port["100_words.pnm"]=10002 total_count=100 for ((i = 0; i < total_count; i++)); do - echo "$i" - for word_count in "${word_counts[@]}"; do echo "${word_count}"_words.pnm words="$(shuf -n"$word_count" /usr/share/dict/american-english)" @@ -43,7 +41,6 @@ for ((i = 0; i < total_count; i++)); do diff -ywBZE --suppress-common-lines <(echo "$words") <(echo "$result") echo "===============================================" done - done if [ "$1" != "-d" ]; then diff --git a/runtime/experiments/applications/ocr/fivebyeight/run.sh b/runtime/experiments/applications/ocr/fivebyeight/run.sh index 722ed7f..96b9c86 100755 --- a/runtime/experiments/applications/ocr/fivebyeight/run.sh +++ b/runtime/experiments/applications/ocr/fivebyeight/run.sh @@ -40,7 +40,6 @@ success_count=0 total_count=50 for ((i = 0; i < total_count; i++)); do - echo "$i" result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@5x8.pnm" localhost:10000 2> /dev/null) # echo "$result" if [[ "$result" == "$expected_result" ]]; then diff --git a/runtime/experiments/applications/ocr/handwriting/run.sh b/runtime/experiments/applications/ocr/handwriting/run.sh index 6a2fa00..fefe210 100755 --- a/runtime/experiments/applications/ocr/handwriting/run.sh +++ b/runtime/experiments/applications/ocr/handwriting/run.sh @@ -40,7 +40,6 @@ success_count=0 total_count=50 for ((i = 0; i < total_count; i++)); do - echo "$i" result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@handwrt1.pnm" localhost:10000 2> /dev/null) # echo "$result" if [[ "$result" == "$expected_result" ]]; then diff --git a/runtime/experiments/applications/ocr/hyde/run.sh b/runtime/experiments/applications/ocr/hyde/run.sh index a0c59b7..b059c22 100755 --- a/runtime/experiments/applications/ocr/hyde/run.sh +++ b/runtime/experiments/applications/ocr/hyde/run.sh @@ -39,7 +39,6 @@ success_count=0 total_count=50 for ((i = 0; i < total_count; i++)); do - echo "$i" result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@hyde.pnm" localhost:10000 2> /dev/null) # echo "$result" if [[ "$result" == "$expected_result" ]]; then From 45e4b70c3dcc1c0899080dd8439852db71c550c3 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 02:59:50 +0000 Subject: [PATCH 09/35] chore: retry cargo caching --- .github/workflows/main.yaml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3cd4ac0..51c9493 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -82,13 +82,12 @@ jobs: wamerican - name: Cache Cargo uses: actions/cache@v2 - env: - cache-name: cargo with: - path: ~/.cargo - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./awsm/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- + path: | + ~/.cargo/registry + ~/.cargo/git + ./awsm/target + key: ${{ runner.os }}-cargo-${{ hashFiles('./awsm/Cargo.lock') }} - name: Compile sledge run: | make build @@ -103,12 +102,9 @@ jobs: make build-validate - name: Cache gocr uses: actions/cache@v2 - env: - cache-name: gocr with: - # Cache the gocr webassembly module based on the submodule file path: ./runtime/bin/gocr_wasm.so - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./runtime/tests/gocr') }} - - name: Compile sample apps and run tests + key: ${{ runner.os }}-gocr-${{ hashFiles('./runtime/tests/gocr') }} + - name: Hyde run: | - ./test.sh + ./test.sh hyde From 3017cf85dedd8de4b5846286a00969ba64a46435 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 03:08:04 +0000 Subject: [PATCH 10/35] chore: fix hyde typo --- .github/workflows/main.yaml | 2 +- test.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 51c9493..f7bd9aa 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -107,4 +107,4 @@ jobs: key: ${{ runner.os }}-gocr-${{ hashFiles('./runtime/tests/gocr') }} - name: Hyde run: | - ./test.sh hyde + ./test.sh ocr_hyde diff --git a/test.sh b/test.sh index b5d3cd0..ba57136 100755 --- a/test.sh +++ b/test.sh @@ -208,6 +208,7 @@ main() { for test in "$@"; do if [[ ! " ${tests[*]} " =~ " ${test} " ]]; then printf "Error: %s is not a known test\n" "$test" + return 1 else if "$test"; then printf "%s: Pass\n" "$test" From 05e6d5b71424028cb52d18bc28bd573668ac7b06 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 03:18:21 +0000 Subject: [PATCH 11/35] chore: force vacation of gocr cache --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f7bd9aa..534e2d0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -104,7 +104,7 @@ jobs: uses: actions/cache@v2 with: path: ./runtime/bin/gocr_wasm.so - key: ${{ runner.os }}-gocr-${{ hashFiles('./runtime/tests/gocr') }} + key: ${{ runner.os }}-gocr-${{ hashFiles('./runtime/tests/gocr')-2 }} - name: Hyde run: | ./test.sh ocr_hyde From 5941ca502d49d3a14774631918c5b22c4600fcef Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 03:20:00 +0000 Subject: [PATCH 12/35] chore: gocr clear attempt two --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 534e2d0..3e50608 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -104,7 +104,7 @@ jobs: uses: actions/cache@v2 with: path: ./runtime/bin/gocr_wasm.so - key: ${{ runner.os }}-gocr-${{ hashFiles('./runtime/tests/gocr')-2 }} + key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/gocr') }} - name: Hyde run: | ./test.sh ocr_hyde From dd399d30ce1ea061a96adfabccbb44e733b1c072 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 13:37:44 +0000 Subject: [PATCH 13/35] test: Add back handwriting --- .github/workflows/main.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3e50608..50b605d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -108,3 +108,6 @@ jobs: - name: Hyde run: | ./test.sh ocr_hyde + - name: Handwriting + run: | + ./test.sh ocr_handwriting From 4a2765840be8c6ad0e6eb836ae3ef352a6e13e10 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 13:44:08 +0000 Subject: [PATCH 14/35] test: reenable fivebyeight --- .github/workflows/main.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 50b605d..3dc569f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -111,3 +111,6 @@ jobs: - name: Handwriting run: | ./test.sh ocr_handwriting + - name: Five by Eight + run: | + ./test.sh ocr_fivebyeight From f328f40babef1479923325f8d4df19828dc5333d Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 13:49:36 +0000 Subject: [PATCH 15/35] test: Re-add OCR by word --- .github/workflows/main.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3dc569f..35006ef 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -114,3 +114,6 @@ jobs: - name: Five by Eight run: | ./test.sh ocr_fivebyeight + - name: OCR by Word + run: | + ./test.sh ocr_by_word From 9eef778eda497b3068d4bb177731405a3c360b12 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 13:56:21 +0000 Subject: [PATCH 16/35] test: re-add OCR by font and by dpi --- .github/workflows/main.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 35006ef..51ac094 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -117,3 +117,9 @@ jobs: - name: OCR by Word run: | ./test.sh ocr_by_word + - name: OCR by Font + run: | + ./test.sh ocr_by_font + - name: OCR by DPI + run: | + ./test.sh ocr_by_dpi From 770eaee23913f86f216d3880d3fc8b2ec267ebd6 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 14:05:37 +0000 Subject: [PATCH 17/35] test: Add first EKF test --- .github/workflows/main.yaml | 8 ++++++++ test.sh | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 51ac094..862621a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -123,3 +123,11 @@ jobs: - name: OCR by DPI run: | ./test.sh ocr_by_dpi + - name: Cache EKF + uses: actions/cache@v2 + with: + path: ./runtime/bin/ekf_wasm.so + key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/TinyEKF') }} + - name: EKF by Iteration + run: | + ./test.sh ekf_by_iteration diff --git a/test.sh b/test.sh index ba57136..73c91d9 100755 --- a/test.sh +++ b/test.sh @@ -96,15 +96,20 @@ ocr_by_dpi() { # EKF Tests ekf_by_iteration() { + if [[ ! -f "$base_dir/runtime/bin/ekf_wasm.so" ]]; then + make tinyekf -C "$base_dir/runtime/tests" || exit 1 + fi make tinyekf -C "$base_dir/runtime/tests" || exit 1 pushd "$base_dir/runtime/experiments/applications/ekf/by_iteration" || exit 1 - ./run.sh || failed_tests+=("ocr_by_dpi") + ./run.sh || failed_tests+=("ekf_by_iteration") popd || exit 1 return 0 } ekf_one_iteration() { - make tinyekf -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/ekf_wasm.so" ]]; then + make tinyekf -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/ekf/one_iteration" || exit 1 ./run.sh || failed_tests+=("ekf_one_iteration") popd || exit 1 From 2257c09357b4d365bf5e3f407a432cab4dc0b33e Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 15:51:01 +0000 Subject: [PATCH 18/35] chore: Quieter builds --- runtime/tests/CMSIS_5_NN | 2 +- runtime/tests/Makefile | 26 +++++++++++++++++--------- runtime/tests/TinyEKF | 2 +- runtime/tests/sod | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/runtime/tests/CMSIS_5_NN b/runtime/tests/CMSIS_5_NN index 503fc07..3507d3d 160000 --- a/runtime/tests/CMSIS_5_NN +++ b/runtime/tests/CMSIS_5_NN @@ -1 +1 @@ -Subproject commit 503fc07b2248dc006cc5409ed964632ebd29352a +Subproject commit 3507d3d0001db45eedbb65072f5fe7cad8bcb59b diff --git a/runtime/tests/Makefile b/runtime/tests/Makefile index 0002492..61aa2c0 100644 --- a/runtime/tests/Makefile +++ b/runtime/tests/Makefile @@ -7,31 +7,39 @@ TESTSRT=$(TESTS:%=%_rt) .PHONY: all clean rttests tinyekf cifar10 gocr sod all: rttests tinyekf cifar10 gocr sod - @echo "Compilation done!" + @echo "Test Compilation done!" rttests: $(TESTSRT) clean: + @echo "Cleaning Test Applications" @rm -rf ${TMP_DIR} @rm -rf ${SLEDGE_BIN_DIR}/*_wasm.so + @make clean -C ./TinyEKF/extras/c/ -f wasm.mk + @make clean -C ./CMSIS_5_NN/ -f Makefile + @make clean -C ./gocr/src/ -f wasm.mk + @make clean -C ./sod/ tinyekf: - make gps_ekf_fn.so -C ./TinyEKF/extras/c/ -f wasm.mk - cp ./TinyEKF/extras/c/gps_ekf_fn.so ${SLEDGE_BIN_DIR}/ekf_wasm.so + @echo "Making and Installing tinyekf" + @make gps_ekf_fn.so -C ./TinyEKF/extras/c/ -f wasm.mk + @cp ./TinyEKF/extras/c/gps_ekf_fn.so ${SLEDGE_BIN_DIR}/ekf_wasm.so cifar10: - make cifar10.so -C ./CMSIS_5_NN/ -f Makefile - cp ./CMSIS_5_NN/cifar10.so ${SLEDGE_BIN_DIR}/cifar10_wasm.so + @echo "Making and Installing cifar10" + @make cifar10.so -C ./CMSIS_5_NN/ -f Makefile + @cp ./CMSIS_5_NN/cifar10.so ${SLEDGE_BIN_DIR}/cifar10_wasm.so gocr: @echo "Making and Installing gocr" - make gocr.so -C ./gocr/src/ -f wasm.mk + @make gocr.so -C ./gocr/src/ -f wasm.mk @cp ./gocr/src/gocr.so ${SLEDGE_BIN_DIR}/gocr_wasm.so sod: - make clean dir samples.so -C ./sod/ - cp ./sod/bin/license_plate_detection.so ${SLEDGE_BIN_DIR}/lpd_wasm.so - cp ./sod/bin/resize_image.so ${SLEDGE_BIN_DIR}/resize_wasm.so + @echo "Making and Installing license_plate_detection and image_resize" + @make dir samples.so -C ./sod/ + @cp ./sod/bin/license_plate_detection.so ${SLEDGE_BIN_DIR}/lpd_wasm.so + @cp ./sod/bin/resize_image.so ${SLEDGE_BIN_DIR}/resize_wasm.so %_rt: @mkdir -p ${TMP_DIR} diff --git a/runtime/tests/TinyEKF b/runtime/tests/TinyEKF index 58857dc..76daf1d 160000 --- a/runtime/tests/TinyEKF +++ b/runtime/tests/TinyEKF @@ -1 +1 @@ -Subproject commit 58857dc898e3e2f4cbfd5d12e31e6e2ad273add4 +Subproject commit 76daf1da0546dd04896f20ae630cdeea0280c095 diff --git a/runtime/tests/sod b/runtime/tests/sod index 9728147..2f57d46 160000 --- a/runtime/tests/sod +++ b/runtime/tests/sod @@ -1 +1 @@ -Subproject commit 9728147fe396ab7946909ab0155c4c6dd77ea082 +Subproject commit 2f57d46df4074be9374f6021cef955b17702380e From 12d6d04ab2f95e231887bda7609a133fb390e478 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 16:14:30 +0000 Subject: [PATCH 19/35] test: Readd various tests --- .github/workflows/main.yaml | 29 +++++++++++++++++++++++++++++ test.sh | 5 +++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 862621a..e776053 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -26,6 +26,7 @@ jobs: run: ./format.sh -d test: runs-on: ubuntu-latest + continue-on-error: true steps: - name: Apt Update run: sudo apt-get update @@ -100,6 +101,7 @@ jobs: LD_LIBRARY_PATH="$(pwd)/lib:$LD_LIBRARY_PATH" echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV make build-validate + # TODO:Cache assets before being copied to ./runtime/bin - name: Cache gocr uses: actions/cache@v2 with: @@ -123,11 +125,38 @@ jobs: - name: OCR by DPI run: | ./test.sh ocr_by_dpi + # TODO:Cache assets before being copied to ./runtime/bin - name: Cache EKF uses: actions/cache@v2 with: path: ./runtime/bin/ekf_wasm.so key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/TinyEKF') }} + - name: EKF one iteration + run: | + ./test.sh ekf_one_iteration - name: EKF by Iteration run: | ./test.sh ekf_by_iteration + # TODO:Cache assets before being copied to ./runtime/bin + - name: Image Classification + run: | + ./test.sh image_classification + # TODO:Cache assets before being copied to ./runtime/bin + - name: Image Resize + run: | + ./test.sh image_resize + - name: License Plate Detection by Resolution + run: | + ./test.sh lpd_by_resolution + - name: License Plate Detection by Plate Count + run: | + ./test.sh lpd_by_plate_count + - name: Bimodal + run: | + ./test.sh bimodal + - name: Concurrency + run: | + ./test.sh concurrency + - name: Payload + run: | + ./test.sh payload diff --git a/test.sh b/test.sh index 73c91d9..5757517 100755 --- a/test.sh +++ b/test.sh @@ -32,6 +32,8 @@ declare -a failed_tests=() # OCR Tests # FIXME: OCR tests seem to sporadically fail and then work on rerun. ocr_hyde() { + # FIXME: This check is a hack because GitHub Actions is caching + # the *.so file in the destination file, not the subodule it built from if [[ ! -f "$base_dir/runtime/bin/gocr_wasm.so" ]]; then make gocr -C "$base_dir/runtime/tests" || exit 1 fi @@ -99,9 +101,8 @@ ekf_by_iteration() { if [[ ! -f "$base_dir/runtime/bin/ekf_wasm.so" ]]; then make tinyekf -C "$base_dir/runtime/tests" || exit 1 fi - make tinyekf -C "$base_dir/runtime/tests" || exit 1 pushd "$base_dir/runtime/experiments/applications/ekf/by_iteration" || exit 1 - ./run.sh || failed_tests+=("ekf_by_iteration") + ./run.sh || failed_tests+=("ocr_by_dpi") popd || exit 1 return 0 } From 989b72b6bf919db22b218fe9dfd79a47671d9eaf Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 17:01:45 +0000 Subject: [PATCH 20/35] fix: Add missing headers --- runtime/tests/sockserver/server.c | 3 +++ runtime/tests/work/main.c | 1 + runtime/tests/work100k/main.c | 1 + runtime/tests/work10k/main.c | 1 + runtime/tests/work1k/main.c | 1 + runtime/tests/work1m/main.c | 1 + 6 files changed, 8 insertions(+) diff --git a/runtime/tests/sockserver/server.c b/runtime/tests/sockserver/server.c index 3733187..0a68b09 100644 --- a/runtime/tests/sockserver/server.c +++ b/runtime/tests/sockserver/server.c @@ -2,8 +2,11 @@ The port number is passed as an argument */ /* code from: http://www.cs.rpi.edu/~moorthy/Courses/os98/Pgms/socket.html */ #include +#include +#include #include #include +#include #include void diff --git a/runtime/tests/work/main.c b/runtime/tests/work/main.c index bf42a16..600dca3 100644 --- a/runtime/tests/work/main.c +++ b/runtime/tests/work/main.c @@ -1,6 +1,7 @@ #include #include #include +#include #ifndef MAX_BUF #define MAX_BUF (1024 * 1024 * 1) // 1m diff --git a/runtime/tests/work100k/main.c b/runtime/tests/work100k/main.c index dd9cfa7..0ed61e3 100644 --- a/runtime/tests/work100k/main.c +++ b/runtime/tests/work100k/main.c @@ -1,6 +1,7 @@ #include #include #include +#include #define MAX_BUF 102400 diff --git a/runtime/tests/work10k/main.c b/runtime/tests/work10k/main.c index f456ccc..63e8978 100644 --- a/runtime/tests/work10k/main.c +++ b/runtime/tests/work10k/main.c @@ -1,6 +1,7 @@ #include #include #include +#include #define MAX_BUF 10240 diff --git a/runtime/tests/work1k/main.c b/runtime/tests/work1k/main.c index 1c76d4d..f6c6c95 100644 --- a/runtime/tests/work1k/main.c +++ b/runtime/tests/work1k/main.c @@ -1,6 +1,7 @@ #include #include #include +#include #define MAX_BUF 1024 diff --git a/runtime/tests/work1m/main.c b/runtime/tests/work1m/main.c index 0c40471..5ba8371 100644 --- a/runtime/tests/work1m/main.c +++ b/runtime/tests/work1m/main.c @@ -1,6 +1,7 @@ #include #include #include +#include #define MAX_BUF (1024 * 1024 * 1) // 1m From c6664690400bcd38cacf4a2775cbbca9fe5d04f6 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 17:02:00 +0000 Subject: [PATCH 21/35] test: enable all tests --- test.sh | 84 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/test.sh b/test.sh index 5757517..4dc13c2 100755 --- a/test.sh +++ b/test.sh @@ -119,7 +119,9 @@ ekf_one_iteration() { # cifar10 Tests image_classification() { - make cifar10 -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/cifar10_wasm.so" ]]; then + make cifar10 -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/imageclassification" || exit 1 ./run.sh || failed_tests+=("image_classification") popd || exit 1 @@ -127,8 +129,9 @@ image_classification() { } image_resize() { - return 0 - make sod -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/resize_wasm.so" ]]; then + make sod -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/imageresize/test" || exit 1 ./install.sh || exit 1 ./run.sh || failed_tests+=("image_resize") @@ -137,9 +140,9 @@ image_resize() { } lpd_by_resolution() { - # Disabled... Seems to be dumping raw image data - return 0 - make sod -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/lpd_wasm.so" ]]; then + make sod -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" || exit 1 ./install.sh || exit 1 ./run.sh || failed_tests+=("lpd_by_resolution") @@ -148,9 +151,9 @@ lpd_by_resolution() { } lpd_by_plate_count() { - # Disabled... Seems to be dumping raw image data - return 0 - make sod -C "$base_dir/runtime/tests" || exit 1 + if [[ ! -f "$base_dir/runtime/bin/lpd_wasm.so" ]]; then + make sod -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/applications/licenseplate/by_plate_count" || exit 1 ./run.sh || failed_tests+=("lpd_by_plate_count") popd || exit 1 @@ -158,9 +161,10 @@ lpd_by_plate_count() { } bimodal() { - return 0 echo "Bimodal" - # TODO: Make Dependency "fibonacci_wasm.so" + if [[ ! -f "$base_dir/runtime/bin/fibonacci_wasm.so" ]]; then + make rttests -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/bimodal/" || exit 1 ./run.sh || failed_tests+=("bimodal") popd || exit 1 @@ -168,9 +172,10 @@ bimodal() { } concurrency() { - return 0 echo "Concurrency" - # TODO: Make Dependency "empty_wasm.so" + if [[ ! -f "$base_dir/runtime/bin/empty_wasm.so" ]]; then + make rttests -C "$base_dir/runtime/tests" || exit 1 + fi pushd "$base_dir/runtime/experiments/concurrency/" || exit 1 ./run.sh || failed_tests+=("concurrency") popd || exit 1 @@ -178,8 +183,13 @@ concurrency() { } payload() { - return 0 echo "Payload" + if [[ ! -f "$base_dir/runtime/bin/work1k_wasm.so" ]] \ + || [[ ! -f "$base_dir/runtime/bin/work10k_wasm.so" ]] \ + || [[ ! -f "$base_dir/runtime/bin/work100k_wasm.so" ]] \ + || [[ ! -f "$base_dir/runtime/bin/work1m_wasm.so" ]]; then + make rttests -C "$base_dir/runtime/tests" || exit 1 + fi # TODO: Make Dependency "work1k_wasm.so" "work10k_wasm.so" "work100k_wasm.so" "work1m_wasm.so" pushd "$base_dir/runtime/experiments/payload/" || exit 1 ./run.sh || failed_tests+=("payload") @@ -191,40 +201,36 @@ main() { cd "$base_dir/awsm" && cargo build --release || exit 1 make all -C "$base_dir/runtime" || exit 1 - # If no arguments are provided, run all tests if (($# == 0)); then + # If no arguments are provided, run all tests for test in "${tests[@]}"; do "$test" done - local -i failure_count=${#failed_tests[@]} + else + # Otherwise, only run the tests passed as arguments + for test in "$@"; do + if [[ ! " ${tests[*]} " =~ " ${test} " ]]; then + printf "Error: %s is not a known test\n" "$test" + return 1 + else + "$test" + fi + done - if ((failure_count > 0)); then - printf "Failed Tests\n" - for test in "${failed_tests[@]}"; do - printf "\t%s\n" "$test" - done - exit 1 - fi + fi + local -i failure_count=${#failed_tests[@]} + if ((failure_count > 0)); then + printf "Failed Tests\n" + for test in "${failed_tests[@]}"; do + printf "\t%s\n" "$test" + done + exit 1 + else + printf "All tests passed\n" exit 0 fi - - # Otherwise, only run the tests passed as arguments - for test in "$@"; do - if [[ ! " ${tests[*]} " =~ " ${test} " ]]; then - printf "Error: %s is not a known test\n" "$test" - return 1 - else - if "$test"; then - printf "%s: Pass\n" "$test" - else - printf "%s: Fail\n" "$test" - - fi - fi - - done } main "$@" From ade19936c36120db556f003ee099594c6e0e8613 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 17:17:11 +0000 Subject: [PATCH 22/35] chore: clarify implicit type coercion --- runtime/compiletime/instr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/runtime/compiletime/instr.c b/runtime/compiletime/instr.c index ad1f1de..2664d53 100644 --- a/runtime/compiletime/instr.c +++ b/runtime/compiletime/instr.c @@ -116,56 +116,56 @@ i64_rem(int64_t a, int64_t b) uint32_t u32_trunc_f32(float f) { - assert(0 <= f && f <= UINT32_MAX); + assert(0 <= f && f <= (float)UINT32_MAX); return (uint32_t)f; } int32_t i32_trunc_f32(float f) { - assert(INT32_MIN <= f && f <= INT32_MAX); + assert(INT32_MIN <= f && f <= (float)INT32_MAX); return (int32_t)f; } uint32_t u32_trunc_f64(double f) { - assert(0 <= f && f <= UINT32_MAX); + assert(0 <= f && f <= (double)UINT32_MAX); return (uint32_t)f; } int32_t i32_trunc_f64(double f) { - assert(INT32_MIN <= f && f <= INT32_MAX); + assert(INT32_MIN <= f && f <= (double)INT32_MAX); return (int32_t)f; } uint64_t u64_trunc_f32(float f) { - assert(0 <= f && f <= UINT64_MAX); + assert(0 <= f && f <= (float)UINT64_MAX); return (uint64_t)f; } int64_t i64_trunc_f32(float f) { - assert(INT64_MIN <= f && f <= INT64_MAX); + assert(INT64_MIN <= f && f <= (float)INT64_MAX); return (int64_t)f; } uint64_t u64_trunc_f64(double f) { - assert(0 <= f && f <= UINT64_MAX); + assert(0 <= f && f <= (double)UINT64_MAX); return (uint64_t)f; } int64_t i64_trunc_f64(double f) { - assert(INT64_MIN <= f && f <= INT64_MAX); + assert(INT64_MIN <= f && f <= (double)INT64_MAX); return (int64_t)f; } From 2aea1bb348a188a536f31cf3f49d9196073b4b75 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 17:17:33 +0000 Subject: [PATCH 23/35] test: Increase image resize sleep --- .../experiments/applications/imageresize/by_resolution/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/experiments/applications/imageresize/by_resolution/run.sh b/runtime/experiments/applications/imageresize/by_resolution/run.sh index b5a3862..64deaf0 100755 --- a/runtime/experiments/applications/imageresize/by_resolution/run.sh +++ b/runtime/experiments/applications/imageresize/by_resolution/run.sh @@ -12,7 +12,7 @@ log="$experiment_directory/log.csv" 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" & - sleep 1 + sleep 2 else echo "Running under gdb" fi From 72de6671a594fe23b02614a87fb8f92902996ac4 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 17:33:31 +0000 Subject: [PATCH 24/35] chore: Alternate continue on error --- .github/workflows/main.yaml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e776053..be012e9 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -26,7 +26,6 @@ jobs: run: ./format.sh -d test: runs-on: ubuntu-latest - continue-on-error: true steps: - name: Apt Update run: sudo apt-get update @@ -110,21 +109,33 @@ jobs: - name: Hyde run: | ./test.sh ocr_hyde + continue-on-error: true + # if: succeeded() || failed() - name: Handwriting run: | ./test.sh ocr_handwriting + continue-on-error: true + # if: succeeded() || failed() - name: Five by Eight run: | ./test.sh ocr_fivebyeight + continue-on-error: true + # if: succeeded() || failed() - name: OCR by Word run: | ./test.sh ocr_by_word + continue-on-error: true + # if: succeeded() || failed() - name: OCR by Font run: | ./test.sh ocr_by_font + continue-on-error: true + # if: succeeded() || failed() - name: OCR by DPI run: | ./test.sh ocr_by_dpi + continue-on-error: true + # if: succeeded() || failed() # TODO:Cache assets before being copied to ./runtime/bin - name: Cache EKF uses: actions/cache@v2 @@ -134,29 +145,47 @@ jobs: - name: EKF one iteration run: | ./test.sh ekf_one_iteration + continue-on-error: true + # if: succeeded() || failed() - name: EKF by Iteration run: | ./test.sh ekf_by_iteration + continue-on-error: true + # if: succeeded() || failed() # TODO:Cache assets before being copied to ./runtime/bin - name: Image Classification run: | ./test.sh image_classification + continue-on-error: true + # if: succeeded() || failed() # TODO:Cache assets before being copied to ./runtime/bin - name: Image Resize run: | ./test.sh image_resize + continue-on-error: true + # if: succeeded() || failed() - name: License Plate Detection by Resolution run: | ./test.sh lpd_by_resolution + continue-on-error: true + # if: succeeded() || failed() - name: License Plate Detection by Plate Count run: | ./test.sh lpd_by_plate_count + continue-on-error: true + # if: succeeded() || failed() - name: Bimodal run: | ./test.sh bimodal + continue-on-error: true + # if: succeeded() || failed() - name: Concurrency run: | ./test.sh concurrency + continue-on-error: true + # if: succeeded() || failed() - name: Payload run: | ./test.sh payload + continue-on-error: true + # if: succeeded() || failed() From 41bf8ff9982fcb52e9b31f989e5e607e27293c0b Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 17:47:54 +0000 Subject: [PATCH 25/35] chore: try alternate success or failure syntax --- .github/workflows/main.yaml | 47 ++++++++++++++----------------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index be012e9..f15ea22 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -106,86 +106,73 @@ jobs: with: path: ./runtime/bin/gocr_wasm.so key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/gocr') }} + if: success() || failure() - name: Hyde run: | ./test.sh ocr_hyde - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: Handwriting run: | ./test.sh ocr_handwriting - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: Five by Eight run: | ./test.sh ocr_fivebyeight - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: OCR by Word run: | ./test.sh ocr_by_word - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: OCR by Font run: | ./test.sh ocr_by_font - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: OCR by DPI run: | ./test.sh ocr_by_dpi - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() # TODO:Cache assets before being copied to ./runtime/bin - name: Cache EKF uses: actions/cache@v2 with: path: ./runtime/bin/ekf_wasm.so key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/TinyEKF') }} + if: success() || failure() - name: EKF one iteration run: | ./test.sh ekf_one_iteration - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: EKF by Iteration run: | ./test.sh ekf_by_iteration - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() # TODO:Cache assets before being copied to ./runtime/bin - name: Image Classification run: | ./test.sh image_classification - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() # TODO:Cache assets before being copied to ./runtime/bin - name: Image Resize run: | ./test.sh image_resize - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: License Plate Detection by Resolution run: | ./test.sh lpd_by_resolution - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: License Plate Detection by Plate Count run: | ./test.sh lpd_by_plate_count - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: Bimodal run: | ./test.sh bimodal - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: Concurrency run: | ./test.sh concurrency - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() - name: Payload run: | ./test.sh payload - continue-on-error: true - # if: succeeded() || failed() + if: success() || failure() From f311f55e4db26ebc700938c582a172fd469ca001 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 18:03:36 +0000 Subject: [PATCH 26/35] chore: Add missing headers to sockclient --- runtime/tests/sockclient/client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/tests/sockclient/client.c b/runtime/tests/sockclient/client.c index 5ba32df..21230f0 100644 --- a/runtime/tests/sockclient/client.c +++ b/runtime/tests/sockclient/client.c @@ -1,10 +1,12 @@ /* code from http://www.cs.rpi.edu/~moorthy/Courses/os98/Pgms/socket.html */ #include +#include #include #include #include #include #include +#include void error(char *msg) From a904164f8884c96d3c67ae662468188cfb02413f Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 18:06:08 +0000 Subject: [PATCH 27/35] chore: Debug image resize --- .../applications/imageresize/by_resolution/run.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/experiments/applications/imageresize/by_resolution/run.sh b/runtime/experiments/applications/imageresize/by_resolution/run.sh index 64deaf0..ec3fdd8 100755 --- a/runtime/experiments/applications/imageresize/by_resolution/run.sh +++ b/runtime/experiments/applications/imageresize/by_resolution/run.sh @@ -24,24 +24,27 @@ for ((i = 0; i < total_count; i++)); do echo "$i" ext="$RANDOM" - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000 2> /dev/null 1> /dev/null + curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000 pixel_differences="$(compare -identify -metric AE "result_${ext}_small.png" expected_result_small.png null: 2>&1 > /dev/null)" + echo "Pixel Differences: $pixel_differences" if [[ "$pixel_differences" != "0" ]]; then echo "Small FAIL" echo "$pixel_differences pixel differences detected" exit 1 fi - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001 2> /dev/null 1> /dev/null + curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001 pixel_differences="$(compare -identify -metric AE "result_${ext}_medium.png" expected_result_medium.png null: 2>&1 > /dev/null)" + echo "Pixel Differences: $pixel_differences" if [[ "$pixel_differences" != "0" ]]; then echo "Small FAIL" echo "$pixel_differences pixel differences detected" exit 1 fi - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002 2> /dev/null 1> /dev/null + curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002 pixel_differences="$(compare -identify -metric AE "result_${ext}_large.png" expected_result_large.png null: 2>&1 > /dev/null)" + echo "Pixel Differences: $pixel_differences" if [[ "$pixel_differences" != "0" ]]; then echo "Small FAIL" echo "$pixel_differences pixel differences detected" From 5f2804939c6f328c2ff32091883d0f204de0abea Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 18:19:29 +0000 Subject: [PATCH 28/35] chore: additional resize by resolution debugging --- .github/workflows/main.yaml | 4 +- .../imageresize/by_resolution/run.sh | 56 +++++++++++-------- test.sh | 8 +-- 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f15ea22..31c73e0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -156,9 +156,9 @@ jobs: run: | ./test.sh image_resize if: success() || failure() - - name: License Plate Detection by Resolution + - name: Image Resize by Resolution run: | - ./test.sh lpd_by_resolution + ./test.sh image_resize_by_resolution if: success() || failure() - name: License Plate Detection by Plate Count run: | diff --git a/runtime/experiments/applications/imageresize/by_resolution/run.sh b/runtime/experiments/applications/imageresize/by_resolution/run.sh index ec3fdd8..e3f17bd 100755 --- a/runtime/experiments/applications/imageresize/by_resolution/run.sh +++ b/runtime/experiments/applications/imageresize/by_resolution/run.sh @@ -12,7 +12,7 @@ log="$experiment_directory/log.csv" 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" & - sleep 2 + sleep 3 else echo "Running under gdb" fi @@ -24,31 +24,43 @@ for ((i = 0; i < total_count; i++)); do echo "$i" ext="$RANDOM" - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000 - pixel_differences="$(compare -identify -metric AE "result_${ext}_small.png" expected_result_small.png null: 2>&1 > /dev/null)" - echo "Pixel Differences: $pixel_differences" - if [[ "$pixel_differences" != "0" ]]; then - echo "Small FAIL" - echo "$pixel_differences pixel differences detected" - exit 1 + # Small + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000; then + pixel_differences="$(compare -identify -metric AE "result_${ext}_small.png" expected_result_small.png null: 2>&1 > /dev/null)" + echo "Pixel Differences: $pixel_differences" + if [[ "$pixel_differences" != "0" ]]; then + echo "Small FAIL" + echo "$pixel_differences pixel differences detected" + exit 1 + fi + else + echo "curl failed with $?" fi - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001 - pixel_differences="$(compare -identify -metric AE "result_${ext}_medium.png" expected_result_medium.png null: 2>&1 > /dev/null)" - echo "Pixel Differences: $pixel_differences" - if [[ "$pixel_differences" != "0" ]]; then - echo "Small FAIL" - echo "$pixel_differences pixel differences detected" - exit 1 + # Medium + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001; then + pixel_differences="$(compare -identify -metric AE "result_${ext}_medium.png" expected_result_medium.png null: 2>&1 > /dev/null)" + echo "Pixel Differences: $pixel_differences" + if [[ "$pixel_differences" != "0" ]]; then + echo "Medium FAIL" + echo "$pixel_differences pixel differences detected" + exit 1 + fi + else + echo "curl failed with $?" fi - curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002 - pixel_differences="$(compare -identify -metric AE "result_${ext}_large.png" expected_result_large.png null: 2>&1 > /dev/null)" - echo "Pixel Differences: $pixel_differences" - if [[ "$pixel_differences" != "0" ]]; then - echo "Small FAIL" - echo "$pixel_differences pixel differences detected" - exit 1 + # Large + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002; then + pixel_differences="$(compare -identify -metric AE "result_${ext}_large.png" expected_result_large.png null: 2>&1 > /dev/null)" + echo "Pixel Differences: $pixel_differences" + if [[ "$pixel_differences" != "0" ]]; then + echo "Large FAIL" + echo "$pixel_differences pixel differences detected" + exit 1 + fi + else + echo "curl failed with $?" fi success_count=$((success_count + 1)) diff --git a/test.sh b/test.sh index 4dc13c2..c4d5f7e 100755 --- a/test.sh +++ b/test.sh @@ -20,7 +20,7 @@ declare -ra tests=( ekf_one_iteration image_classification image_resize - lpd_by_resolution + image_resize_by_resolution lpd_by_plate_count bimodal concurrency @@ -139,13 +139,13 @@ image_resize() { return 0 } -lpd_by_resolution() { - if [[ ! -f "$base_dir/runtime/bin/lpd_wasm.so" ]]; then +image_resize_by_resolution() { + if [[ ! -f "$base_dir/runtime/bin/resize_wasm.so" ]]; then make sod -C "$base_dir/runtime/tests" || exit 1 fi pushd "$base_dir/runtime/experiments/applications/imageresize/by_resolution" || exit 1 ./install.sh || exit 1 - ./run.sh || failed_tests+=("lpd_by_resolution") + ./run.sh || failed_tests+=("image_resize_resolution") popd || exit 1 return 0 } From 69c82ead61a117b2c20c25850f9a32ed4da64c0f Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 18:34:12 +0000 Subject: [PATCH 29/35] test: Do not fail imageresize on curl non 0 exit status --- .../imageresize/by_resolution/run.sh | 12 +++++------ .../applications/imageresize/test/run.sh | 20 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/runtime/experiments/applications/imageresize/by_resolution/run.sh b/runtime/experiments/applications/imageresize/by_resolution/run.sh index e3f17bd..3bfa988 100755 --- a/runtime/experiments/applications/imageresize/by_resolution/run.sh +++ b/runtime/experiments/applications/imageresize/by_resolution/run.sh @@ -25,7 +25,7 @@ for ((i = 0; i < total_count; i++)); do ext="$RANDOM" # Small - if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000; then + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_small.jpg" --output "result_${ext}_small.png" localhost:10000 2> /dev/null 1> /dev/null; then pixel_differences="$(compare -identify -metric AE "result_${ext}_small.png" expected_result_small.png null: 2>&1 > /dev/null)" echo "Pixel Differences: $pixel_differences" if [[ "$pixel_differences" != "0" ]]; then @@ -34,11 +34,11 @@ for ((i = 0; i < total_count; i++)); do exit 1 fi else - echo "curl failed with $?" + echo "curl failed with ${?}. See man curl for meaning." fi # Medium - if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001; then + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_medium.jpg" --output "result_${ext}_medium.png" localhost:10001 2> /dev/null 1> /dev/null; then pixel_differences="$(compare -identify -metric AE "result_${ext}_medium.png" expected_result_medium.png null: 2>&1 > /dev/null)" echo "Pixel Differences: $pixel_differences" if [[ "$pixel_differences" != "0" ]]; then @@ -47,11 +47,11 @@ for ((i = 0; i < total_count; i++)); do exit 1 fi else - echo "curl failed with $?" + echo "curl failed with ${?}. See man curl for meaning." fi # Large - if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002; then + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@shrinking_man_large.jpg" --output "result_${ext}_large.png" localhost:10002 2> /dev/null 1> /dev/null; then pixel_differences="$(compare -identify -metric AE "result_${ext}_large.png" expected_result_large.png null: 2>&1 > /dev/null)" echo "Pixel Differences: $pixel_differences" if [[ "$pixel_differences" != "0" ]]; then @@ -60,7 +60,7 @@ for ((i = 0; i < total_count; i++)); do exit 1 fi else - echo "curl failed with $?" + echo "curl failed with ${?}. See man curl for meaning." fi success_count=$((success_count + 1)) diff --git a/runtime/experiments/applications/imageresize/test/run.sh b/runtime/experiments/applications/imageresize/test/run.sh index be2390f..4fab433 100755 --- a/runtime/experiments/applications/imageresize/test/run.sh +++ b/runtime/experiments/applications/imageresize/test/run.sh @@ -16,7 +16,7 @@ fi if [ "$1" != "-d" ]; then PATH="$binary_directory:$PATH" LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" sledgert "$experiment_directory/spec.json" & - sleep 2 + sleep 3 else echo "Running under gdb" fi @@ -27,16 +27,20 @@ total_count=10 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.png" localhost:10000 2> /dev/null 1> /dev/null || exit 1 - pixel_differences="$(compare -identify -metric AE "result_$ext.png" expected_result.png null: 2>&1 > /dev/null)" + if curl -H 'Expect:' -H "Content-Type: image/jpg" --data-binary "@flower.jpg" --output "result_$ext.png" localhost:10000 2> /dev/null 1> /dev/null; then - if [[ "$pixel_differences" == "0" ]]; then - success_count=$((success_count + 1)) + pixel_differences="$(compare -identify -metric AE "result_$ext.png" expected_result.png null: 2>&1 > /dev/null)" + + if [[ "$pixel_differences" == "0" ]]; then + success_count=$((success_count + 1)) + else + echo "FAIL" + echo "$pixel_differences pixel differences detected" + exit 1 + fi else - echo "FAIL" - echo "$pixel_differences pixel differences detected" - exit 1 + echo "curl failed with ${?}. See man curl for meaning." fi done From 97818e5e322be51a9cf2b5f41281bc0c43b532aa Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 19:46:09 +0000 Subject: [PATCH 30/35] test: log bimodal --- runtime/experiments/bimodal/run.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/experiments/bimodal/run.sh b/runtime/experiments/bimodal/run.sh index fa63cb7..2b1400b 100755 --- a/runtime/experiments/bimodal/run.sh +++ b/runtime/experiments/bimodal/run.sh @@ -44,15 +44,15 @@ run_samples() { local -ir perf_window_buffer_size printf "Running Samples: " - hey -n "$perf_window_buffer_size" -c "$perf_window_buffer_size" -cpus 3 -t 0 -o csv -m GET -d "40\n" "http://${hostname}:10040" 1> /dev/null 2> /dev/null || { + hey -n "$perf_window_buffer_size" -c "$perf_window_buffer_size" -cpus 3 -t 0 -o csv -m GET -d "40\n" "http://${hostname}:10040" || { printf "[ERR]\n" - panic "fib40 samples failed" + panic "fib40 samples failed with $?" return 1 } - hey -n "$perf_window_buffer_size" -c "$perf_window_buffer_size" -cpus 3 -t 0 -o csv -m GET -d "10\n" "http://${hostname}:100010" 1> /dev/null 2> /dev/null || { + hey -n "$perf_window_buffer_size" -c "$perf_window_buffer_size" -cpus 3 -t 0 -o csv -m GET -d "10\n" "http://${hostname}:100010" || { printf "[ERR]\n" - panic "fib10 samples failed" + panic "fib10 samples failed with $?" return 1 } From 8efe2af17713d02ec9f3a35027853b596e749dff Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 20:05:23 +0000 Subject: [PATCH 31/35] chore: Install hey if needed --- runtime/experiments/bimodal/install.sh | 6 ++++++ runtime/experiments/bimodal/run.sh | 5 +++++ runtime/experiments/concurrency/install.sh | 6 ++++++ runtime/experiments/concurrency/run.sh | 5 +++++ runtime/experiments/payload/install.sh | 6 ++++++ runtime/experiments/payload/run.sh | 5 +++++ test.sh | 3 +++ 7 files changed, 36 insertions(+) create mode 100755 runtime/experiments/bimodal/install.sh create mode 100755 runtime/experiments/concurrency/install.sh create mode 100755 runtime/experiments/payload/install.sh diff --git a/runtime/experiments/bimodal/install.sh b/runtime/experiments/bimodal/install.sh new file mode 100755 index 0000000..8688ad7 --- /dev/null +++ b/runtime/experiments/bimodal/install.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +if ! command -v hey; then + HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 + wget $HEY_URL -O hey && chmod +x hey && mv hey /usr/bin/hey +fi diff --git a/runtime/experiments/bimodal/run.sh b/runtime/experiments/bimodal/run.sh index 2b1400b..73f77db 100755 --- a/runtime/experiments/bimodal/run.sh +++ b/runtime/experiments/bimodal/run.sh @@ -19,6 +19,11 @@ source get_result_count.sh || exit 1 source panic.sh || exit 1 source path_join.sh || exit 1 +if ! command -v hey; then + echo "hey is not present." + exit 1 +fi + # Sends requests until the per-module perf window buffers are full # This ensures that Sledge has accurate estimates of execution time run_samples() { diff --git a/runtime/experiments/concurrency/install.sh b/runtime/experiments/concurrency/install.sh new file mode 100755 index 0000000..8688ad7 --- /dev/null +++ b/runtime/experiments/concurrency/install.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +if ! command -v hey; then + HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 + wget $HEY_URL -O hey && chmod +x hey && mv hey /usr/bin/hey +fi diff --git a/runtime/experiments/concurrency/run.sh b/runtime/experiments/concurrency/run.sh index 0f69cd4..1f6b4ae 100755 --- a/runtime/experiments/concurrency/run.sh +++ b/runtime/experiments/concurrency/run.sh @@ -15,6 +15,11 @@ source get_result_count.sh || exit 1 source panic.sh || exit 1 source path_join.sh || exit 1 +if ! command -v hey; then + echo "hey is not present." + exit 1 +fi + declare -gi iterations=10000 declare -ga concurrency=(1 20 40 60 80 100) diff --git a/runtime/experiments/payload/install.sh b/runtime/experiments/payload/install.sh new file mode 100755 index 0000000..8688ad7 --- /dev/null +++ b/runtime/experiments/payload/install.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +if ! command -v hey; then + HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 + wget $HEY_URL -O hey && chmod +x hey && mv hey /usr/bin/hey +fi diff --git a/runtime/experiments/payload/run.sh b/runtime/experiments/payload/run.sh index 6d758c7..a389976 100755 --- a/runtime/experiments/payload/run.sh +++ b/runtime/experiments/payload/run.sh @@ -16,6 +16,11 @@ source "framework.sh" || exit 1 source "get_result_count.sh" || exit 1 source "generate_gnuplots.sh" || exit 1 +if ! command -v hey; then + echo "hey is not present." + exit 1 +fi + # Experiment Globals and Setups declare -ar payloads=(1024 10240 102400 1048576) diff --git a/test.sh b/test.sh index c4d5f7e..acb0ba6 100755 --- a/test.sh +++ b/test.sh @@ -166,6 +166,7 @@ bimodal() { make rttests -C "$base_dir/runtime/tests" || exit 1 fi pushd "$base_dir/runtime/experiments/bimodal/" || exit 1 + ./install.sh || exit 1 ./run.sh || failed_tests+=("bimodal") popd || exit 1 return 0 @@ -177,6 +178,7 @@ concurrency() { make rttests -C "$base_dir/runtime/tests" || exit 1 fi pushd "$base_dir/runtime/experiments/concurrency/" || exit 1 + ./install.sh || exit 1 ./run.sh || failed_tests+=("concurrency") popd || exit 1 return 0 @@ -192,6 +194,7 @@ payload() { fi # TODO: Make Dependency "work1k_wasm.so" "work10k_wasm.so" "work100k_wasm.so" "work1m_wasm.so" pushd "$base_dir/runtime/experiments/payload/" || exit 1 + ./install.sh || exit 1 ./run.sh || failed_tests+=("payload") popd || exit 1 return 0 From 7fdef275706fd100e6f0f3660e7fe7d530512d9a Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 20:18:10 +0000 Subject: [PATCH 32/35] chore: try sudo --- runtime/experiments/bimodal/install.sh | 2 +- runtime/experiments/concurrency/install.sh | 2 +- runtime/experiments/payload/install.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/experiments/bimodal/install.sh b/runtime/experiments/bimodal/install.sh index 8688ad7..58e6106 100755 --- a/runtime/experiments/bimodal/install.sh +++ b/runtime/experiments/bimodal/install.sh @@ -2,5 +2,5 @@ if ! command -v hey; then HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 - wget $HEY_URL -O hey && chmod +x hey && mv hey /usr/bin/hey + wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey fi diff --git a/runtime/experiments/concurrency/install.sh b/runtime/experiments/concurrency/install.sh index 8688ad7..58e6106 100755 --- a/runtime/experiments/concurrency/install.sh +++ b/runtime/experiments/concurrency/install.sh @@ -2,5 +2,5 @@ if ! command -v hey; then HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 - wget $HEY_URL -O hey && chmod +x hey && mv hey /usr/bin/hey + wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey fi diff --git a/runtime/experiments/payload/install.sh b/runtime/experiments/payload/install.sh index 8688ad7..58e6106 100755 --- a/runtime/experiments/payload/install.sh +++ b/runtime/experiments/payload/install.sh @@ -2,5 +2,5 @@ if ! command -v hey; then HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 - wget $HEY_URL -O hey && chmod +x hey && mv hey /usr/bin/hey + wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey fi From fd837a9ce57dc0f2326843db021eebc1a4aa89c0 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 20:37:15 +0000 Subject: [PATCH 33/35] chore: selectively use sudo --- runtime/experiments/bimodal/install.sh | 9 ++++++++- runtime/experiments/concurrency/install.sh | 9 ++++++++- runtime/experiments/payload/install.sh | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/runtime/experiments/bimodal/install.sh b/runtime/experiments/bimodal/install.sh index 58e6106..d5ec913 100755 --- a/runtime/experiments/bimodal/install.sh +++ b/runtime/experiments/bimodal/install.sh @@ -2,5 +2,12 @@ if ! command -v hey; then HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 - wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey + wget $HEY_URL -O hey + chmod +x hey + + if [[ $(whoami) == "root" ]]; then + mv hey /usr/bin/hey + else + sudo mv hey /usr/bin/hey + fi fi diff --git a/runtime/experiments/concurrency/install.sh b/runtime/experiments/concurrency/install.sh index 58e6106..d5ec913 100755 --- a/runtime/experiments/concurrency/install.sh +++ b/runtime/experiments/concurrency/install.sh @@ -2,5 +2,12 @@ if ! command -v hey; then HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 - wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey + wget $HEY_URL -O hey + chmod +x hey + + if [[ $(whoami) == "root" ]]; then + mv hey /usr/bin/hey + else + sudo mv hey /usr/bin/hey + fi fi diff --git a/runtime/experiments/payload/install.sh b/runtime/experiments/payload/install.sh index 58e6106..d5ec913 100755 --- a/runtime/experiments/payload/install.sh +++ b/runtime/experiments/payload/install.sh @@ -2,5 +2,12 @@ if ! command -v hey; then HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 - wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey + wget $HEY_URL -O hey + chmod +x hey + + if [[ $(whoami) == "root" ]]; then + mv hey /usr/bin/hey + else + sudo mv hey /usr/bin/hey + fi fi From 1b1050728183e5b3bdd19b75bf5287f71006e7e0 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 20:41:12 +0000 Subject: [PATCH 34/35] chore: add gnuplot --- .github/workflows/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 31c73e0..a89890a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -76,6 +76,7 @@ jobs: fonts-dejavu \ fonts-cascadia-code \ fonts-roboto \ + gnuplot \ imagemagick \ netpbm \ pango1.0-tools \ From 5c2877ff589642408af5c71dd175e178857aa771 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 22 Apr 2021 20:43:58 +0000 Subject: [PATCH 35/35] test: Silence hey in bimodal --- runtime/experiments/bimodal/run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/experiments/bimodal/run.sh b/runtime/experiments/bimodal/run.sh index 73f77db..a046470 100755 --- a/runtime/experiments/bimodal/run.sh +++ b/runtime/experiments/bimodal/run.sh @@ -49,13 +49,13 @@ run_samples() { local -ir perf_window_buffer_size printf "Running Samples: " - hey -n "$perf_window_buffer_size" -c "$perf_window_buffer_size" -cpus 3 -t 0 -o csv -m GET -d "40\n" "http://${hostname}:10040" || { + hey -n "$perf_window_buffer_size" -c "$perf_window_buffer_size" -cpus 3 -t 0 -o csv -m GET -d "40\n" "http://${hostname}:10040" 1> /dev/null 2> /dev/null || { printf "[ERR]\n" panic "fib40 samples failed with $?" return 1 } - hey -n "$perf_window_buffer_size" -c "$perf_window_buffer_size" -cpus 3 -t 0 -o csv -m GET -d "10\n" "http://${hostname}:100010" || { + hey -n "$perf_window_buffer_size" -c "$perf_window_buffer_size" -cpus 3 -t 0 -o csv -m GET -d "10\n" "http://${hostname}:100010" 1> /dev/null 2> /dev/null || { printf "[ERR]\n" panic "fib10 samples failed with $?" return 1