Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes for the Windows build #339

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some fixes for the Windows build
  • Loading branch information
peterjc123 committed Aug 14, 2019
commit a67410f64ad0a6c5fdf6961cdb90fce434688c4e
2 changes: 0 additions & 2 deletions conda/build_pytorch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ elif [[ "$OSTYPE" == "msys" ]]; then
pushd $tmp_conda
export PATH="$(pwd):$(pwd)/Library/usr/bin:$(pwd)/Library/bin:$(pwd)/Scripts:$(pwd)/bin:$PATH"
popd
# We have to skip 3.17 because of the following bug.
# https://github.com/conda/conda-build/issues/3285
retry conda install -yq conda-build
fi

Expand Down
3 changes: 2 additions & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ if [[ "$package_type" == conda || "$(uname)" == Darwin ]]; then
# have a feature requirement). If we post-facto install the feature,
# that will make the environment consistent again.
if [[ "$cuda_ver" != 'cpu' ]]; then
retry conda install -yq cudatoolkit=$cuda_ver_majmin
# Windows CUDA 9.2 packages is not available in the defaults channel.
retry conda install -yq -c defaults -c numba/label/dev cudatoolkit=$cuda_ver_majmin
else
# We DON'T want to install cpuonly, because it should not be
# necessary for OS X PyTorch which is always cpu only by default
Expand Down
49 changes: 26 additions & 23 deletions windows/build_pytorch.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
:: This script parses args, installs required libraries (miniconda, MKL,
:: Magma), and then delegates to cpu.bat, cuda80.bat, etc.

IF NOT "%CUDA_VERSION%" == "" IF NOT "%PYTORCH_BUILD_VERSION%" == "" if NOT "%PYTORCH_BUILD_NUMBER%" == "" goto env_end
if not "%CUDA_VERSION%" == "" if not "%PYTORCH_BUILD_VERSION%" == "" if not "%PYTORCH_BUILD_NUMBER%" == "" goto env_end
if "%~1"=="" goto arg_error
if "%~2"=="" goto arg_error
if "%~3"=="" goto arg_error
if NOT "%~4"=="" goto arg_error
if not "%~4"=="" goto arg_error
goto arg_end

:arg_error
Expand All @@ -25,13 +25,13 @@ set PYTORCH_BUILD_NUMBER=%~3

:env_end

if NOT "%CUDA_VERSION%" == "cpu" (
if not "%CUDA_VERSION%" == "cpu" (
set CUDA_PREFIX=cuda%CUDA_VERSION%
) else (
set CUDA_PREFIX=cpu
)

IF "%DESIRED_PYTHON%" == "" set DESIRED_PYTHON=3.5;3.6;3.7
if "%DESIRED_PYTHON%" == "" set DESIRED_PYTHON=3.5;3.6;3.7
set DESIRED_PYTHON_PREFIX=%DESIRED_PYTHON:.=%
set DESIRED_PYTHON_PREFIX=py%DESIRED_PYTHON_PREFIX:;=;py%

Expand All @@ -46,7 +46,7 @@ rmdir /s /q conda
del miniconda.exe
curl -k https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe -o "%miniconda_exe%"
call ..\conda\install_conda.bat
IF ERRORLEVEL 1 exit /b 1
if ERRORLEVEL 1 exit /b 1
set "ORIG_PATH=%PATH%"
set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%"

Expand All @@ -65,23 +65,23 @@ rmdir /s /q mkl
del mkl_2019.4.245.7z
curl https://s3.amazonaws.com/ossci-windows/mkl_2019.4.245.7z -k -O
7z x -aoa mkl_2019.4.245.7z -omkl
set CMAKE_INCLUDE_PATH=%cd%\\mkl\\include
set LIB=%cd%\\mkl\\lib;%LIB%
set CMAKE_INCLUDE_PATH=%cd%\mkl\include
set LIB=%cd%\mkl\lib;%LIB%

:: Download MAGMA Files on CUDA builds
IF "%CUDA_VERSION%" == "80" (
if "%CUDA_VERSION%" == "80" (
set MAGMA_VERSION=2.4.0
) ELSE (
) else (
set MAGMA_VERSION=2.5.0
)

if "%DEBUG%" == "1" (
set BUILD_TYPE=debug
) ELSE (
) else (
set BUILD_TYPE=release
)

if NOT "%CUDA_VERSION%" == "cpu" (
if not "%CUDA_VERSION%" == "cpu" (
rmdir /s /q magma_%CUDA_PREFIX%_%BUILD_TYPE%
del magma_%CUDA_PREFIX%_%BUILD_TYPE%.7z
curl -k https://s3.amazonaws.com/ossci-windows/magma_%MAGMA_VERSION%_%CUDA_PREFIX%_%BUILD_TYPE%.7z -o magma_%CUDA_PREFIX%_%BUILD_TYPE%.7z
Expand All @@ -90,13 +90,13 @@ if NOT "%CUDA_VERSION%" == "cpu" (

:: Install sccache
if "%USE_SCCACHE%" == "1" (
mkdir %CD%\\tmp_bin
curl -k https://s3.amazonaws.com/ossci-windows/sccache.exe --output %CD%\\tmp_bin\\sccache.exe
if NOT "%CUDA_VERSION%" == "" (
copy %CD%\\tmp_bin\\sccache.exe %CD%\\tmp_bin\\nvcc.exe
mkdir %CD%\tmp_bin
curl -k https://s3.amazonaws.com/ossci-windows/sccache.exe --output %CD%\tmp_bin\sccache.exe
if not "%CUDA_VERSION%" == "" (
copy %CD%\tmp_bin\sccache.exe %CD%\tmp_bin\nvcc.exe

set CUDA_NVCC_EXECUTABLE=%CD%\\tmp_bin\\nvcc
set "PATH=%CD%\\tmp_bin;%PATH%"
set CUDA_NVCC_EXECUTABLE=%CD%\tmp_bin\nvcc
set ADDITIONAL_PATH=%CD%\tmp_bin
)
)

Expand All @@ -108,21 +108,24 @@ for %%v in (%DESIRED_PYTHON_PREFIX%) do (
set PYTHON_PREFIX=%%v
set "CONDA_LIB_PATH=%CONDA_HOME%\envs\%%v\Library\bin"
set "PATH=%CONDA_HOME%\envs\%%v;%CONDA_HOME%\envs\%%v\scripts;%CONDA_HOME%\envs\%%v\Library\bin;%ORIG_PATH%"
if not "%ADDITIONAL_PATH%" == "" (
set "PATH=%ADDITIONAL_PATH%;%PATH%"
)
pip install ninja
@setlocal
:: Set Flags
if NOT "%CUDA_VERSION%"=="cpu" (
set MAGMA_HOME=%cd%\\magma_%CUDA_PREFIX%_%BUILD_TYPE%
if not "%CUDA_VERSION%"=="cpu" (
set MAGMA_HOME=%cd%\magma_%CUDA_PREFIX%_%BUILD_TYPE%
set CUDNN_VERSION=7
)
call %CUDA_PREFIX%.bat
IF ERRORLEVEL 1 exit /b 1
IF "%BUILD_PYTHONLESS%" == "" call internal\test.bat
IF ERRORLEVEL 1 exit /b 1
if ERRORLEVEL 1 exit /b 1
if "%BUILD_PYTHONLESS%" == "" call internal\test.bat
if ERRORLEVEL 1 exit /b 1
@endlocal
)

set "PATH=%ORIG_PATH%"
popd

IF ERRORLEVEL 1 exit /b 1
if ERRORLEVEL 1 exit /b 1
2 changes: 1 addition & 1 deletion windows/internal/nightly_defaults.bat
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if "%CUDA_VERSION%" == "cpu" (
:: pytorch-nightly==1.0.0.dev20180908
:: or in manylinux like
:: torch_nightly-1.0.0.dev20180908-cp27-cp27m-linux_x86_64.whl
if "%PYTORCH_BUILD_VERSION%" == "" set PYTORCH_BUILD_VERSION=1.2.0.dev%NIGHTLIES_DATE_COMPACT%
if "%PYTORCH_BUILD_VERSION%" == "" set PYTORCH_BUILD_VERSION=1.3.0.dev%NIGHTLIES_DATE_COMPACT%

if "%~1" == "Wheels" (
if "%BUILD_PYTHONLESS%" == "" (
Expand Down