Browse Source

build(dnn): compat for more windows env

GitOrigin-RevId: 5ec4be2888
release-1.5
Megvii Engine Team huangxinda 3 years ago
parent
commit
8dea6b3c68
3 changed files with 54 additions and 56 deletions
  1. +52
    -22
      scripts/cmake-build/BUILD_README.md
  2. +1
    -1
      scripts/cmake-build/host_build.sh
  3. +1
    -33
      scripts/whl/BUILD_PYTHON_WHL_README.md

+ 52
- 22
scripts/cmake-build/BUILD_README.md View File

@@ -18,16 +18,55 @@
### Windows host build ### Windows host build
* commands: * commands:
``` ```
1: installl Visual Studio (need support LLVM/clang-cl), eg 2019. Please install LLVM-10/11, VS LLVM linker have issue, please replace lld-link.exe, which can be download from https://releases.llvm.org/download.html#10.0.0, what`s more, Visual Studio cl.exe version >=14.28.29910 do not compat with cuda 10.1, please do not use this issue version!
2: install extension of VS: Python/Cmake/LLVM/Ninja
3: now we support cuda10.1+cudnn7.6+TensorRT6.0 on Windows, as Windows can only use DLL in fact with cudnn/TensorRT, so please install the same version;
3a: install cuda10.1 to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
3b: install cudnn7.6 to C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-10.1-windows10-x64-v7.6.5.32
3c: install TensorRT6.0 to C:\Program Files\NVIDIA GPU Computing Toolkit\TensorRT-6.0.1.5
3d: add C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin to system PATH env
3e: add C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-10.1-windows10-x64-v7.6.5.32\cuda\bin to system Path env
3f: add C:\Program Files\NVIDIA GPU Computing Toolkit\TensorRT-6.0.1.5\lib Path, if you do not do 4d/4e/4f, CUDA runtime can not find dll
4: install Python3 (default is 3.8.3) to /c/Users/${USER}/mge_whl_python_env/3.8.3 and put it to PATH env and run python3 -m pip install numpy (if you want to build with training mode)
1: install git (Windows GUI)
* download git-install.exe from https://git-scm.com/download/win
* only need choose git-lfs component
* install to default dir: /c/Program\ Files/Git
2: install visual studio 2019 Enterprise (Windows GUI)
* download install exe from https://visualstudio.microsoft.com
* choose "c++ develop" -> choose cmake/MSVC/clang/cmake/windows-sdk when install
* NOTICE: windows sdk version >=14.28.29910 do not compat with CUDA 10.1, please
choose version < 14.28.29910
* then install choosed components
* after install visual studio 2019 Enterprise, time to replace lld-link.exe
caused by visual studio 2019 lld-link.exe have crash issue
download office exe from https://releases.llvm.org/download.html
install to default: C:\Program Files\LLVM
cd "/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/bin"
cp /c/Program\ Files/LLVM/bin/lld-link.exe lld-link.exe
3: install python3 (Windows GUI)
* download python 64-bit install exe (we support python3.5-python3.8 now)
https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe
https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe
https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe
https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe
* install 3.5.4 to /c/Users/${USER}/mge_whl_python_env/3.5.4
* install 3.6.8 to /c/Users/${USER}/mge_whl_python_env/3.6.8
* install 3.7.7 to /c/Users/${USER}/mge_whl_python_env/3.7.7
* install 3.8.3 to /c/Users/${USER}/mge_whl_python_env/3.8.3
* cp python.exe to python3.exe
loop cd /c/Users/${USER}/mge_whl_python_env/*
copy python.exe to python3.exe
* install python depends components
loop cd /c/Users/${USER}/mge_whl_python_env/*
python3.exe -m pip install --upgrade pip
python3.exe -m pip install -r imperative/python/requires.txt
python3.exe -m pip install -r imperative/python/requires-test.txt
4: install cuda components (Windows GUI)
* now we support cuda10.1+cudnn7.6+TensorRT6.0 on Windows
* install cuda10.1 to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
* install cudnn7.6 to C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-10.1-windows10-x64-v7.6.5.32
* install TensorRT6.0 to C:\Program Files\NVIDIA GPU Computing Toolkit\TensorRT-6.0.1.5
5: edit system env variables (Windows GUI)
* create new key: "VS_PATH", value: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
* append "Path" env value
C:\Program Files\Git\cmd
C:\Users\build\mge_whl_python_env\3.8.3
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp
C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-10.1-windows10-x64-v7.6.5.32\cuda\bin
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\lib\clang\11.0.0\lib\windows
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\lib\clang\11.0.0\lib\windows
``` ```


### Linux host build ### Linux host build
@@ -55,10 +94,8 @@ Now we support Windows/Linux/MacOS cross build to ARM-Android


* commands: * commands:
``` ```
1: install unix-like tools, eg MSYS if you are using windows(recommend), we also support CMD.exe or powershell on windows
2: download NDK from https://developer.android.google.cn/ndk/downloads/ for diff OS platform package, suggested NDK20 or NDK21 2: download NDK from https://developer.android.google.cn/ndk/downloads/ for diff OS platform package, suggested NDK20 or NDK21
3: export NDK_ROOT=NDK_DIR at bash-like env 3: export NDK_ROOT=NDK_DIR at bash-like env
4: config NDK_ROOT to PATH env at windows control board if use CMD/powershell
``` ```


### Cross build for ARM-Linux ### Cross build for ARM-Linux
@@ -72,7 +109,7 @@ Now we support ARM-Linux on Linux and Windows fully, also experimental on MacOS


### Cross build for IOS ### Cross build for IOS
Now we only support cross build to IOS from MACOS Now we only support cross build to IOS from MACOS
* commands: * commands:
``` ```
1: install full xcode: https://developer.apple.com/xcode/ 1: install full xcode: https://developer.apple.com/xcode/
@@ -87,7 +124,7 @@ With bash env(Linux/MacOS/Unix-Like tools on Windows, eg: msys etc)
./third_party/install-mkl.sh ./third_party/install-mkl.sh
``` ```


Windows shell env(eg, CMD, Powershell etc), infact if you can use git command on Windows, which means you always install bash.exe at the same dir of git.exe, find it, then you can prepare third-party code by
Windows shell env(bash from windows-git), infact if you can use git command on Windows, which means you always install bash.exe at the same dir of git.exe, find it, then you can prepare third-party code by


* command: * command:
``` ```
@@ -96,7 +133,7 @@ bash.exe ./third_party/install-mkl.sh
``` ```


# How to build # How to build
## With bash env(Linux/MacOS/Unix-Like tools on Windows, eg: msys etc)
## With bash env(Linux/MacOS/Windows-git-bash)


* command: * command:
``` ```
@@ -106,13 +143,6 @@ bash.exe ./third_party/install-mkl.sh
4: cross build to IOS: scripts/cmake-build/cross_build_ios_arm_inference.sh 4: cross build to IOS: scripts/cmake-build/cross_build_ios_arm_inference.sh
``` ```


## Windows shell env(eg, CMD, Powershell etc)

* command:
```
1: we do not provide BAT for CMD/Powershlel scripts, BUT you can refer for scripts/cmake-build/*.sh
```

## Visual Studio GUI(only for Windows host) ## Visual Studio GUI(only for Windows host)


* command: * command:


+ 1
- 1
scripts/cmake-build/host_build.sh View File

@@ -162,7 +162,7 @@ function prepare_env_for_windows_build() {
echo $VS_PATH echo $VS_PATH


# only use cmake/clang-cl/Ninja install from Visual Studio, if not, may build failed # only use cmake/clang-cl/Ninja install from Visual Studio, if not, may build failed
# some user env may install cmake/clang-cl/Ninja at MSYS env, so we put Visual Studio
# some user env may install cmake/clang-cl/Ninja at windows-git-bash env, so we put Visual Studio
# path at the head of PATH, and check the valid # path at the head of PATH, and check the valid
echo "check cmake install..." echo "check cmake install..."
export PATH=$VS_PATH/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/:$PATH export PATH=$VS_PATH/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/:$PATH


+ 1
- 33
scripts/whl/BUILD_PYTHON_WHL_README.md View File

@@ -29,39 +29,7 @@


## Windows ## Windows
``` ```
1: refer to scripts/cmake-build/BUILD_README.md Windows section build for base windows build env prepare
2: install several python or install your care about python version, default install dir: /c/Users/${USER}/mge_whl_python_env
a: mkdir /c/Users/${USER}/mge_whl_python_env
b: download python 64-bit install exe
https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe
https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe
https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe
https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe
c: install python-3.5.4-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.5.4 from install gui
d: install python-3.6.8-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.6.8 from install gui
e: install python-3.7.7-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.7.7 from install gui
f: install python-3.8.3-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.8.3 from install gui
3: cp python.exe to python3.exe
a: mv /c/Users/${USER}/mge_whl_python_env/3.5.4/python.exe /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe
b: mv /c/Users/${USER}/mge_whl_python_env/3.6.8/python.exe /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe
c: mv /c/Users/${USER}/mge_whl_python_env/3.7.7/python.exe /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe
d: mv /c/Users/${USER}/mge_whl_python_env/3.8.3/python.exe /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe
4: install needed package for build python whl package
a0: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install --upgrade pip
a1: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install -r imperative/python/requires-test.txt
a2: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install numpy wheel requests tqdm tabulate

b0: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install --upgrade pip
b1: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install -r imperative/python/requires-test.txt
b2: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install numpy wheel requests tqdm tabulate
c0: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install --upgrade pip
c1: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install -r imperative/python/requires-test.txt
c2: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install numpy wheel requests tqdm tabulate
d0: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install --upgrade pip
d1: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install -r imperative/python/requires-test.txt
d2: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install numpy wheel requests tqdm tabulate
1: refer to scripts/cmake-build/BUILD_README.md Windows section
``` ```


# How to build # How to build


Loading…
Cancel
Save