Skip to content

Commit 0ed9eec

Browse files
Documentation cleanup
1 parent f4bc9f0 commit 0ed9eec

File tree

5 files changed

+47
-190
lines changed

5 files changed

+47
-190
lines changed

README.md

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,43 @@
11
# Benchmarks & Tests
22

3+
## Benchmarks
4+
5+
The following benchmark suites have been modified to work with the linux runtime:
6+
- ```polybench```: [Polybench](https://web.cse.ohio-state.edu/~pouchet.2/software/polybench/); 60 benchmarks (30 benchmarks x 2 sizes)
7+
- ```mibench```: [Mibench](https://vhosts.eecs.umich.edu/mibench/); 30 benchmarks (16 benchmarks, with 14 having small and large sizes)
8+
- ```cortex```: [UCSD CortexSuite](https://cseweb.ucsd.edu//groups/bsg/), excluding the San Diego Vision Benchmark suite; 24 benchmarks (8 benchmarks x 3 sizes)
9+
- ```vision```: [San Diego Vision Benchmark Suite](https://michaeltaylor.org/vision/); 27 benchmarks (9 benchmarks x 3 sizes)
10+
11+
In total, we currently have 141 benchmarks, 63 of which are unique (differ by more than just data / parameters).
12+
313
## Setup
414

5-
0. Set up infrastructure if required.
15+
0. Set up infrastructure if not already installed.
616

717
- Mosquitto server: ```sudo apt-get install mosquitto```. Start with ```mosquitto``` if not already running.
818
- Run the [orchestrator](https://github.com/SilverLineFramework/orchestrator). All settings can be default, and config files can be empty.
19+
- Install the Python Client, [libsilverline](https://github.com/SilverLineFramework/libsilverline).
920
- The instructions here assume that the [linux runtime](https://github.com/SilverLineFramework/runtime-linux) is installed in the same directory as this repository:
1021
```
1122
silverline/
1223
...
1324
mqtt_pwd.txt
25+
libsilverline/
26+
...
1427
benchmarks/
1528
...
1629
runtime-linux/
1730
...
1831
```
1932
20-
1. Install dependencies:
21-
```sh
22-
pip install -r requirements.txt
33+
1. Install the WASI SDK:
34+
```shell
35+
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk-11.0-linux.tar.gz
36+
tar xvf wasi-sdk-11.0-linux.tar.gz
37+
sudo cp -r wasi-sdk-11.0 /opt/wasi-sdk
2338
```
2439
25-
2. Compile the WAMR compiler:
40+
2. In ```benchmarks/```, compile the WAMR compiler:
2641
```sh
2742
git submodule update --init --recursive
2843
cd wasm-micro-runtime/wamr-compiler
@@ -32,25 +47,19 @@
3247
make
3348
```
3449
35-
3. Install the WASI SDK:
36-
```shell
37-
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk-11.0-linux.tar.gz
38-
tar xvf wasi-sdk-11.0-linux.tar.gz
39-
sudo cp -r wasi-sdk-11.0 /opt/wasi-sdk
40-
```
41-
42-
4. Acquire an MQTT token and save it in a file ```./mqtt_pwd.txt```.
50+
3. Acquire an MQTT token and save it in a file ```./mqtt_pwd.txt```.
4351
4452
**NOTE**: if the MQTT server is unsecured (i.e. a default local install of mosquitto), you can just ```touch mqtt_pwd.txt```.
4553
46-
5. Build benchmarks:
54+
4. Build benchmarks:
4755
4856
- ```make wasm```: build wasm programs; saved to ```./wasm```.
57+
- ```make {benchmark}```: make ```tests```, ```polybench```, ```mibench```, ```vision```, or ```cortex``` individually.
4958
- ```make rustpython```: copy rustpython to ```./wasm``` for distribution or AOT compilation.
50-
- ```make aot```: build wasm apps into AOT; saved in ```./aot```. **NOTE**: this can take a very long time, especially if rustpython is included.
5159
- ```make clean```: remove ```./wasm``` and ```./aot```.
52-
53-
6. Clone the [Python Client](https://github.com/SilverLineFramework/libsilverline), which includes scripts for launching benchmarks.
60+
- ```make aot```: build wasm apps into AOT. This will compile **all** ```*.wasm``` files in the ```./wasm``` directory to corresponding ```*.aot``` files in the ```./aot``` directory.
61+
62+
**NOTE**: this can take a very long time, especially if rustpython is included. Always ```make aot -j16``` (with the appropriate number of threads).
5463
5564
## Usage
5665
@@ -61,27 +70,26 @@
6170
6271
**NOTE**: due to runtime WASI issues, you may need to start inside the benchmarks directory like this example in order for some benchmarks to properly open files.
6372
64-
2. Run the ```run.py``` script (from the [Python Client](https://github.com/SilverLineFramework/libsilverline)), for example:
73+
2. Run the ```run.py``` script (from the [Python Client](https://github.com/SilverLineFramework/libsilverline)):
6574
```sh
6675
python libsilverline/run.py --path wasm/tests/helloworld.wasm --runtime test
6776
```
6877
69-
## Benchmarks
70-
71-
The following benchmark suites have been modified to work with the linux runtime:
72-
- ```polybench```: [Polybench](https://web.cse.ohio-state.edu/~pouchet.2/software/polybench/)
73-
- ```mibench```: [Mibench](https://vhosts.eecs.umich.edu/mibench/)
74-
- ```cortex```: [UCSD CortexSuite](https://cseweb.ucsd.edu//groups/bsg/), excluding the San Diego Vision Benchmark suite.
75-
- ```vision```: [San Diego Vision Benchmark Suite](https://michaeltaylor.org/vision/)
78+
The ```run.py``` script supports several benchmarking modes. ```---type passive``` will likely be most helpful; for example:
79+
```sh
80+
python libsilverline/run.py --path aot/polybench/2mm.aot --runtime test --type passive --duration 10
81+
```
82+
will create a module for the AOT-compiled benchmark ```aot/polybench/2mm.aot``` on the runtime named ```test```, wait for 10 seconds, then instruct it to exit.
7683
7784
## Conversion Guide
7885
79-
1. Modify makefile. See this example header:
86+
1. Modify makefile. For example:
8087
```Makefile
8188
# Output
89+
BENCHMARK_NAME=network
8290
ROOT_DIR=../../..
83-
OUT_DIR=$(ROOT_DIR)/wasm/mibench/network
84-
DATA_DIR=$(ROOT_DIR)/data/mibench/network
91+
OUT_DIR=$(ROOT_DIR)/wasm/mibench/$(BENCHMARK_NAME)
92+
DATA_DIR=$(ROOT_DIR)/data/mibench/$(BENCHMARK_NAME)
8593
8694
# WAMR Setup
8795
WAMR_DIR=$(ROOT_DIR)/wasm-micro-runtime
@@ -99,10 +107,18 @@ The following benchmark suites have been modified to work with the linux runtime
99107
COMMON= $(ROOT_DIR)/common/passive.c -D PROFILE_PASSIVE
100108
101109
COMPILE= $(WASMCC) $(WASMCFLAGS) $(COMMON)
110+
111+
.phony: all
112+
113+
SRCS= src/*.c ../common/*.c
114+
115+
all:
116+
$(COMPILE) $(SRCS) -o $(OUT_DIR).wasm
117+
cp data.dat $(DATA_DIR)/data.dat
102118
```
103119
104120
In the makefile, the WASM output should be ```wasm/path/to/benchmark.wasm```,
105-
and any accompanying data files should be copied to ```data/path/to/benchmark.dat```.
121+
and any accompanying data files should be copied to ```data/path/to/benchmark.dat```. No specific data file naming/directory scheme is required, as long as it does not conflict with other benchmarks.
106122
107123
2. Rename main function to ```benchmark_main```.
108124
@@ -120,3 +136,5 @@ The following benchmark suites have been modified to work with the linux runtime
120136
return loop(argc, argv, &benchmark_main);
121137
}
122138
```
139+
140+
4. Run on the runtime and observe the number of loops (should be printed out by the common driver at exit). Generally, you should get at least 10 loops in a 10s interval, and at most 2000.

array/Makefile

Lines changed: 0 additions & 67 deletions
This file was deleted.

array/kernel.c

Lines changed: 0 additions & 54 deletions
This file was deleted.

array/kernel.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)