Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/develop/c/hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ With WasmEdge's AoT compiler, you will get higher performance.
# Compile the wasm file with wasmedge aot compiler
$ wasmedgec hello.wasm hello.wasm
# Run the native binary with wasmedge
$ wasmedge hello.wasm
$ wasmedge --run-mode=aot hello.wasm
```

## Example: Add function
Expand Down Expand Up @@ -114,7 +114,7 @@ We can further improve performance by using wasmedge AOT compilation , this feat

```bash
$ wasmedgec add.wasm add_aot.wasm
$ wasmedge add_aot.wasm 4 9
$ wasmedge --run-mode=aot add_aot.wasm 4 9
13
```

Expand Down
2 changes: 1 addition & 1 deletion docs/develop/c/simd.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ With WasmEdge's AoT compiler, you will get higher performance.
# Compile wasm-simd with wasmedge aot compiler
$ wasmedge compile mandelbrot-simd.wasm mandelbrot-simd-out.wasm
# Run the native binary with wasmedge
$ wasmedge mandelbrot-simd-out.wasm 15000
$ wasmedge --run-mode=aot mandelbrot-simd-out.wasm 15000
```
2 changes: 1 addition & 1 deletion docs/develop/deploy/kubernetes/docker-slim.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $ docker run -it --rm -v $PWD:/app wasmedge/slim:{{ wasmedge_version }} wasmedge
[2022-07-07 08:15:50.421] [info] compile done
[2022-07-07 08:15:50.422] [info] output start

$ docker run -it --rm -v $PWD:/app wasmedge/slim:{{ wasmedge_version }} wasmedge hello.aot.wasm world
$ docker run -it --rm -v $PWD:/app wasmedge/slim:{{ wasmedge_version }} wasmedge --run-mode=aot hello.aot.wasm world
hello
world
```
Expand Down
4 changes: 2 additions & 2 deletions docs/develop/go/hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ To achieve native Go performance for those applications, you could use the `wasm
```bash
$ wasmedge compile hello.wasm hello.wasm

$ wasmedge hello.wasm
$ wasmedge --run-mode=aot hello.wasm
Hello TinyGo from WasmEdge!
```

Expand All @@ -126,6 +126,6 @@ For the `--reactor` mode,
```bash
$ wasmedge compile fib.wasm fib.wasm

$ wasmedge --reactor fib.wasm fibArray 10
$ wasmedge --run-mode=aot --reactor fib.wasm fibArray 10
34
```
4 changes: 2 additions & 2 deletions docs/develop/javascript/hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The reason to use `wasmedge-quickjs` as the current working directory is that `m
You can try a simple "hello world" JavaScript program ([example_js/hello.js](https://github.com/second-state/wasmedge-quickjs/blob/main/example_js/hello.js)), which prints out the command line arguments to the console.

```bash
$ wasmedge --dir .:. wasmedge_quickjs.wasm example_js/hello.js WasmEdge Runtime
$ wasmedge --run-mode=aot --dir .:. wasmedge_quickjs.wasm example_js/hello.js WasmEdge Runtime
Hello WasmEdge Runtime
```

Expand Down Expand Up @@ -85,7 +85,7 @@ WasmEdge provides a `wasmedgec` utility to compile and add a native machine code

```bash
wasmedge compile target/wasm32-wasip1/release/wasmedge_quickjs.wasm wasmedge_quickjs.wasm
wasmedge --dir .:. wasmedge_quickjs.wasm example_js/hello.js
wasmedge --run-mode=aot --dir .:. wasmedge_quickjs.wasm example_js/hello.js
```

Next, we will discuss more advanced use cases for JavaScript in WasmEdge.
2 changes: 1 addition & 1 deletion docs/develop/javascript/tensorflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ print(max / 255);
To run the JavaScript in the WasmEdge runtime, make sure that you have the [WASI-NN plug-in and Tensorflow Lite dependency libraries installed with WasmEdge](../../start/install.md#wasi-nn-plug-in-with-tensorflow-lite-backend). You should see the food item's name recognized by the TensorFlow lite ImageNet model.

```bash
$ wasmedge --dir .:. wasmedge_quickjs_nn.wasm example_js/tensorflow_lite_demo/wasi_nn_main.js
$ wasmedge --run-mode=aot --dir .:. wasmedge_quickjs_nn.wasm example_js/tensorflow_lite_demo/wasi_nn_main.js
label:
Hot dog
confidence:
Expand Down
4 changes: 2 additions & 2 deletions docs/develop/rust/dapr.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dapr run --app-id image-api-grayscale \
--dapr-http-port 3503 \
--components-path ../config \
--log-level debug \
wasmedge image-api-grayscale.wasm
wasmedge --run-mode=aot image-api-grayscale.wasm
```

### The image classification microservice
Expand Down Expand Up @@ -116,7 +116,7 @@ dapr run --app-id events-service \
--dapr-http-port 3505 \
--log-level debug \
--components-path ../config \
wasmedge events_service.wasm
wasmedge --run-mode=aot events_service.wasm
```

## Test
Expand Down
4 changes: 2 additions & 2 deletions docs/develop/rust/hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ If we don't have extra notes for AoT, all the WASM file will be executed in the

```bash
wasmedge compile hello.wasm hello_aot.wasm
wasmedge hello_aot.wasm second state
wasmedge --run-mode=aot hello_aot.wasm second state
```

For the `--reactor` mode,

```bash
wasmedge compile add.wasm add_aot.wasm
wasmedge --reactor add_aot.wasm add 2 2
wasmedge --run-mode=aot --reactor add_aot.wasm add 2 2
```
8 changes: 4 additions & 4 deletions docs/develop/rust/http_service/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ wasmedge compile target/wasm32-wasip1/release/http.wasm http.wasm
wasmedge compile target/wasm32-wasip1/release/https.wasm https.wasm

# Run the HTTP GET and POST examples
wasmedge http.wasm
wasmedge --run-mode=aot http.wasm

# Run the HTTPS GET and POST examples
wasmedge https.wasm
wasmedge --run-mode=aot https.wasm
```

In your Rust application, import the standard [reqwest](https://crates.io/crates/reqwest) and [tokio](https://crates.io/crates/tokio) crates. You will also patch a few dependency crates to make them aware of the WasmEdge socket API. Just add the following lines to your `Cargo.toml`.
Expand Down Expand Up @@ -107,7 +107,7 @@ RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi
wasmedge compile target/wasm32-wasip1/release/wasmedge_hyper_client.wasm wasmedge_hyper_client.wasm

# Run the example
wasmedge wasmedge_hyper_client.wasm
wasmedge --run-mode=aot wasmedge_hyper_client.wasm
```

In your Rust application, import the [hyper](https://crates.io/crates/hyper) crate,
Expand All @@ -134,7 +134,7 @@ RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi
wasmedge compile target/wasm32-wasip1/release/wasmedge_hyper_client_https.wasm wasmedge_hyper_client_https.wasm

// Run
wasmedge wasmedge_hyper_client_https.wasm
wasmedge --run-mode=aot wasmedge_hyper_client_https.wasm
```

In the HTTPS version of `Cargo.toml`, you just need to import the standard [hyper-rustls](https://crates.io/crates/hyper-rustls), [rustls](https://crates.io/crates/rustls) and [webpki-roots](https://crates.io/crates/webpki-roots) crates with the same patches as above.
Expand Down
4 changes: 2 additions & 2 deletions docs/develop/rust/http_service/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi
wasmedge compile target/wasm32-wasip1/release/wasmedge_axum_server.wasm wasmedge_axum_server.wasm

# Run the example
wasmedge wasmedge_axum_server.wasm
wasmedge --run-mode=aot wasmedge_axum_server.wasm
```

Then from another terminal, you can request the server. The HTTP server echoes the request data and sends back the response.
Expand Down Expand Up @@ -108,7 +108,7 @@ RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi
wasmedge compile target/wasm32-wasip1/release/wasmedge_hyper_server.wasm wasmedge_hyper_server.wasm

# Run the example
wasmedge wasmedge_hyper_server.wasm
wasmedge --run-mode=aot wasmedge_hyper_server.wasm
```

Then from another terminal, you can request the server. The HTTP server echoes the request data and sends back the response.
Expand Down
4 changes: 2 additions & 2 deletions docs/develop/rust/socket_networking/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cargo build --target wasm32-wasip1 --release
wasmedge compile target/wasm32-wasip1/release/http_client.wasm http_client.wasm

# Run the example
wasmedge http_client.wasm
wasmedge --run-mode=aot http_client.wasm
```

The [source code](https://github.com/second-state/wasmedge_wasi_socket/tree/main/examples/http_client) for the HTTP client is available as follows.
Expand Down Expand Up @@ -74,7 +74,7 @@ cargo build --target wasm32-wasip1 --release
wasmedge compile target/wasm32-wasip1/release/nonblock_http_client.wasm nonblock_http_client.wasm

# Run the example
wasmedge nonblock_http_client.wasm
wasmedge --run-mode=aot nonblock_http_client.wasm
```

<!-- prettier-ignore -->
Expand Down
4 changes: 2 additions & 2 deletions docs/develop/rust/socket_networking/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cargo build --target wasm32-wasip1 --release
wasmedge compile target/wasm32-wasip1/release/http_server.wasm http_server.wasm

# Run the example
$wasmedge http_server.wasm
$wasmedge --run-mode=aot http_server.wasm
new connection at 1234
```

Expand Down Expand Up @@ -122,7 +122,7 @@ cargo build --target wasm32-wasip1 --release
wasmedge compile target/wasm32-wasip1/release/poll_tcp_listener.wasm poll_tcp_listener.wasm

# Run the example
wasmedge poll_tcp_listener.wasm
wasmedge --run-mode=aot poll_tcp_listener.wasm
```

You can submit an HTTP request via `curl` to test the HTTP server.
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/rust/wasinn/llm_inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ You can make the inference program run faster by AOT compiling the wasm file fir

```bash
wasmedge compile llama-chat.wasm llama-chat.wasm
wasmedge --dir .:. --nn-preload default:GGML:AUTO:Meta-Llama-3.1-8B-Instruct-Q5_K_M.gguf llama-chat.wasm -p llama-3-chat
wasmedge --run-mode=aot --dir .:. --nn-preload default:GGML:AUTO:Meta-Llama-3.1-8B-Instruct-Q5_K_M.gguf llama-chat.wasm -p llama-3-chat
```

## Understand the code
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/rust/wasinn/mediapipe.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Run the inference application against an image. The input `example.jpg` image is
![The input image](https://raw.githubusercontent.com/juntao/demo-object-detection/main/example.jpg)

```bash
wasmedge --dir .:. demo-object-detection.wasm example.jpg output.jpg
wasmedge --run-mode=aot --dir .:. demo-object-detection.wasm example.jpg output.jpg
```

The inference result `output.jpg` image is shown below.
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/rust/wasinn/openvino.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ You can make the inference program run faster by AOT compiling the `wasm` file f

```bash
wasmedge compile wasmedge-wasinn-example-mobilenet.wasm out.wasm
wasmedge --dir .:. out.wasm mobilenet.xml mobilenet.bin input.jpg
wasmedge --run-mode=aot --dir .:. out.wasm mobilenet.xml mobilenet.bin input.jpg
```

## Understand the code
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/rust/wasinn/pytorch.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ You can make the inference program run faster by AOT compiling the `wasm` file f

```bash
wasmedge compile wasmedge-wasinn-example-mobilenet.wasm out.wasm
wasmedge --dir .:. out.wasm mobilenet.pt input.jpg
wasmedge --run-mode=aot --dir .:. out.wasm mobilenet.pt input.jpg
```

## Understand the code
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/rust/wasinn/tensorflow_lite.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ You can make the inference program run faster by AOT compiling the `wasm` file f

```bash
wasmedge compile wasmedge-wasinn-example-tflite-bird-image.wasm out.wasm
wasmedge --dir .:. out.wasm lite-model_aiy_vision_classifier_birds_V1_3.tflite bird.jpg
wasmedge --run-mode=aot --dir .:. out.wasm lite-model_aiy_vision_classifier_birds_V1_3.tflite bird.jpg
```

## Understand the code
Expand Down
2 changes: 1 addition & 1 deletion docs/start/build-and-run/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ $ docker run -it --rm -v $PWD:/app wasmedge/slim:{{ wasmedge_version }} wasmedge
[2022-07-07 08:15:50.421] [info] compile done
[2022-07-07 08:15:50.422] [info] output start

$ docker run -it --rm -v $PWD:/app wasmedge/slim:{{ wasmedge_version }} wasmedge hello.aot.wasm world
$ docker run -it --rm -v $PWD:/app wasmedge/slim:{{ wasmedge_version }} wasmedge --run-mode=aot hello.aot.wasm world
hello
world
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ With WasmEdge's AoT compiler, you will get higher performance.
# Compile the wasm file with wasmedge aot compiler
$ wasmedgec hello.wasm hello.wasm
# Run the native binary with wasmedge
$ wasmedge hello.wasm
$ wasmedge --run-mode=aot hello.wasm
```

## Example: Add function
Expand Down Expand Up @@ -114,7 +114,7 @@ We can further improve performance by using wasmedge AOT compilation , this feat

```bash
$ wasmedgec add.wasm add_aot.wasm
$ wasmedge add_aot.wasm 4 9
$ wasmedge --run-mode=aot add_aot.wasm 4 9
13
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ With WasmEdge's AoT compiler, you will get higher performance.
# Compile wasm-simd with wasmedge aot compiler
$ wasmedge compile mandelbrot-simd.wasm mandelbrot-simd-out.wasm
# Run the native binary with wasmedge
$ wasmedge mandelbrot-simd-out.wasm 15000
$ wasmedge --run-mode=aot mandelbrot-simd-out.wasm 15000
```
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $ docker run -it --rm -v $PWD:/app wasmedge/slim:{{ wasmedge_version }} wasmedge
[2022-07-07 08:15:50.421] [info] compile done
[2022-07-07 08:15:50.422] [info] output start

$ docker run -it --rm -v $PWD:/app wasmedge/slim:{{ wasmedge_version }} wasmedge hello.aot.wasm world
$ docker run -it --rm -v $PWD:/app wasmedge/slim:{{ wasmedge_version }} wasmedge --run-mode=aot hello.aot.wasm world
hello
world
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ To achieve native Go performance for those applications, you could use the `wasm
```bash
$ wasmedge compile hello.wasm hello.wasm

$ wasmedge hello.wasm
$ wasmedge --run-mode=aot hello.wasm
Hello TinyGo from WasmEdge!
```

Expand All @@ -120,6 +120,6 @@ For the `--reactor` mode,
```bash
$ wasmedge compile fib.wasm fib.wasm

$ wasmedge --reactor fib.wasm fibArray 10
$ wasmedge --run-mode=aot --reactor fib.wasm fibArray 10
34
```
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The reason to use `wasmedge-quickjs` as the current working directory is that `m
You can try a simple "hello world" JavaScript program ([example_js/hello.js](https://github.com/second-state/wasmedge-quickjs/blob/main/example_js/hello.js)), which prints out the command line arguments to the console.

```bash
$ wasmedge --dir .:. wasmedge_quickjs.wasm example_js/hello.js WasmEdge Runtime
$ wasmedge --run-mode=aot --dir .:. wasmedge_quickjs.wasm example_js/hello.js WasmEdge Runtime
Hello WasmEdge Runtime
```

Expand Down Expand Up @@ -85,7 +85,7 @@ WasmEdge provides a `wasmedgec` utility to compile and add a native machine code

```bash
wasmedge compile target/wasm32-wasip1/release/wasmedge_quickjs.wasm wasmedge_quickjs.wasm
wasmedge --dir .:. wasmedge_quickjs.wasm example_js/hello.js
wasmedge --run-mode=aot --dir .:. wasmedge_quickjs.wasm example_js/hello.js
```

Next, we will discuss more advanced use cases for JavaScript in WasmEdge.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ print(max / 255);
To run the JavaScript in the WasmEdge runtime, make sure that you have the [WASI-NN plug-in and Tensorflow Lite dependency libraries installed with WasmEdge](../../start/install.md#wasi-nn-plug-in-with-tensorflow-lite-backend). You should see the food item's name recognized by the TensorFlow lite ImageNet model.

```bash
$ wasmedge --dir .:. wasmedge_quickjs_nn.wasm example_js/tensorflow_lite_demo/wasi_nn_main.js
$ wasmedge --run-mode=aot --dir .:. wasmedge_quickjs_nn.wasm example_js/tensorflow_lite_demo/wasi_nn_main.js
label:
Hot dog
confidence:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dapr run --app-id image-api-grayscale \
--dapr-http-port 3503 \
--components-path ../config \
--log-level debug \
wasmedge image-api-grayscale.wasm
wasmedge --run-mode=aot image-api-grayscale.wasm
```

### The image classification microservice
Expand Down Expand Up @@ -116,7 +116,7 @@ dapr run --app-id events-service \
--dapr-http-port 3505 \
--log-level debug \
--components-path ../config \
wasmedge events_service.wasm
wasmedge --run-mode=aot events_service.wasm
```

## Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ If we don't have extra notes for AoT, all the WASM file will be executed in the
```bash
$ wasmedge compile hello.wasm hello_aot.wasm

$ wasmedge hello_aot.wasm second state
$ wasmedge --run-mode=aot hello_aot.wasm second state
hello
second
state
Expand All @@ -85,6 +85,6 @@ For the `--reactor` mode,
```bash
$ wasmedge compile add.wasm add_aot.wasm

$ wasmedge --reactor add_aot.wasm add 2 2
$ wasmedge --run-mode=aot --reactor add_aot.wasm add 2 2
4
```
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ wasmedge compile target/wasm32-wasip1/release/http.wasm http.wasm
wasmedge compile target/wasm32-wasip1/release/https.wasm https.wasm

# Run the HTTP GET and POST examples
wasmedge http.wasm
wasmedge --run-mode=aot http.wasm

# Run the HTTPS GET and POST examples
wasmedge https.wasm
wasmedge --run-mode=aot https.wasm
```

In your Rust application, import the standard [reqwest](https://crates.io/crates/reqwest) and [tokio](https://crates.io/crates/tokio) crates. You will also patch a few dependency crates to make them aware of the WasmEdge socket API. Just add the following lines to your `Cargo.toml`.
Expand Down Expand Up @@ -107,7 +107,7 @@ RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi
wasmedge compile target/wasm32-wasip1/release/wasmedge_hyper_client.wasm wasmedge_hyper_client.wasm

# Run the example
wasmedge wasmedge_hyper_client.wasm
wasmedge --run-mode=aot wasmedge_hyper_client.wasm
```

In your Rust application, import the [hyper](https://crates.io/crates/hyper) crate,
Expand All @@ -134,7 +134,7 @@ RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi
wasmedge compile target/wasm32-wasip1/release/wasmedge_hyper_client_https.wasm wasmedge_hyper_client_https.wasm

// Run
wasmedge wasmedge_hyper_client_https.wasm
wasmedge --run-mode=aot wasmedge_hyper_client_https.wasm
```

In the HTTPS version of `Cargo.toml`, you just need to import the standard [hyper-rustls](https://crates.io/crates/hyper-rustls), [rustls](https://crates.io/crates/rustls) and [webpki-roots](https://crates.io/crates/webpki-roots) crates with the same patches as above.
Expand Down
Loading
Loading