-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
5,187 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-101 KB
(96%)
benchmarks/image-classification/image-classification-benchmark.wasm
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM rust:1.78 AS builder | ||
RUN rustup target add wasm32-wasi | ||
RUN mkdir /benchmark | ||
WORKDIR /usr/src | ||
|
||
# Compile mobile_net_v2_onnx | ||
ADD mobile_net_v2_onnx rust-benchmark | ||
WORKDIR /usr/src/rust-benchmark | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN (cd mobile_net_v2_onnx; cargo build --release --target wasm32-wasi) | ||
RUN cp target/wasm32-wasi/release/*benchmark.wasm /benchmark/mobile_net_v2_onnx_benchmark.wasm | ||
WORKDIR /usr/src | ||
RUN rm -rf rust-benchmark | ||
|
||
|
||
# Compile mobile_net_v2_tensorflow | ||
ADD mobile_net_v2_tensorflow rust-benchmark | ||
WORKDIR /usr/src/rust-benchmark | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN (cd mobile_net_v2_tensorflow; cargo build --release --target wasm32-wasi) | ||
RUN cp target/wasm32-wasi/release/*benchmark.wasm /benchmark/mobile_net_v2_tensorflow_benchmark.wasm | ||
RUN cp assets/mobilenet_v2_1.4_224_frozen.pb /benchmark/mobilenet_v2_1.4_224_frozen.pb | ||
WORKDIR /usr/src | ||
RUN rm -rf rust-benchmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM rust:1.78 AS builder | ||
RUN mkdir /benchmark | ||
|
||
# Copy onnx to the `src` directory. | ||
ENV SRC=/usr/src/mobile_net_v2_onnx/ | ||
WORKDIR $SRC | ||
ADD mobile_net_v2_onnx rust-benchmark | ||
COPY mobile_net_v2_onnx_native.patch ./ | ||
COPY build_mobile_net_v2_onnx_native.sh ./ | ||
COPY libengine.so /usr/lib/ | ||
|
||
# Compile each of the benchmarks into the `/benchmark` directory. | ||
RUN ./build-native.sh | ||
|
||
# We copy the shared libraries to the `/benchmark` directory, where the client | ||
# expects it. | ||
WORKDIR /benchmark | ||
RUN cp $SRC/*so ./mobile_net_v2_onnx_benchmark.so | ||
RUN rm -rf rust-benchmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Image Classification Wasmtime Benchmark | ||
|
||
A benchmark that runs an image classifier in pure Wasm. This can be used to | ||
benchmark the performance of float heavy computations. | ||
|
||
Note that the classifier model is not included in the repo because it is large | ||
and is instead downloaded if needed when running the `setup.sh` script. |
13 changes: 13 additions & 0 deletions
13
benchmarks/inference_tract/build_mobile_net_v2_onnx_native.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Build inference_tract benchmark as a native shared library (Linux-only). | ||
# | ||
# Usage: ./build_mobile_net_v2_onnx_native.sh | ||
|
||
(set -x;) | ||
(rm -rf mobile_net_v2_onnx_native); | ||
(cp -r mobile_net_v2_onnx mobile_net_v2_onnx_native); | ||
(cp mobile_net_v2_onnx_native.patch mobile_net_v2_onnx_native); | ||
(cd mobile_net_v2_onnx_native; patch -Np1 -i ./mobile_net_v2_onnx_native.patch; mv src/main.rs src/lib.rs; cd -); | ||
(cd mobile_net_v2_onnx_native; cargo build --release; cp target/release/libbenchmark.so ../mobile_net_v2_onnx_benchmark.so; cd -); | ||
(set +x;) |
13 changes: 13 additions & 0 deletions
13
benchmarks/inference_tract/build_mobile_net_v2_tensorflow_native.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Build inference_tract benchmark as native shared library (Linux-only). | ||
# | ||
# Usage: ./build_mobile_net_v2_tensorflow_native.sh | ||
|
||
(set -x;) | ||
(rm -rf mobile_net_v2_tensorflow_native); | ||
(cp -r mobile_net_v2_tensorflow mobile_net_v2_tensorflow_native); | ||
(cp mobile_net_v2_tensorflow_native.patch mobile_net_v2_tensorflow_native); | ||
(cd mobile_net_v2_tensorflow_native; patch -Np1 -i ./mobile_net_v2_tensorflow_native.patch; mv src/main.rs src/lib.rs; cd -); | ||
(cd mobile_net_v2_tensorflow_native; cargo build --release; cp target/release/libbenchmark.so ../mobile_net_v2_tensorflow_benchmark.so; cd -); | ||
(set +x;) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.