|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | 3 | # If you want to rebuild, run this with REBUILD=1 |
| 4 | +# If you want to build with CUDA, run this with USE_CUDA=1 |
| 5 | +# If you want to build without CUDA, run this with USE_CUDA=0 |
| 6 | + |
| 7 | +if [ ! -f setup.py ]; then |
| 8 | + echo "ERROR: Please run this build script from PyTorch root directory." |
| 9 | + exit 1 |
| 10 | +fi |
4 | 11 |
|
5 | 12 | COMPACT_JOB_NAME=pytorch-win-ws2016-cuda9-cudnn7-py3-build |
6 | 13 | source "$(dirname "${BASH_SOURCE[0]}")/common.sh" |
@@ -109,24 +116,35 @@ set DISTUTILS_USE_SDK=1 |
109 | 116 |
|
110 | 117 | set CMAKE_GENERATOR=Ninja |
111 | 118 |
|
112 | | -if "%REBUILD%"=="" ( |
113 | | - set NO_CUDA=1 |
114 | | - python setup.py install |
115 | | -) |
116 | | -if errorlevel 1 exit /b 1 |
117 | | -if not errorlevel 0 exit /b 1 |
118 | | -if "%REBUILD%"=="" ( |
119 | | - sccache --show-stats |
120 | | - sccache --zero-stats |
121 | | - rd /s /q C:\\Jenkins\\Miniconda3\\Lib\\site-packages\\torch |
122 | | - copy %CD%\\tmp_bin\\sccache.exe tmp_bin\\nvcc.exe |
| 119 | +if not "%USE_CUDA%"=="1" ( |
| 120 | + if "%REBUILD%"=="" ( |
| 121 | + set NO_CUDA=1 |
| 122 | + python setup.py install |
| 123 | + ) |
| 124 | + if errorlevel 1 exit /b 1 |
| 125 | + if not errorlevel 0 exit /b 1 |
123 | 126 | ) |
124 | 127 |
|
125 | | -set CUDA_NVCC_EXECUTABLE=%CD%\\tmp_bin\\nvcc |
| 128 | +if not "%USE_CUDA%"=="0" ( |
| 129 | + if "%REBUILD%"=="" ( |
| 130 | + sccache --show-stats |
| 131 | + sccache --zero-stats |
| 132 | + rd /s /q C:\\Jenkins\\Miniconda3\\Lib\\site-packages\\torch |
| 133 | + copy %CD%\\tmp_bin\\sccache.exe tmp_bin\\nvcc.exe |
| 134 | + ) |
126 | 135 |
|
127 | | -if "%REBUILD%"=="" set NO_CUDA= |
| 136 | + set CUDA_NVCC_EXECUTABLE=%CD%\\tmp_bin\\nvcc |
128 | 137 |
|
129 | | -python setup.py install && sccache --show-stats && 7z a %IMAGE_COMMIT_TAG%.7z C:\\Jenkins\\Miniconda3\\Lib\\site-packages\\torch && python ci_scripts\\upload_image.py %IMAGE_COMMIT_TAG%.7z |
| 138 | + if "%REBUILD%"=="" set NO_CUDA=0 |
| 139 | +
|
| 140 | + python setup.py install && sccache --show-stats && ( |
| 141 | + if "%BUILD_ENVIRONMENT%"=="" ( |
| 142 | + echo "NOTE: To run `import torch`, please make sure to activate the conda environment by running `call C:\\Jenkins\\Miniconda3\\Scripts\\activate.bat C:\\Jenkins\\Miniconda3` in Command Prompt before running Git Bash." |
| 143 | + ) else ( |
| 144 | + 7z a %IMAGE_COMMIT_TAG%.7z C:\\Jenkins\\Miniconda3\\Lib\\site-packages\\torch && python ci_scripts\\upload_image.py %IMAGE_COMMIT_TAG%.7z |
| 145 | + ) |
| 146 | + ) |
| 147 | +) |
130 | 148 |
|
131 | 149 | EOL |
132 | 150 |
|
|
0 commit comments