Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
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
2 changes: 0 additions & 2 deletions smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ if [[ "$PACKAGE_TYPE" == 'libtorch' ]]; then

elif [[ "$PACKAGE_TYPE" == *wheel ]]; then
package_name='torch'
elif [[ "$DESIRED_CUDA" == 'cpu' && "$(uname)" != 'Darwin' ]]; then
package_name='pytorch'
else
package_name='pytorch'
fi
Expand Down
67 changes: 67 additions & 0 deletions windows/internal/install_nightly_package.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
if "%PACKAGE_TYPE%" == "wheel" goto wheel
if "%PACKAGE_TYPE%" == "conda" goto conda
if "%PACKAGE_TYPE%" == "libtorch" goto libtorch

:wheel
echo "install pytorch wheel from nightly"

set pip_url="https://download.pytorch.org/whl/nightly/%DESIRED_CUDA%/torch_nightly.html"
if "%DESIRED_CUDA%" == "cu102" (
set package_name_and_version="torch==%NIGHTLIES_DATE_PREAMBLE%%DATE%"
) else (
set package_name_and_version="torch==%NIGHTLIES_DATE_PREAMBLE%%DATE%+%DESIRED_CUDA%"
)
pip install "%package_name_and_version%" -f "%pip_url%" --no-cache-dir --no-index -q
if errorlevel 1 exit /b 1

exit /b 0

:conda
echo "install pytorch conda from nightly"
set package_name_and_version="pytorch==%NIGHTLIES_DATE_PREAMBLE%%DATE%"

if "%DESIRED_CUDA%" == "cpu" (
call conda install -yq -c pytorch-nightly %package_name_and_version% cpuonly
) else (
call conda install -yq -c pytorch-nightly "cudatoolkit=%CUDA_VERSION_STR%" %package_name_and_version%
)
if ERRORLEVEL 1 exit /b 1

FOR /f %%i in ('python -c "import sys;print(sys.version)"') do set cur_python=%%i

if not %cur_python:~0,3% == %DESIRED_PYTHON% (
echo "The Python version has changed to %cur_python%"
echo "Probably the package for the version we want does not exist"
echo "conda will change the Python version even if it was explicitly declared"
)

if "%DESIRED_CUDA%" == "cpu" (
call conda list torch | findstr cuda || exit /b 0
echo "The installed package is built for CUDA, the full package is"
call conda list torch
) else (
call conda list torch | findstr cuda%CUDA_VERSION% && exit /b 0
echo "The installed package doesn't seem to be built for CUDA "%CUDA_VERSION_STR%
echo "the full package is "
call conda list torch
)
exit /b 1

:libtorch
echo "install libtorch from nightly"
if "%LIBTORCH_CONFIG%" == "debug" (
set NAME_PREFIX=libtorch-win-shared-with-deps-debug
) else (
set NAME_PREFIX=libtorch-win-shared-with-deps
)
if "%DESIRED_CUDA%" == "cu102" (
set package_name=%NAME_PREFIX%-%NIGHTLIES_DATE_PREAMBLE%%DATE%.zip
) else (
set package_name=%NAME_PREFIX%-%NIGHTLIES_DATE_PREAMBLE%%DATE%%%2B%DESIRED_CUDA%.zip
)
set libtorch_url="https://download.pytorch.org/libtorch/nightly/%DESIRED_CUDA%/%package_name%"
curl --retry 3 -k "%libtorch_url%" -o %package_name%
if ERRORLEVEL 1 exit /b 1

7z x %package_name% -otmp
if ERRORLEVEL 1 exit /b 1
34 changes: 25 additions & 9 deletions windows/internal/smoke_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ set "PATH=%CD%\Python%PYTHON_VERSION%\Scripts;%CD%\Python%PYTHON_VERSION%;%PATH%
pip install -q future numpy protobuf six "mkl>=2019"
if errorlevel 1 exit /b 1

for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do pip install "%%i"
if errorlevel 1 exit /b 1
if "%TEST_NIGHTLY_PACKAGE%" == "1" (
call internal\install_nightly_package.bat
if errorlevel 1 exit /b 1
) else (
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do pip install "%%i"
if errorlevel 1 exit /b 1
)

goto smoke_test

Expand Down Expand Up @@ -79,16 +84,22 @@ if errorlevel 1 exit /b 1
call conda install -yq future numpy protobuf six
if ERRORLEVEL 1 exit /b 1

for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.tar.bz2') do call conda install -y "%%i" --offline
if ERRORLEVEL 1 exit /b 1

if "%CUDA_VERSION%" == "cpu" goto install_cpu_torch

set /a CUDA_VER=%CUDA_VERSION%
set CUDA_VER_MAJOR=%CUDA_VERSION:~0,-1%
set CUDA_VER_MINOR=%CUDA_VERSION:~-1,1%
set CUDA_VERSION_STR=%CUDA_VER_MAJOR%.%CUDA_VER_MINOR%

if "%TEST_NIGHTLY_PACKAGE%" == "1" (
call internal\install_nightly_package.bat
if errorlevel 1 exit /b 1
goto smoke_test
)

for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.tar.bz2') do call conda install -y "%%i" --offline
if ERRORLEVEL 1 exit /b 1

if "%CUDA_VERSION%" == "cpu" goto install_cpu_torch

if "%CUDA_VERSION_STR%" == "9.2" (
call conda install -y "cudatoolkit=%CUDA_VERSION_STR%" -c pytorch -c defaults -c numba/label/dev
) else (
Expand Down Expand Up @@ -138,8 +149,13 @@ echo "install and test libtorch"
if "%VC_YEAR%" == "2017" powershell internal\vs2017_install.ps1
if ERRORLEVEL 1 exit /b 1

for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *-latest.zip') do 7z x "%%i" -otmp
if ERRORLEVEL 1 exit /b 1
if "%TEST_NIGHTLY_PACKAGE%" == "1" (
call internal\install_nightly_package.bat
if errorlevel 1 exit /b 1
) else (
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *-latest.zip') do 7z x "%%i" -otmp
if ERRORLEVEL 1 exit /b 1
)

pushd tmp\libtorch

Expand Down