A simple hello world function exists at .
From the Faasm CLI, you can compile, upload and invoke the function with:
You should then see the response Hello faasm!
.
Writing functions
The outline of this looks like:
Although for very simple functions, a standard int main()
will also still work.
Faasm provides a simple C++ wrapper library around the .Some of the methods in this wrapper are:
- - allows functions to retrieve their input data
faasmSetOutput()
- this allows functions to return output data to the caller- - waits for a chained function invocation to finish
faasmReadState()
andwriteState()
- allows functions to read/ write key/value state- and
faasmWriteStateOffset()
- allows functions to read/ write at specific points in existing state (e.g. updating a subsection of an array)
Multiple functions can be defined in the same file, invoke each other and await results. For example:
Chaining can also be done across functions defined separately, e.g. in C++:
See the OpenMP and docs for further C/C++ APIs.