Skip to content

Commit 89618e8

Browse files
committed
Initial bootstrap commit.
0 parents  commit 89618e8

File tree

930 files changed

+127587
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

930 files changed

+127587
-0
lines changed

.clang-format

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
# Defaults for all languages.
3+
BasedOnStyle: Google
4+
5+
# Setting ColumnLimit to 0 so developer choices about where to break lines are maintained.
6+
# Developers are responsible for adhering to the 120 character maximum.
7+
ColumnLimit: 0
8+
SortIncludes: false
9+
DerivePointerAlignment: false
10+
11+
# if you want to customize when working locally see https://clang.llvm.org/docs/ClangFormatStyleOptions.html for options.
12+
# See ReformatSource.ps1 for a script to update all source according to the current options in this file.
13+
# e.g. customizations to use Allman bracing and more indenting.
14+
# AccessModifierOffset: -2
15+
# BreakBeforeBraces: Allman
16+
# CompactNamespaces: false
17+
# IndentCaseLabels: true
18+
# IndentWidth: 4
19+
# NamespaceIndentation: All
20+
21+
...
22+

.clang-tidy

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
# turn off readability-braces-around-statements to allow single line statement like 'if (x == y) doSomething();'
3+
Checks: '-*,cppcoreguidelines-*,google-*,readability-*,modernize-*,-readability-braces-around-statements,-google-runtime-references,-cppcoreguidelines-pro-type-reinterpret-cast'
4+
WarningsAsErrors: ''
5+
HeaderFilterRegex: '.*lotus\/core\/.*'
6+
AnalyzeTemporaryDtors: false
7+
FormatStyle: none
8+
CheckOptions:
9+
- key: google-readability-braces-around-statements.ShortStatementLines
10+
value: '1'
11+
- key: google-readability-function-size.StatementThreshold
12+
value: '800'
13+
- key: google-readability-namespace-comments.ShortNamespaceLines
14+
value: '10'
15+
- key: google-readability-namespace-comments.SpacesBeforeComments
16+
value: '2'
17+
- key: modernize-loop-convert.MaxCopySize
18+
value: '16'
19+
- key: modernize-loop-convert.MinConfidence
20+
value: reasonable
21+
- key: modernize-loop-convert.NamingStyle
22+
value: CamelCase
23+
- key: modernize-pass-by-value.IncludeStyle
24+
value: google
25+
- key: modernize-replace-auto-ptr.IncludeStyle
26+
value: google
27+
- key: modernize-use-nullptr.NullMacros
28+
value: 'NULL'
29+
...
30+

.gitattributes

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This sets the default behaviour, overriding core.autocrlf
2+
* text=auto
3+
4+
# All source files should have unix line-endings in the repository,
5+
# but convert to native line-endings on checkout
6+
*.cc text
7+
*.h text
8+
9+
# Windows specific files should retain windows line-endings
10+
*.sln text eol=crlf
11+
12+
# make sure build.sh retains Unix line endings, even when checked out on windows.
13+
*.sh text eol=lf

.gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# build, distribute, and bins (+ python proto bindings)
2+
build
3+
build_host_protoc
4+
build_android
5+
build_ios
6+
build_*
7+
.build_debug/*
8+
.build_release/*
9+
distribute/*
10+
*.testbin
11+
*.bin
12+
cmake_build
13+
.cmake_build
14+
gen
15+
*~
16+
.vs
17+
TestResults/
18+
.idea/
19+
lotus.egg-info
20+
nuget_root/
21+
.packages/
22+
.vscode/
23+
*.code-workspace
24+
__pycache__
25+
onnxruntime_profile*.json
26+
/docs/python/*.md
27+
/docs/python/auto_examples/*
28+
/docs/python/media/*
29+
/docs/python/examples/*.onnx
30+
/docs/python/examples/graph.*
31+
/docs/python/*_LICENSE

.gitmodules

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[submodule "external/protobuf"]
2+
path = cmake/external/protobuf
3+
url = https://github.com/google/protobuf.git
4+
[submodule "cmake/external/googletest"]
5+
path = cmake/external/googletest
6+
url = https://github.com/google/googletest.git
7+
[submodule "cmake/external/onnx"]
8+
path = cmake/external/onnx
9+
url = https://github.com/onnx/onnx
10+
[submodule "cmake/external/tvm"]
11+
path = cmake/external/tvm
12+
url = https://github.com/dmlc/tvm.git
13+
[submodule "cmake/external/date"]
14+
path = cmake/external/date
15+
url = https://github.com/HowardHinnant/date.git
16+
[submodule "cmake/external/gsl"]
17+
path = cmake/external/gsl
18+
url = https://github.com/Microsoft/GSL.git

BUILD.md

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Build ONNX Runtime
2+
3+
## Supported dev environments
4+
5+
| OS | Supports CPU | Supports GPU| Notes |
6+
|-------------|:------------:|:------------:|------------------------------------|
7+
|Windows 10 | YES | YES |Must use VS 2017 or the latest VS2015|
8+
|Windows 10 <br/> Subsystem for Linux | YES | NO | |
9+
|Ubuntu 16.x | YES | YES | |
10+
|Ubuntu 17.x | YES | YES | |
11+
|Ubuntu 18.x | YES | YES | |
12+
|Fedora 24 | YES | YES | |
13+
|Fedora 25 | YES | YES | |
14+
|Fedora 26 | YES | YES | |
15+
|Fedora 27 | YES | YES | |
16+
|Fedora 28 | YES | NO |Cannot build GPU kernels but can run them |
17+
18+
* Red Hat Enterprise Linux and CentOS are not supported.
19+
* GCC 4.x and below are not supported. If you are using GCC 7.0+, you'll need to upgrade eigen to a newer version before compiling ONNX Runtime.
20+
21+
OS/Compiler Matrix:
22+
23+
| OS/Compiler | Supports VC | Supports GCC | Supports Clang |
24+
|-------------|:------------:|:----------------:|:---------------:|
25+
|Windows 10 | YES | Not tested | Not tested |
26+
|Linux | NO | YES(gcc>=5.0) | YES |
27+
28+
ONNX Runtime python binding only supports Python 3.x. Please use python 3.5+.
29+
30+
## Build
31+
Install cmake-3.11 or better from https://cmake.org/download/.
32+
33+
Checkout the source tree:
34+
```
35+
git clone --recursive https://github.com/Microsoft/onnxruntime
36+
cd onnxruntime
37+
./build.sh for Linux (or ./build.bat for Windows)
38+
```
39+
The build script runs all unit tests by default.
40+
41+
The complete list of build options can be found by running `./build.sh (or ./build.bat) --help`
42+
43+
## Build/Test Flavors for CI
44+
45+
### CI Build Environments
46+
47+
| Build Job Name | Environment | Dependency | Test Coverage | Scripts |
48+
|--------------------|---------------------|---------------------------------|--------------------------|------------------------------------------|
49+
| Linux_CI_Dev | Ubuntu 16.04 | python=3.5 | Unit tests; ONNXModelZoo | [script](tools/ci_build/github/linux/run_build.sh) |
50+
| Linux_CI_GPU_Dev | Ubuntu 16.04 | python=3.5; nvidia-docker | Unit tests; ONNXModelZoo | [script](tools/ci_build/github/linux/run_build.sh) |
51+
| Windows_CI_Dev | Windows Server 2016 | python=3.5 | Unit tests; ONNXModelZoo | [script](build.bat) |
52+
| Windows_CI_GPU_Dev | Windows Server 2016 | cuda=9.0; cudnn=7.0; python=3.5 | Unit tests; ONNXModelZoo | [script](build.bat) |
53+
54+
## Additional Build Flavors
55+
The complete list of build flavors can be seen by running `./build.sh --help` or `./build.bat --help`. Here are some common flavors.
56+
57+
### Windows CUDA Build
58+
ONNX Runtime supports CUDA builds. You will need to download and install [CUDA](https://developer.nvidia.com/cuda-toolkit) and [CUDNN](https://developer.nvidia.com/cudnn).
59+
60+
ONNX Runtime is built and tested with CUDA 9.0 and CUDNN 7.0 using the Visual Studio 2017 14.11 toolset (i.e. Visual Studio 2017 v15.3).
61+
CUDA versions up to 9.2 and CUDNN version 7.1 should also work with versions of Visual Studio 2017 up to and including v15.7, however you may need to explicitly install and use the 14.11 toolset due to CUDA and CUDNN only being compatible with earlier versions of Visual Studio 2017.
62+
63+
To install the Visual Studio 2017 14.11 toolset, see <https://blogs.msdn.microsoft.com/vcblog/2017/11/15/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/>
64+
65+
If using this toolset with a later version of Visual Studio 2017 you have two options:
66+
67+
1. Setup the Visual Studio environment variables to point to the 14.11 toolset by running vcvarsall.bat prior to running cmake
68+
- e.g. if you have VS2017 Enterprise, an x64 build would use the following command
69+
`"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 -vcvars_ver=14.11`
70+
71+
2. Alternatively if you have CMake 3.12 or later you can specify the toolset version in the "-T" parameter by adding "version=14.11"
72+
- e.g. use the following with the below cmake command
73+
`-T version=14.11,host=x64`
74+
75+
CMake should automatically find the CUDA installation. If it does not, or finds a different version to the one you wish to use, specify your root CUDA installation directory via the -DCUDA_TOOLKIT_ROOT_DIR CMake parameter.
76+
77+
_Side note: If you have multiple versions of CUDA installed on a Windows machine and are building with Visual Studio, CMake will use the build files for the highest version of CUDA it finds in the BuildCustomization folder. e.g. C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\BuildCustomizations\. If you want to build with an earlier version, you must temporarily remove the 'CUDA x.y.*' files for later versions from this directory._
78+
79+
The path to the 'cuda' folder in the CUDNN installation must be provided. The 'cuda' folder should contain 'bin', 'include' and 'lib' directories.
80+
81+
You can build with:
82+
83+
```
84+
./build.sh --use_cuda --cudnn_home /usr --cuda_home /usr/local/cuda (Linux)
85+
./build.bat --use_cuda --cudnn_home <cudnn home path> --cuda_home <cuda home path> (Windows)
86+
```
87+
88+
### MKL-DNN
89+
To build ONNX Runtime with MKL-DNN support, build it with `./build.sh --use_mkldnn --use_mklml`
90+
91+
### OpenBLAS
92+
#### Windows
93+
Instructions how to build OpenBLAS for windows can be found here https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio#build-openblas-for-universal-windows-platform.
94+
95+
Once you have the OpenBLAS binaries, build ONNX Runtime with `./build.bat --use_openblas`
96+
97+
#### Linux
98+
For Linux (e.g. Ubuntu 16.04), install libopenblas-dev package
99+
`sudo apt-get install libopenblas-dev` and build with `./build.sh --use_openblas`
100+
101+
### OpenMP
102+
```
103+
./build.sh --use_openmp (for Linux)
104+
./build.bat --use_openmp (for Windows)
105+
```
106+
107+
### Build with Docker on Linux
108+
Install Docker: `https://docs.docker.com/install/`
109+
110+
#### CPU
111+
```
112+
cd tools/ci_build/github/linux/docker
113+
docker build -t onnxruntime_dev --build-arg OS_VERSION=16.04 -f Dockerfile.ubuntu .
114+
docker run --rm -it onnxruntime_dev /bin/bash
115+
```
116+
117+
#### GPU
118+
If you need GPU support, please also install:
119+
1. nvidia driver. Before doing this please add 'nomodeset rd.driver.blacklist=nouveau' to your linux [kernel boot parameters](https://www.kernel.org/doc/html/v4.17/admin-guide/kernel-parameters.html).
120+
2. nvidia-docker2: [Install doc](`https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(version-2.0)`)
121+
122+
To test if your nvidia-docker works:
123+
```
124+
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
125+
```
126+
127+
Then build a docker image. We provided a sample for use:
128+
```
129+
cd tools/ci_build/github/linux/docker
130+
docker build -t cuda_dev -f Dockerfile.ubuntu_gpu .
131+
```
132+
133+
Then run it
134+
```
135+
./tools/ci_build/github/linux/run_dockerbuild.sh
136+
```

CONTRIBUTING.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Contributing
2+
3+
We're always looking for your help to fix bugs and improve the product. Create a pull request and we'll be happy to take a look.
4+
Start by reading the [Engineering Design](docs/HighLevelDesign.md).
5+
6+
# Checkin procedure
7+
```
8+
git clone --recursive https://github.com/Microsoft/onnxruntime
9+
git checkout -b feature_branch
10+
# make your changes
11+
# write unit tests
12+
# make sure it builds and all tests pass
13+
git commit -m "my changes"
14+
git push origin HEAD
15+
```
16+
To request merge into master send a pull request from the web ui
17+
https://github.com/Microsoft/onnxruntime
18+
New code *must* be accompanied by unit tests.
19+
20+
# Build
21+
[Build](BUILD.md)
22+
23+
# Additional Documentation
24+
* [Adding a custom operator](docs/AddingCustomOp.md)
25+
26+
# Coding guidelines
27+
Please see [Coding Conventions and Standards](./docs/Coding_Conventions_and_Standards.md)
28+
29+
# Licensing guidelines
30+
This project welcomes contributions and suggestions. Most contributions require you to
31+
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
32+
and actually do, grant us the rights to use your contribution. For details, visit
33+
https://cla.microsoft.com.
34+
35+
When you submit a pull request, a CLA-bot will automatically determine whether you need
36+
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
37+
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
38+
39+
# Code of conduct
40+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
41+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
42+
or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
43+
44+
# Reporting Security Issues
45+
Security issues and bugs should be reported privately, via email, to the Microsoft Security
46+
Response Center (MSRC) at [[email protected]](mailto:[email protected]). You should
47+
receive a response within 24 hours. If for some reason you do not, please follow up via
48+
email to ensure we received your original message. Further information, including the
49+
[MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in
50+
the [Security TechCenter](https://technet.microsoft.com/en-us/security/default).

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Microsoft Corporation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ONNX Runtime
2+
3+
[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status/Microsoft.onnxruntime)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=1)
4+
5+
ONNX Runtime is the runtime for [ONNX](https://github.com/onnx/onnx).
6+
7+
# Engineering Design
8+
[Engineering Design](docs/HighLevelDesign.md)
9+
10+
# API
11+
| API | CPU package | GPU package |
12+
|-----|-------------|-------------|
13+
| [Python](https://docs.microsoft.com/en-us/python/api/overview/azure/onnx/intro?view=azure-onnx-py) | [Windows](TODO)<br>[Linux](https://pypi.org/project/onnxruntime/)<br>[Mac](TODO)| [Windows](TODO)<br>[Linux](https://pypi.org/project/onnxruntime-gpu/) |
14+
| [C#](docs/CSharp_API.md) | [Windows](TODO)| Not available |
15+
| [C](docs/C_API.md) | [Windows](TODO)<br>[Linux](TODO) | Not available |
16+
17+
# Build
18+
[Build](BUILD.md)
19+
20+
# Contribute
21+
[Contribute](CONTRIBUTING.md)
22+
23+
# Versioning
24+
[Versioning](docs/Versioning.md)
25+
26+
# Feedback
27+
* File a bug in [GitHub Issues](https://github.com/Microsoft/onnxruntime/issues)
28+
29+
# Code of Conduct
30+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
31+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
32+
or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
33+
34+
# License
35+
[LICENSE](LICENSE)

0 commit comments

Comments
 (0)