README
¶
WasmEdge for Go Package
The WasmEdge is a high performance WebAssembly runtime optimized for server side applications. This project provides a golang package for accessing to WasmEdge.
- For a complete tutorial, please read the article Extend Your Golang App with Embedded WebAssembly Functions in WasmEdge, which demonstrates how to embed a Wasm function and how to embed a full Wasm program from the Golang app.
- WasmEdge in real-time data strems: AI Inference for Real-time Data Streams with WasmEdge and YoMo
- For more examples, please go to the WasmEdge-go-examples repo. Contributing your own example is much appreciated.
Getting Started
The WasmEdge-go requires golang version >= 1.16. Please check your golang version before installation.
Developers can download golang here.
$ go version
go version go1.16.5 linux/amd64
Developers must install the WasmEdge shared library with the same WasmEdge-go release version.
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v 0.12.0-alpha.2
For the developers need the TensorFlow or Image extension for WasmEdge-go, please install the WasmEdge with extensions:
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -e all --dist manylinux2014 -v 0.12.0-alpha.2
Due to the compatibility of
Ubuntu 20.04WasmEdge andmanylinux2014extensions, please forcibly assign themanylinux2014target. We'll fix this issue soon.
Noticed that the TensorFlow and Image extensions are only for the Linux platforms.
The TensorFlow and Image extensions for darwin x86_64 platforms are in the preview stage and unstable now.
Install the WasmEdge-go package and build in your Go project directory:
go get github.com/second-state/WasmEdge-go/wasmedge@v0.12.0-alpha.2
go build
WasmEdge-go Extensions
By default, the WasmEdge-go only turns on the basic runtime.
WasmEdge-go has the following extensions:
-
Tensorflow
-
This extension supports the host functions in WasmEdge-tensorflow, includes both
TensorFlowandTensorFlow-Lite. -
The
TensorFlowextension when installingWasmEdgeis required. Please installWasmEdgewith the-e tensorflowcommand. -
For using this extension, the tag
tensorflowwhen building is required:go build -tags tensorflow
-
-
Tensorfloe-Lite
-
This extension supports the host functions in WasmEdge-tensorflow with only
TensorFlow-Lite. -
The
TensorFlowextension when installingWasmEdgeis required. Please installWasmEdgewith the-e tensorflowcommand. -
For the
aarch64platforms which only supportsTensorFlow-Lite, please build with this tag. -
THIS TAG CANNOT BE USED WITH THE
tensorflowTAG. -
For using this extension, the tag
tensorflowlitewhen building is required:go build -tags tensorflowlite
-
-
Image
-
This extension supports the host functions in WasmEdge-image.
-
The
Imageextension when installingWasmEdgeis required. Please installWasmEdgewith the-e imagecommand. -
For using this extension, the tag
imagewhen building is required:go build -tags image
-
Users can also turn on the multiple extensions when building:
go build -tags image,tensorflow
For examples, please refer to the example repository.
WasmEdge-go Documentation
Please refer to the API Documentation for details.