Skip to content

Commit

Permalink
Update MKL for Windows & Reset line endings (pytorch#336)
Browse files Browse the repository at this point in the history
* Update MKL for Windows

* More

* Reset line endings

* Check in new file
  • Loading branch information
peterjc123 authored and soumith committed Aug 8, 2019
1 parent 0032cad commit 9491c25
Show file tree
Hide file tree
Showing 14 changed files with 482 additions and 480 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.bat text eol=crlf
*.sh text eol=lf
4 changes: 2 additions & 2 deletions conda/pytorch-1.1.0/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ set TORCH_NVCC_FLAGS=-Xfatbin -compress-all

set DISTUTILS_USE_SDK=1

curl https://s3.amazonaws.com/ossci-windows/mkl_2018.2.185.7z -k -O
7z x -aoa mkl_2018.2.185.7z -omkl
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=%SRC_DIR%\mkl\include
set LIB=%SRC_DIR%\mkl\lib;%LIB%

Expand Down
4 changes: 2 additions & 2 deletions conda/pytorch-nightly/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ set TORCH_NVCC_FLAGS=-Xfatbin -compress-all

set DISTUTILS_USE_SDK=1

curl https://s3.amazonaws.com/ossci-windows/mkl_2018.2.185.7z -k -O
7z x -aoa mkl_2018.2.185.7z -omkl
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=%SRC_DIR%\mkl\include
set LIB=%SRC_DIR%\mkl\lib;%LIB%

Expand Down
214 changes: 107 additions & 107 deletions windows/build_all.bat
Original file line number Diff line number Diff line change
@@ -1,107 +1,107 @@
@echo off

if "%~1"=="" goto arg_error
if "%~2"=="" goto arg_error
if NOT "%~3"=="" goto arg_error
goto arg_end

:arg_error

echo Illegal number of parameters. Pass pytorch version, build number
exit /b 1

:arg_end

set PYTORCH_BUILD_VERSION=%~1
set PYTORCH_BUILD_NUMBER=%~2

REM Install Miniconda3
set "CONDA_HOME=%CD%\conda"
set "tmp_conda=%CONDA_HOME%"
set "miniconda_exe=%CD%\miniconda.exe"
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

set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%"
set "ORIG_PATH=%PATH%"

conda remove -n py35 --all -y || rmdir %CONDA_HOME%\envs\py35 /s
conda remove -n py36 --all -y || rmdir %CONDA_HOME%\envs\py36 /s
conda remove -n py37 --all -y || rmdir %CONDA_HOME%\envs\py37 /s

conda create -n py35 -y -q numpy=1.11 mkl=2018 cffi pyyaml boto3 cmake ninja typing python=3.5
conda create -n py36 -y -q numpy=1.11 mkl=2018 cffi pyyaml boto3 cmake ninja typing python=3.6
conda create -n py37 -y -q numpy=1.11 mkl=2018 cffi pyyaml boto3 cmake ninja typing python=3.7

REM Install MKL
rmdir /s /q mkl
del mkl_2018.2.185.7z
curl https://s3.amazonaws.com/ossci-windows/mkl_2018.2.185.7z -k -O
7z x -aoa mkl_2018.2.185.7z -omkl
set CMAKE_INCLUDE_PATH=%cd%\\mkl\\include
set LIB=%cd%\\mkl\\lib;%LIB%

REM Download MAGMA Files
for %%p in (
cuda80
cuda90
cuda92
) do (
rmdir /s /q magma_%%p_release
del magma_%%p_release.7z
curl -k https://s3.amazonaws.com/ossci-windows/magma_%%p_release_mkl_2018.2.185.7z -o magma_%%p_release.7z
7z x -aoa magma_%%p_release.7z -omagma_%%p_release
)

REM Install sccache
mkdir %CD%\\tmp_bin
curl -k https://s3.amazonaws.com/ossci-windows/sccache.exe --output %CD%\\tmp_bin\\sccache.exe
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 PYTORCH_BINARY_BUILD=1
set TH_BINARY_BUILD=1

@setlocal EnableDelayedExpansion
for %%v in (
py35
py36
py37
) do (
REM Activate Python Environment
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%"
pip install ninja
for %%c in (
cpu
80
90
92
) do (
@setlocal

REM Set Flags
if NOT "%%c"=="cpu" (
if NOT "%%c"=="92" (
set MAGMA_HOME=%cd%\\magma_!CUDA_PREFIX!_release
) else (
set MAGMA_HOME=%cd%\\magma_!CUDA_PREFIX!_release\magma_cuda92\magma\install
)
set CUDA_VERSION=%%c
set CUDA_PREFIX=cuda!CUDA_VERSION!
set CUDNN_VERSION=7
) else (
set CUDA_PREFIX=cpu
)
call !CUDA_PREFIX!.bat
@endlocal
)
)

@endlocal

set "PATH=%ORIG_PATH%"
@echo off

if "%~1"=="" goto arg_error
if "%~2"=="" goto arg_error
if NOT "%~3"=="" goto arg_error
goto arg_end

:arg_error

echo Illegal number of parameters. Pass pytorch version, build number
exit /b 1

:arg_end

set PYTORCH_BUILD_VERSION=%~1
set PYTORCH_BUILD_NUMBER=%~2

REM Install Miniconda3
set "CONDA_HOME=%CD%\conda"
set "tmp_conda=%CONDA_HOME%"
set "miniconda_exe=%CD%\miniconda.exe"
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

set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%"
set "ORIG_PATH=%PATH%"

conda remove -n py35 --all -y || rmdir %CONDA_HOME%\envs\py35 /s
conda remove -n py36 --all -y || rmdir %CONDA_HOME%\envs\py36 /s
conda remove -n py37 --all -y || rmdir %CONDA_HOME%\envs\py37 /s

conda create -n py35 -y -q numpy=1.11 mkl=2018 cffi pyyaml boto3 cmake ninja typing python=3.5
conda create -n py36 -y -q numpy=1.11 mkl=2018 cffi pyyaml boto3 cmake ninja typing python=3.6
conda create -n py37 -y -q numpy=1.11 mkl=2018 cffi pyyaml boto3 cmake ninja typing python=3.7

REM Install MKL
rmdir /s /q mkl
del mkl_2018.2.185.7z
curl https://s3.amazonaws.com/ossci-windows/mkl_2018.2.185.7z -k -O
7z x -aoa mkl_2018.2.185.7z -omkl
set CMAKE_INCLUDE_PATH=%cd%\\mkl\\include
set LIB=%cd%\\mkl\\lib;%LIB%

REM Download MAGMA Files
for %%p in (
cuda80
cuda90
cuda92
) do (
rmdir /s /q magma_%%p_release
del magma_%%p_release.7z
curl -k https://s3.amazonaws.com/ossci-windows/magma_%%p_release_mkl_2018.2.185.7z -o magma_%%p_release.7z
7z x -aoa magma_%%p_release.7z -omagma_%%p_release
)

REM Install sccache
mkdir %CD%\\tmp_bin
curl -k https://s3.amazonaws.com/ossci-windows/sccache.exe --output %CD%\\tmp_bin\\sccache.exe
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 PYTORCH_BINARY_BUILD=1
set TH_BINARY_BUILD=1

@setlocal EnableDelayedExpansion
for %%v in (
py35
py36
py37
) do (
REM Activate Python Environment
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%"
pip install ninja
for %%c in (
cpu
80
90
92
) do (
@setlocal

REM Set Flags
if NOT "%%c"=="cpu" (
if NOT "%%c"=="92" (
set MAGMA_HOME=%cd%\\magma_!CUDA_PREFIX!_release
) else (
set MAGMA_HOME=%cd%\\magma_!CUDA_PREFIX!_release\magma_cuda92\magma\install
)
set CUDA_VERSION=%%c
set CUDA_PREFIX=cuda!CUDA_VERSION!
set CUDNN_VERSION=7
) else (
set CUDA_PREFIX=cpu
)
call !CUDA_PREFIX!.bat
@endlocal
)
)

@endlocal

set "PATH=%ORIG_PATH%"
6 changes: 3 additions & 3 deletions windows/build_pytorch.bat
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ endlocal

:: Install MKL
rmdir /s /q mkl
del mkl_2018.2.185.7z
curl https://s3.amazonaws.com/ossci-windows/mkl_2018.2.185.7z -k -O
7z x -aoa mkl_2018.2.185.7z -omkl
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%

Expand Down
74 changes: 37 additions & 37 deletions windows/cpu.bat
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
@echo off

IF NOT "%BUILD_VISION%" == "" (
set MODULE_NAME=vision
) ELSE (
set MODULE_NAME=pytorch
)

IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" (
call internal\clone.bat
cd ..
IF ERRORLEVEL 1 goto eof
) ELSE (
call internal\clean.bat
)

call internal\check_deps.bat
IF ERRORLEVEL 1 goto eof

REM Check for optional components

echo Disabling CUDA
set USE_CUDA=0
set USE_CUDA=0

IF "%BUILD_VISION%" == "" (
call internal\check_opts.bat
IF ERRORLEVEL 1 goto eof

call internal\copy_cpu.bat
IF ERRORLEVEL 1 goto eof
)

call internal\setup.bat
IF ERRORLEVEL 1 goto eof

:eof
@echo off

IF NOT "%BUILD_VISION%" == "" (
set MODULE_NAME=vision
) ELSE (
set MODULE_NAME=pytorch
)

IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" (
call internal\clone.bat
cd ..
IF ERRORLEVEL 1 goto eof
) ELSE (
call internal\clean.bat
)

call internal\check_deps.bat
IF ERRORLEVEL 1 goto eof

REM Check for optional components

echo Disabling CUDA
set USE_CUDA=0
set USE_CUDA=0

IF "%BUILD_VISION%" == "" (
call internal\check_opts.bat
IF ERRORLEVEL 1 goto eof

call internal\copy_cpu.bat
IF ERRORLEVEL 1 goto eof
)

call internal\setup.bat
IF ERRORLEVEL 1 goto eof

:eof
Loading

0 comments on commit 9491c25

Please sign in to comment.