forked from apache/mxnet
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOCS] Add install docs, fix Jenkins (#57)
- Loading branch information
Showing
17 changed files
with
252 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,9 @@ docs.tgz | |
|
||
# TVM generated code | ||
perf | ||
|
||
*.json | ||
*.params | ||
*.onnx | ||
synset.txt | ||
cat.jpg |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
NNVM Change Log | ||
=============== | ||
|
||
This file records the changes in TVM library in reverse chronological order. | ||
|
||
## 0.8rc | ||
|
||
- This is major change in NNVM to introduce end to end compiler stack. | ||
- The NNVM compiler stack ready | ||
- Core tensor operators | ||
- integrates compiler with TVM | ||
- The libnnvm.a is still independent from compiler modules. | ||
|
||
## 0.7 | ||
|
||
- NNVM graph | ||
- Basic pass of serialization, gradient, infer_shape, place_deice, plan_memory |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# Contribute to NNVM | ||
|
||
NNVM has been developed by community members. | ||
Everyone is more than welcome to contribute. | ||
It is a way to make the project better and more accessible to more users. | ||
NNVM compiler relies on TVM to deploy to different hardware backends. | ||
You can improve the compiler performance by contributing to [TVM](https://github.com/dmlc/tvm) | ||
|
||
- Please update [NEWS.md](https://github.com/dmlc/nnvm/blob/master/NEWS.md) to | ||
add note on your changes to the API or added a new document. | ||
|
||
## Guidelines | ||
* [Submit Pull Request](#submit-pull-request) | ||
* [Git Workflow Howtos](#git-workflow-howtos) | ||
- [How to resolve conflict with master](#how-to-resolve-conflict-with-master) | ||
- [How to combine multiple commits into one](#how-to-combine-multiple-commits-into-one) | ||
- [What is the consequence of force push](#what-is-the-consequence-of-force-push) | ||
* [Document](#document) | ||
* [Testcases](#testcases) | ||
* [Examples](#examples) | ||
* [Core Library](#core-library) | ||
* [Python Package](#python-package) | ||
|
||
## Submit Pull Request | ||
* Before submit, please rebase your code on the most recent version of master, you can do it by | ||
```bash | ||
git remote add upstream [url to nnvm repo] | ||
git fetch upstream | ||
git rebase upstream/master | ||
``` | ||
* If you have multiple small commits, | ||
it might be good to merge them together(use git rebase then squash) into more meaningful groups. | ||
* Send the pull request! | ||
- Fix the problems reported by automatic checks | ||
- If you are contributing a new module or new function, add a test. | ||
|
||
## Git Workflow Howtos | ||
### How to resolve conflict with master | ||
- First rebase to most recent master | ||
```bash | ||
# The first two steps can be skipped after you do it once. | ||
git remote add upstream [url to nnvm repo] | ||
git fetch upstream | ||
git rebase upstream/master | ||
``` | ||
- The git may show some conflicts it cannot merge, say ```conflicted.py```. | ||
- Manually modify the file to resolve the conflict. | ||
- After you resolved the conflict, mark it as resolved by | ||
```bash | ||
git add conflicted.py | ||
``` | ||
- Then you can continue rebase by | ||
```bash | ||
git rebase --continue | ||
``` | ||
- Finally push to your fork, you may need to force push here. | ||
```bash | ||
git push --force | ||
``` | ||
|
||
### How to combine multiple commits into one | ||
Sometimes we want to combine multiple commits, especially when later commits are only fixes to previous ones, | ||
to create a PR with set of meaningful commits. You can do it by following steps. | ||
- Before doing so, configure the default editor of git if you haven't done so before. | ||
```bash | ||
git config core.editor the-editor-you-like | ||
``` | ||
- Assume we want to merge last 3 commits, type the following commands | ||
```bash | ||
git rebase -i HEAD~3 | ||
``` | ||
- It will pop up an text editor. Set the first commit as ```pick```, and change later ones to ```squash```. | ||
- After you saved the file, it will pop up another text editor to ask you modify the combined commit message. | ||
- Push the changes to your fork, you need to force push. | ||
```bash | ||
git push --force | ||
``` | ||
|
||
### Reset to the most recent master | ||
You can always use git reset to reset your version to the most recent master. | ||
Note that all your ***local changes will get lost***. | ||
So only do it when you do not have local changes or when your pull request just get merged. | ||
```bash | ||
git reset --hard [hash tag of master] | ||
git push --force | ||
``` | ||
|
||
### What is the consequence of force push | ||
The previous two tips requires force push, this is because we altered the path of the commits. | ||
It is fine to force push to your own fork, as long as the commits changed are only yours. | ||
|
||
## Testcases | ||
- All the testcases are in tests | ||
|
||
## Core Library | ||
- Follow Google C style for C++. | ||
- We use doxygen to document all the interface code. | ||
- You can reproduce the linter checks by typing ```make lint``` | ||
|
||
## Python Package | ||
- Always add docstring to the new functions in numpydoc format. | ||
- You can reproduce the linter checks by typing ```make lint``` |
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,37 @@ | ||
Deploy Compiled Modules | ||
======================= | ||
NNVM compiled modules are fully embedded in TVM runtime as long as ```GRAPH_RUNTIME``` option | ||
is enabled in tvm runtime. Check out the [TVM documentation](http://docs.tvmlang.org/) for | ||
how to deploy TVM runtime to your system. | ||
|
||
In a nutshell, we will need three items to deploy a compiled module. | ||
Checkout our tutorials on getting started with NNVM compiler for more details. | ||
|
||
- The graph json data which contains the execution graph. | ||
- The tvm module library of compiled functions. | ||
- The parameter blobs for stored parameters. | ||
|
||
We can then use TVM's runtime API to deploy the compiled module. | ||
Here is an example in python. | ||
|
||
```python | ||
import tvm | ||
|
||
# tvm module for compiled functions. | ||
loaded_lib = tvm.module.load("deploy.so") | ||
# json graph | ||
loaded_json = open(temp.relpath("deploy.json")).read() | ||
# parameters in binary | ||
loaded_params = bytearray(open(temp.relpath("deploy.params"), "rb").read()) | ||
|
||
fcreate = tvm.get_global_func("tvm.graph_runtime.create") | ||
ctx = tvm.gpu(0) | ||
gmodule = fcreate(loaded_json, loaded_lib, ctx.device_type, ctx.device_id) | ||
set_input, get_output, run = gmodule["set_input"], gmodule["get_output"], gmodule["run"] | ||
set_input("x", tvm.nd.array(x_np)) | ||
gmodule["load_params"](loaded_params) | ||
run() | ||
out = tvm.nd.empty(shape) | ||
get_output(0, out) | ||
print(out.asnumpy()) | ||
``` |
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,60 @@ | ||
Installation Guide | ||
================== | ||
This page gives instructions on how to build and install the nnvm compiler package from | ||
scratch on various systems. It consists of two steps: | ||
|
||
1. First build the shared library from the C++ codes (`libnnvm_compiler.so` for linux/osx and `libnnvm_compiler.dll` for windows). | ||
2. Setup for the language packages (e.g. Python Package). | ||
|
||
To get started, clone nnvm repo from github. It is important to clone the submodules along, with ```--recursive``` option. | ||
```bash | ||
git clone --recursive https://github.com/dmlc/nnvm | ||
``` | ||
For windows users who use github tools, you can open the git shell, and type the following command. | ||
```bash | ||
git submodule init | ||
git submodule update --recursive | ||
``` | ||
|
||
NNVM compiler depend on TVM and TOPI, so make sure you install them by following [TVM document](http://docs.tvmlang.org/) | ||
|
||
## Contents | ||
- [Build the Shared Library](#build-the-shared-library) | ||
- [Python Package Installation](#python-package-installation) | ||
|
||
## Build the Shared Library | ||
|
||
Our goal is to build the shared library: | ||
- On Linux/OSX the target library is `libnnvm_compiler.so` | ||
- On Windows the target library is `libnnvm_compiler.dll` | ||
|
||
The minimal building requirement is | ||
- A recent c++ compiler supporting C++ 11 (g++-4.8 or higher) | ||
|
||
You can edit `make/config.mk` to change the compile options, and then build by | ||
`make`. If everything goes well, we can go to the specific language installation section. | ||
|
||
## Python Package Installation | ||
|
||
The python package is located at python | ||
There are several ways to install the package: | ||
|
||
1. Set the environment variable `PYTHONPATH` to tell python where to find | ||
the library. For example, assume we cloned `nnvm` on the home directory | ||
`~`. then we can added the following line in `~/.bashrc`. | ||
It is ***recommended for developers*** who may change the codes. | ||
The changes will be immediately reflected once you pulled the code and rebuild the project (no need to call ```setup``` again) | ||
|
||
```bash | ||
export PYTHONPATH=/path/to/nnvm/python:${PYTHONPATH} | ||
``` | ||
|
||
2. Install tvm python bindings by `setup.py`: | ||
|
||
```bash | ||
# install tvm package for the current user | ||
# NOTE: if you installed python via homebrew, --user is not needed during installaiton | ||
# it will be automatically installed to your user directory. | ||
# providing --user flag may trigger error during installation in such case. | ||
cd python; python setup.py install --user; cd .. | ||
``` |
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 |
---|---|---|
|
@@ -10,6 +10,9 @@ Contents | |
|
||
self | ||
top | ||
how_to/install | ||
tutorials/index | ||
how_to/contribute | ||
how_to/deploy | ||
api/python/index | ||
dev/index |
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
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
Oops, something went wrong.