chore: Move apps

master
Sean McBride 3 years ago
parent 03ed5c8133
commit ea728b013b

@ -24,6 +24,6 @@
], ],
"workspaceMount": "source=${localWorkspaceFolder},target=/sledge,type=bind,consistency=cached", "workspaceMount": "source=${localWorkspaceFolder},target=/sledge,type=bind,consistency=cached",
"workspaceFolder": "/sledge", "workspaceFolder": "/sledge",
"postCreateCommand": "make -C /sledge install && make -B -C /sledge/runtime/tests clean all", "postCreateCommand": "make -C /sledge install && make -B -C /sledge/applications clean all",
"containerUser": "dev", "containerUser": "dev",
} }

@ -101,7 +101,7 @@ jobs:
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ./runtime/bin/gocr_wasm.so path: ./runtime/bin/gocr_wasm.so
key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/Makefile', './runtime/tests/gocr/**', './runtime/compiletime/**') }} key: ${{ runner.os }}-gocr2-${{ hashFiles('./applications/Makefile', './applications/gocr/**', './runtime/compiletime/**') }}
if: success() || failure() if: success() || failure()
- name: Hyde - name: Hyde
run: | run: |
@ -138,7 +138,7 @@ jobs:
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ./runtime/bin/ekf_wasm.so path: ./runtime/bin/ekf_wasm.so
key: ${{ runner.os }}-gocr2-${{ hashFiles('./runtime/tests/Makefile', './runtime/tests/TinyEKF/**', './runtime/compiletime/**') }} key: ${{ runner.os }}-gocr2-${{ hashFiles('./applications/Makefile', './applications/TinyEKF/**', './runtime/compiletime/**') }}
if: success() || failure() if: success() || failure()
- name: EKF one iteration - name: EKF one iteration
run: | run: |

8
.gitignore vendored

@ -52,10 +52,10 @@ dkms.conf
runtime/tags runtime/tags
runtime/bin runtime/bin
runtime/tests/tmp/ applications/tmp/
runtime/tests/**/*.csv applications/**/*.csv
runtime/tests/**/*.txt applications/**/*.txt
runtime/tests/**/*.xlsx applications/**/*.xlsx
# Swap Files # Swap Files
*.swp *.swp

10
.gitmodules vendored

@ -12,22 +12,22 @@ url = https://github.com/gwsystems/ck.git
path = runtime/thirdparty/jsmn path = runtime/thirdparty/jsmn
url = https://github.com/gwsystems/jsmn.git url = https://github.com/gwsystems/jsmn.git
[submodule "runtime/tests/gocr"] [submodule "runtime/tests/gocr"]
path = runtime/tests/gocr path = applications/wasmception_apps/gocr
url = https://github.com/gwsystems/gocr.git url = https://github.com/gwsystems/gocr.git
branch = sledge branch = sledge
[submodule "runtime/tests/TinyEKF"] [submodule "runtime/tests/TinyEKF"]
path = runtime/tests/TinyEKF path = applications/wasmception_apps/TinyEKF
url = https://github.com/gwsystems/TinyEKF.git url = https://github.com/gwsystems/TinyEKF.git
branch = sledge branch = sledge
[submodule "runtime/tests/CMSIS_5_NN"] [submodule "runtime/tests/CMSIS_5_NN"]
path = runtime/tests/CMSIS_5_NN path = applications/wasmception_apps/CMSIS_5_NN
url = https://github.com/gwsystems/CMSIS_5_NN.git url = https://github.com/gwsystems/CMSIS_5_NN.git
branch = sledge branch = sledge
[submodule "runtime/tests/sod"] [submodule "runtime/tests/sod"]
path = runtime/tests/sod path = applications/wasmception_apps/sod
url = https://github.com/gwsystems/sod.git url = https://github.com/gwsystems/sod.git
branch = sledge branch = sledge
[submodule "runtime/tests/speechtotext"] [submodule "runtime/tests/speechtotext"]
path = runtime/tests/speechtotext path = applications/wasmception_apps/speechtotext
url = https://github.com/gwsystems/speechtotext.git url = https://github.com/gwsystems/speechtotext.git
branch = sledge branch = sledge

@ -33,10 +33,10 @@ cd /sledge/runtime
make clean all make clean all
``` ```
There are a set of benchmarking applications in the `/sledge/runtime/tests` directory. Run the following to compile all benchmarks runtime tests using the aWsm compiler and then copy all resulting `<application>_wasm.so` files to /sledge/runtime/bin. There are a set of benchmarking applications in the `/sledge/applications` directory. Run the following to compile all benchmarks runtime tests using the aWsm compiler and then copy all resulting `<application>_wasm.so` files to /sledge/runtime/bin.
```bash ```bash
cd /sledge/runtime/tests/ cd /sledge/applications/
make clean all make clean all
``` ```
@ -85,7 +85,7 @@ From the root project directory of the host environment (not the Docker containe
cd runtime/bin/ cd runtime/bin/
``` ```
Now run the sledgert binary, passing the JSON file of the serverless function we want to serve. Because serverless functions are loaded by SLEdge as shared libraries, we want to add the `runtime/tests/` directory to LD_LIBRARY_PATH. Now run the sledgert binary, passing the JSON file of the serverless function we want to serve. Because serverless functions are loaded by SLEdge as shared libraries, we want to add the `applications/` directory to LD_LIBRARY_PATH.
```bash ```bash
LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_fibonacci.json LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/test_fibonacci.json

@ -0,0 +1,123 @@
AWSMCC=awsm
CC=clang
# Used by aWsm when compiling the *.wasm to *.bc
AWSMFLAGS= --inline-constant-globals --runtime-globals
# Used by clang when compiling the *.so module
# --whole-archive causes the symbols in the listed static archive to be exported from the resulting *.so
# https://stackoverflow.com/questions/805555/ld-linker-question-the-whole-archive-option
CFLAGS=-O3 -flto
LDFLAGS=-fPIC -Wl
# LDFLAGS=-flto -fvisibility=hidden
# Compiletime Components to link into *.so
SLEDGE_BASE_DIR=../
SLEDGE_RT_DIR=${SLEDGE_BASE_DIR}/runtime/
SLEDGE_COMPILETIME_INC=${SLEDGE_RT_DIR}/include
SLEDGE_COMPILETIME_SRC=${SLEDGE_RT_DIR}/compiletime/*.c
.PHONY: all
all: \
cifar10.install \
empty.install \
ekf.install \
fibonacci.install \
gocr.install \
lpd.install \
resize.install
.PHONY: clean
clean:
@make clean -C ./wasmception_apps/fibonacci
@make clean -C ./wasmception_apps/empty
@make clean -C ./wasmception_apps/TinyEKF/extras/c/ -f wasm.mk
@make clean -C ./wasmception_apps/CMSIS_5_NN/ -f Makefile
@make clean -C ./wasmception_apps/gocr/src/ -f wasm.mk
@make clean -C ./wasmception_apps/sod/
@rm -f *.wasm
@rm -rf dist
@rm -f ../runtime/bin/*.so
dist:
mkdir -p dist
%.bc: %.wasm dist
${AWSMCC} ${AWSMFLAGS} $< -o $@
%_wasm.so: %.bc ${SLEDGE_COMPILETIME_SRC}
mkdir -p dist
${CC} --shared -fPIC ${OPTFLAGS} -I${SLEDGE_COMPILETIME_INC} $^ -o $@
../runtime/bin/%_wasm.so: dist/%_wasm.so
cp $^ $@
# Fibonacci
./wasmception_apps/fibonacci/fibonacci.wasm:
@make fibonacci.wasm -C ./wasmception_apps/fibonacci
dist/fibonacci.wasm: ./wasmception_apps/fibonacci/fibonacci.wasm dist
@cp ./wasmception_apps/fibonacci/fibonacci.wasm dist/fibonacci.wasm
.PHONY: fibonacci.install
fibonacci.install: ../runtime/bin/fibonacci_wasm.so
# Empty
./wasmception_apps/empty/empty.wasm:
@make empty.wasm -C ./wasmception_apps/empty
dist/empty.wasm: ./wasmception_apps/empty/empty.wasm dist
@cp ./wasmception_apps/empty/empty.wasm dist/empty.wasm
.PHONY: empty.install
empty.install: ../runtime/bin/empty_wasm.so
# EKF
./wasmception_apps/TinyEKF/extras/c/gps_ekf_fn.wasm:
@make gps_ekf_fn.wasm -C ./wasmception_apps/TinyEKF/extras/c/ -f wasm.mk
dist/ekf.wasm: ./wasmception_apps/TinyEKF/extras/c/gps_ekf_fn.wasm dist
@cp ./wasmception_apps/TinyEKF/extras/c/gps_ekf_fn.wasm dist/ekf.wasm
.PHONY: ekf.install
ekf.install: ../runtime/bin/ekf_wasm.so
# CIFAR10
./wasmception_apps/CMSIS_5_NN/cifar10.wasm:
@make cifar10.wasm -C ./wasmception_apps/CMSIS_5_NN/ -f Makefile
dist/cifar10.wasm: ./wasmception_apps/CMSIS_5_NN/cifar10.wasm dist
@cp ./wasmception_apps/CMSIS_5_NN/cifar10.wasm dist/cifar10.wasm
.PHONY: cifar10.install
cifar10.install: ../runtime/bin/cifar10_wasm.so
# GOCR
./wasmception_apps/gocr/src/gocr.wasm:
@make gocr.wasm -C ./wasmception_apps/gocr/src/ -f wasm.mk
dist/gocr.wasm: ./wasmception_apps/gocr/src/gocr.wasm dist
@cp ./wasmception_apps/gocr/src/gocr.wasm dist/gocr.wasm
.PHONY: gocr.install
gocr.install: ../runtime/bin/gocr_wasm.so
# LPD
./wasmception_apps/sod/bin/license_plate_detection.wasm:
@make dir license_plate_detection.wasm -C ./wasmception_apps/sod/
dist/lpd.wasm: ./wasmception_apps/sod/bin/license_plate_detection.wasm dist
@cp ./wasmception_apps/sod/bin/license_plate_detection.wasm dist/lpd.wasm
.PHONY: lpd.install
lpd.install: ../runtime/bin/lpd_wasm.so
# Resize
./wasmception_apps/sod/bin/resize_image.wasm:
@make dir resize_image.wasm -C ./wasmception_apps/sod/
dist/resize.wasm: ./wasmception_apps/sod/bin/resize_image.wasm dist
@cp ./wasmception_apps/sod/bin/resize_image.wasm dist/resize.wasm
.PHONY: resize.install
resize.install: ../runtime/bin/resize_wasm.so

@ -43,14 +43,14 @@ help() {
dry_run() { dry_run() {
find runtime \ find runtime \
\( -path "runtime/thirdparty" -o -path "runtime/tests/gocr" -o -path "runtime/tests/TinyEKF" -o -path "runtime/tests/CMSIS_5_NN" -o -path "runtime/tests/sod" -o -path "runtime/tests/**/thirdparty" \) -prune -false -o \ \( -path "runtime/thirdparty" -o -path "applications/gocr" -o -path "applications/TinyEKF" -o -path "applications/CMSIS_5_NN" -o -path "applications/sod" -o -path "applications/**/thirdparty" \) -prune -false -o \
-type f \( -iname \*.h -o -iname \*.c -o -iname \*.s \) -print \ -type f \( -iname \*.h -o -iname \*.c -o -iname \*.s \) -print \
| xargs clang-format -Werror -n -ferror-limit=0 | xargs clang-format -Werror -n -ferror-limit=0
} }
format() { format() {
find runtime \ find runtime \
\( -path "runtime/thirdparty" -o -path "runtime/tests/gocr" -o -path "runtime/tests/TinyEKF" -o -path "runtime/tests/CMSIS_5_NN" -o -path "runtime/tests/sod" -o -path "runtime/tests/**/thirdparty" \) -prune -false -o \ \( -path "runtime/thirdparty" -o -path "applications/gocr" -o -path "applications/TinyEKF" -o -path "applications/CMSIS_5_NN" -o -path "applications/sod" -o -path "applications/**/thirdparty" \) -prune -false -o \
-type f \( -iname \*.h -o -iname \*.c -o -iname \*.s \) -print \ -type f \( -iname \*.h -o -iname \*.c -o -iname \*.s \) -print \
| xargs clang-format -i | xargs clang-format -i
} }

@ -8,7 +8,7 @@ The `rust.sh` script stores per-run results to temporary files suffixed with `*.
In order to be compatible with the stdin/stdout model of serverless, the input and output files are binary concatenations of various C structs. 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. See `main()` in `applications/TinyEKF/extras/c/gps_ekf_fn.c` for specifics.
## Useful parsing of the log ## Useful parsing of the log

@ -4,6 +4,6 @@ Executes TinyEKF as shows by [You Chong's GPS example](http://www.mathworks.com/
In order to be compatible with the stdin/stdout model of serverless, the input and output files are binary concatenations of various C structs. 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. See `main()` in `applications/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`. This test executes multiple iterations, comparing the binary result against a known memoized result stored at `expected_result.dat`.

@ -60,7 +60,7 @@ validate_dependencies curl compare
# Copy Flower Image if not here # Copy Flower Image if not here
if [[ ! -f "./flower.jpg" ]]; then if [[ ! -f "./flower.jpg" ]]; then
cp "$__run_sh__project_base_absolute_path/runtime/tests/sod/bin/flower.jpg" ./flower.jpg cp "$__run_sh__project_base_absolute_path/applications/sod/bin/flower.jpg" ./flower.jpg
fi fi
framework_init "$@" framework_init "$@"

@ -1,103 +0,0 @@
AWSMCC=awsm
CC=clang
OPTFLAGS=-O3 -flto
# Compiletime Components to link into *.so
SLEDGE_BASE_DIR=../../
SLEDGE_RT_DIR=${SLEDGE_BASE_DIR}/runtime/
SLEDGE_COMPILETIME_INC=${SLEDGE_RT_DIR}/include
SLEDGE_COMPILETIME_SRC=${SLEDGE_RT_DIR}/compiletime/*.c
.PHONY: all
all: fibonacci.install empty.install ekf.install cifar10.install gocr.install lpd.install resize.install
.PHONY: clean
clean:
@make clean -C ./fibonacci
@make clean -C ./empty
@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/
@rm -f *.wasm
@rm -f ../../runtime/bin/*.so
%.bc: %.wasm
${AWSMCC} --inline-constant-globals --runtime-globals $^ -o $@
%_wasm.so: %.bc ${SLEDGE_COMPILETIME_SRC}
${CC} --shared -fPIC ${OPTFLAGS} -I${SLEDGE_COMPILETIME_INC} $^ -o $@
../../runtime/bin/%.so: %.so
cp $^ $@
# Fibonacci
./fibonacci/fibonacci.wasm:
@make fibonacci.wasm -C ./fibonacci
fibonacci.wasm: ./fibonacci/fibonacci.wasm
@cp ./fibonacci/fibonacci.wasm fibonacci.wasm
.PHONY: fibonacci.install
fibonacci.install: ../../runtime/bin/fibonacci_wasm.so
# Empty
./empty/empty.wasm:
@make empty.wasm -C ./empty
empty.wasm: ./empty/empty.wasm
@cp ./empty/empty.wasm empty.wasm
.PHONY: empty.install
empty.install: ../../runtime/bin/empty_wasm.so
# EKF
./TinyEKF/extras/c/gps_ekf_fn.wasm:
@make gps_ekf_fn.wasm -C ./TinyEKF/extras/c/ -f wasm.mk
ekf.wasm: ./TinyEKF/extras/c/gps_ekf_fn.wasm
@cp ./TinyEKF/extras/c/gps_ekf_fn.wasm ekf.wasm
.PHONY: ekf.install
ekf.install: ../../runtime/bin/ekf_wasm.so
# CIFAR10
./CMSIS_5_NN/cifar10.wasm:
@make cifar10.wasm -C ./CMSIS_5_NN/ -f Makefile
cifar10.wasm: ./CMSIS_5_NN/cifar10.wasm
@cp ./CMSIS_5_NN/cifar10.wasm cifar10.wasm
.PHONY: cifar10.install
cifar10.install: ../../runtime/bin/cifar10_wasm.so
# GOCR
./gocr/src/gocr.wasm:
@make gocr.wasm -C ./gocr/src/ -f wasm.mk
gocr.wasm: ./gocr/src/gocr.wasm
@cp ./gocr/src/gocr.wasm gocr.wasm
.PHONY: gocr.install
gocr.install: ../../runtime/bin/gocr_wasm.so
# LPD
./sod/bin/license_plate_detection.wasm:
@make dir license_plate_detection.wasm -C ./sod/
lpd.wasm: ./sod/bin/license_plate_detection.wasm
@cp ./sod/bin/license_plate_detection.wasm lpd.wasm
.PHONY: lpd.install
lpd.install: ../../runtime/bin/lpd_wasm.so
# Resize
./sod/bin/resize_image.wasm:
@make dir resize_image.wasm -C ./sod/
resize.wasm: ./sod/bin/resize_image.wasm
@cp ./sod/bin/resize_image.wasm resize.wasm
.PHONY: resize.install
resize.install: ../../runtime/bin/resize_wasm.so

@ -5,7 +5,7 @@
# gocr - GNU Optical Character Recognition # gocr - GNU Optical Character Recognition
./runtime/bin/gocr_wasm.so: ./runtime/bin/gocr_wasm.so:
make gocr.install -C ./runtime/tests make gocr.install -C ./applications
PHONY: gocr__by_dpi PHONY: gocr__by_dpi
gocr__by_dpi: ./runtime/bin/gocr_wasm.so gocr__by_dpi: ./runtime/bin/gocr_wasm.so
@ -43,7 +43,7 @@ gocr__all: \
# Extended Kalman Filter applied to binary GPS data # Extended Kalman Filter applied to binary GPS data
./runtime/bin/ekf_wasm.so: ./runtime/bin/ekf_wasm.so:
make ekf.install -C ./runtime/tests make ekf.install -C ./applications
PHONY: ekf__by_iteration PHONY: ekf__by_iteration
ekf__by_iteration: ./runtime/bin/ekf_wasm.so ekf__by_iteration: ./runtime/bin/ekf_wasm.so
@ -60,7 +60,7 @@ ekf__all: \
# CIFAR10-based Image Classification # CIFAR10-based Image Classification
./runtime/bin/cifar10_wasm.so: ./runtime/bin/cifar10_wasm.so:
make cifar10.install -C ./runtime/tests make cifar10.install -C ./applications
PHONY: cifar10__image_classification PHONY: cifar10__image_classification
cifar10__image_classification: ./runtime/bin/cifar10_wasm.so cifar10__image_classification: ./runtime/bin/cifar10_wasm.so
@ -75,7 +75,7 @@ cifar10__all: \
# SOD - Image Resize # SOD - Image Resize
./runtime/bin/resize_wasm.so: ./runtime/bin/resize_wasm.so:
make resize.install -C ./runtime/tests make resize.install -C ./applications
# Commented out command installs imagemagick. Requires password for sudo to install # Commented out command installs imagemagick. Requires password for sudo to install
PHONY: sod__image_resize__test PHONY: sod__image_resize__test
@ -90,7 +90,7 @@ sod__image_resize__by_resolution: ./runtime/bin/resize_wasm.so
# SOD - License Plate Detection # SOD - License Plate Detection
./runtime/bin/lpd_wasm.so: ./runtime/bin/lpd_wasm.so:
make lpd.install -C ./runtime/tests make lpd.install -C ./applications
PHONY: sod__lpd__by_plate_count PHONY: sod__lpd__by_plate_count
sod__lpd__by_plate_count: ./runtime/bin/lpd_wasm.so sod__lpd__by_plate_count: ./runtime/bin/lpd_wasm.so
@ -101,14 +101,14 @@ sod__all: sod__image_resize__test sod__image_resize__by_resolution sod__lpd__by_
# Scheduler Experiments with synthetic workloads # Scheduler Experiments with synthetic workloads
./runtime/bin/fibonacci_wasm.so: ./runtime/bin/fibonacci_wasm.so:
make fibonacci.install -C ./runtime/tests make fibonacci.install -C ./applications
PHONY: fibonacci__bimodal PHONY: fibonacci__bimodal
fibonacci__bimodal: ./runtime/bin/fibonacci_wasm.so fibonacci__bimodal: ./runtime/bin/fibonacci_wasm.so
cd ./runtime/experiments/bimodal/ && ./run.sh cd ./runtime/experiments/bimodal/ && ./run.sh
./runtime/bin/empty_wasm.so: ./runtime/bin/empty_wasm.so:
make empty.install -C ./runtime/tests make empty.install -C ./applications
PHONY: empty__concurrency PHONY: empty__concurrency
empty__concurrency: ./runtime/bin/empty_wasm.so empty__concurrency: ./runtime/bin/empty_wasm.so

Loading…
Cancel
Save