onnxruntime/docs/build/training.md
Cassie a0f3e30de6
Docs update: updated nav, get started sections, home page, apis (#9060)
* initial setup and rename "how to" to "setup"

* move API to main nav

* move api to main nav

* add get starated, rework nav order

* rename to install move mds out of install section

* update api nav and home page

* add install docs and python qs updates

* python get started work

* remove c and obj c for now

* move java, python, and obj-c docs under api folder

* move java api html to iframe (ugh)

* remove api docs w/o details, move api text getstar

* remove api docs wo detail updates get started

* remvoe iframes

* move eco system to main nav

* fix api buttons

* added more examples moved intro to ORT

* fix links

* fix get started titles

* fix get started titles

* fix more links

* fix more links

* more link fixes

* fix nav remove inferencing and training subnav

* fix top nav remove inference and training nav

* fix title

* fix tutorials nav hierarchy

* fix python api button

* add tenorflow keras example

* fix quickstart toc

* add imports fix spacing

* fix links

* update nav and python get started page

* move ort training example, add coming soon for iot

* update C# get started

* fix spacing on quantization

* Add some js get started content

* fix formatting

* fix typo

* removed onnx-pytorch and onnx-tf

* updated pip install torch and added links iot page

* added pytorch tutorial heirarchy

* updated web to docs soon added release blog link

* add web link
2021-09-15 16:23:42 -05:00

115 lines
3.5 KiB
Markdown

---
title: Build for training
parent: Build ORT
nav_order: 2
---
# Build ONNX Runtime for training
{: .no_toc }
## Contents
{: .no_toc }
* TOC placeholder
{:toc}
## CPU
### Build Instructions
{: .no_toc }
To build ORT with training support add `--enable_training` build instruction.
All other build options are the same for inferencing as they are for training.
#### Windows
```
.\build.bat --config RelWithDebInfo --build_shared_lib --parallel --enable_training
```
The default Windows CMake Generator is Visual Studio 2017, but you can also use the newer Visual Studio 2019 by passing
`--cmake_generator "Visual Studio 16 2019"` to `.\build.bat`
#### Linux/macOS
```
./build.sh --config RelWithDebInfo --build_shared_lib --parallel --enable_training
```
## GPU / CUDA
### Prerequisites
{: .no_toc }
The default NVIDIA GPU build requires CUDA runtime libraries installed on the system:
* [CUDA](https://developer.nvidia.com/cuda-toolkit) 10.2
* [cuDNN](https://developer.nvidia.com/cudnn) 8.0
* [NCCL](https://developer.nvidia.com/nccl) 2.7
* [OpenMPI](https://www.open-mpi.org/) 4.0.4
* See [install_openmpi.sh](https://github.com/microsoft/onnxruntime/blob/master/tools/ci_build/github/linux/docker/scripts/install_openmpi.sh)
These dependency versions should reflect what is in [Dockerfile.training](https://github.com/microsoft/onnxruntime/blob/master/dockerfiles/Dockerfile.training).
### Build instructions
{: .no_toc }
1. Checkout this code repo with `git clone https://github.com/microsoft/onnxruntime`
2. Set the environment variables: *adjust the path for location your build machine*
```
export CUDA_HOME=<location for CUDA libs> # e.g. /usr/local/cuda
export CUDNN_HOME=<location for cuDNN libs> # e.g. /usr/local/cuda
export CUDACXX=<location for NVCC> #e.g. /usr/local/cuda/bin/nvcc
export PATH=<location for openmpi/bin/>:$PATH
export LD_LIBRARY_PATH=<location for openmpi/lib/>:$LD_LIBRARY_PATH
export MPI_CXX_INCLUDE_PATH=<location for openmpi/include/>
```
3. Create the ONNX Runtime wheel
* Change to the ONNX Runtime repo base folder: `cd onnxruntime`
* Run `./build.sh --enable_training --use_cuda --config=RelWithDebInfo --build_wheel`
This produces the .whl file in `./build/Linux/RelWithDebInfo/dist` for ONNX Runtime Training.
## GPU / ROCM
### Prerequisites
{: .no_toc }
The default AMD GPU build requires ROCM software toolkit installed on the system:
* [ROCM](https://rocmdocs.amd.com/en/latest/)
* [OpenMPI](https://www.open-mpi.org/) 4.0.4
* See [install_openmpi.sh](./tools/ci_build/github/linux/docker/scripts/install_openmpi.sh)
These dependency versions should reflect what is in [Dockerfile.training](./dockerfiles/Dockerfile.training).
### Build instructions
{: .no_toc }
1. Checkout this code repo with `git clone https://github.com/microsoft/onnxruntime`
2. Create the ONNX Runtime wheel
* Change to the ONNX Runtime repo base folder: `cd onnxruntime`
* Run `./build.sh --config RelWithDebInfo --enable_training --build_wheel --use_rocm --rocm_home /opt/rocm --nccl_home /opt/rocm --mpi_home <location for openmpi>`
This produces the .whl file in `./build/Linux/RelWithDebInfo/dist` for ONNX Runtime Training.
## DNNL and MKLML
### Build Instructions
{: .no_toc }
#### Linux
`./build.sh --enable_training --use_dnnl`
#### Windows
`.\build.bat --enable_training --use_dnnl`
Add `--build_wheel` to build the ONNX Runtime wheel
This will produce a .whl file in `build/Linux/RelWithDebInfo/dist` for ONNX Runtime Training