@@ -10,95 +12,61 @@ MegEngine is a fast, scalable and easy-to-use deep learning framework, with auto
## Installation
**NOTE:** MegEngine now only supports Linux platform with Python 3.5 or higher. On Windows 10 you could try [WSL(Windows Subsystem for Linux)](https://docs.microsoft.com/en-us/windows/wsl) to use Linux within Windows.
**NOTE:** MegEngine now supports Linux-64bit/Windows-64bit/MacOS-10.14+ (CPU-Only) Platforms with Python from 3.5 to 3.8. On Windows 10 you can either install the Linux distribution through [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl) or install the Windows distribution directly.
### Binaries
Commands to install from binaries via pip wheels are as follows:
Most of the dependencies of MegEngine are located in `third_party` directory, and you do
not need to install these by yourself. you can prepare these repositories by executing:
Most of the dependencies of MegEngine are located in `third_party` directory, which can be prepared by executing:
```bash
./third_party/prepare.sh
./third_party/install-mkl.sh
```
But some dependencies should be manually installed:
But some dependencies need to be Installed manually:
*[CUDA](https://developer.nvidia.com/cuda-toolkit-archive)(>=10.1), [cuDNN](https://developer.nvidia.com/cudnn)(>=7.6)are required when building MegEngine with CUDA support (default ON)
*[TensorRT](https://docs.nvidia.com/deeplearning/sdk/tensorrt-archived/index.html)(>=5.1.5) is required when building with TensorRT support (default ON)
* LLVM/Clang(>=6.0) is required when building with Halide JIT support (default ON)
* Python(>=3.5), Numpy, SWIG(>=3.0) are required to build Python modules. (default ON)
*[CUDA](https://developer.nvidia.com/cuda-toolkit-archive)(>=10.1), [cuDNN](https://developer.nvidia.com/cudnn)(>=7.6)are required when building MegEngine with CUDA support.
*[TensorRT](https://docs.nvidia.com/deeplearning/sdk/tensorrt-archived/index.html)(>=5.1.5) is required when building with TensorRT support.
* LLVM/Clang(>=6.0) is required when building with Halide JIT support.
* Python(>=3.5), Numpy, are required to build Python modules.
### Build
MegEngine prefers `Out-Of-Source` flavor, and compile in a `mostly-static` way.
Here are the instructions:
1. Make a directory for the build.
```bash
mkdir-p build
cd build
```
2. Generate build configurations by `CMake`.
For CUDA build:
```bash
cmake .. -DMGE_WITH_TEST=ON
```
For CPU only build, use `-DMGE_WITH_CUDA=OFF`:
```bash
cmake .. -DMGE_WITH_CUDA=OFF -DMGE_WITH_TEST=ON
```
For deployment with C++ only, use `-DMGE_INFERENCE_ONLY=ON`, and turn off test with `-DMGE_WITH_TEST=OFF`:
Use `-DCMAKE_INSTALL_PREFIX=YOUR_PATH` to specify the install path.
3. Start to build.
```bash
make -j$(nproc)
```
4. [optional] Install the library if compiled for deployment at step 2.
```bash
make install
```
Here are some other useful options for the build.
*`MGE_ARCH` specifies which arch MegEngine are building for. (default AUTO)
*`MGE_WITH_DISTRIBUTED` if multiple machine distributed support is enabled. (default ON)
*`MGE_WITH_PYTHON_MODULE` if build python module. (default ON)
*`MGE_BLAS` chooses `MKL` or `OpenBLAS` as BLAS library for MegEngine. (default `MKL`)
*`MGE_CUDA_GENCODE` supplies the `-gencode` option for `nvcc`. (default not supply)
*`MGE_DISABLE_FLOAT16` if disable float16 support. (default OFF)
*`MGE_ENABLE_EXCEPTIONS` if enable exception support in C++. (default ON)
*`MGE_ENABLE_LOGGING` if enable logging in MegEngine. (default AUTO)
More options can be found by:
```bash
cd build
cmake -LAH .. 2>/dev/null| grep-B 1 'MGE_' | less
```
MegEngine uses CMake as the build tool.
We provide the following scripts to facilitate building.
*[host_build.sh](scripts/cmake-build/host_build.sh) is to build MegEngine targeted to run on the same host machine.
Please run the following command to get help information:
```
scripts/cmake-build/host_build.sh -h
```
*[cross_build_android_arm_inference.sh](scripts/cmake-build/cross_build_android_arm_inference.sh) is to build MegEngine targeted to run at Android-ARM platforms.
Please run the following command to get help information:
*[cross_build_linux_arm_inference.sh](scripts/cmake-build/cross_build_linux_arm_inference.sh) is to build MegEngine targeted to run at Linux-ARM platforms.
Please run the following command to get help information: