Skip to content

Commit 65e9171

Browse files
authored
WIN smoke test support for nightly package (#456)
1 parent 39d5dd4 commit 65e9171

File tree

3 files changed

+92
-11
lines changed

3 files changed

+92
-11
lines changed

smoke_test.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ if [[ "$PACKAGE_TYPE" == 'libtorch' ]]; then
7878

7979
elif [[ "$PACKAGE_TYPE" == *wheel ]]; then
8080
package_name='torch'
81-
elif [[ "$DESIRED_CUDA" == 'cpu' && "$(uname)" != 'Darwin' ]]; then
82-
package_name='pytorch'
8381
else
8482
package_name='pytorch'
8583
fi
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
if "%PACKAGE_TYPE%" == "wheel" goto wheel
2+
if "%PACKAGE_TYPE%" == "conda" goto conda
3+
if "%PACKAGE_TYPE%" == "libtorch" goto libtorch
4+
5+
:wheel
6+
echo "install pytorch wheel from nightly"
7+
8+
set pip_url="https://download.pytorch.org/whl/nightly/%DESIRED_CUDA%/torch_nightly.html"
9+
if "%DESIRED_CUDA%" == "cu102" (
10+
set package_name_and_version="torch==%NIGHTLIES_DATE_PREAMBLE%%DATE%"
11+
) else (
12+
set package_name_and_version="torch==%NIGHTLIES_DATE_PREAMBLE%%DATE%+%DESIRED_CUDA%"
13+
)
14+
pip install "%package_name_and_version%" -f "%pip_url%" --no-cache-dir --no-index -q
15+
if errorlevel 1 exit /b 1
16+
17+
exit /b 0
18+
19+
:conda
20+
echo "install pytorch conda from nightly"
21+
set package_name_and_version="pytorch==%NIGHTLIES_DATE_PREAMBLE%%DATE%"
22+
23+
if "%DESIRED_CUDA%" == "cpu" (
24+
call conda install -yq -c pytorch-nightly %package_name_and_version% cpuonly
25+
) else (
26+
call conda install -yq -c pytorch-nightly "cudatoolkit=%CUDA_VERSION_STR%" %package_name_and_version%
27+
)
28+
if ERRORLEVEL 1 exit /b 1
29+
30+
FOR /f %%i in ('python -c "import sys;print(sys.version)"') do set cur_python=%%i
31+
32+
if not %cur_python:~0,3% == %DESIRED_PYTHON% (
33+
echo "The Python version has changed to %cur_python%"
34+
echo "Probably the package for the version we want does not exist"
35+
echo "conda will change the Python version even if it was explicitly declared"
36+
)
37+
38+
if "%DESIRED_CUDA%" == "cpu" (
39+
call conda list torch | findstr cuda || exit /b 0
40+
echo "The installed package is built for CUDA, the full package is"
41+
call conda list torch
42+
) else (
43+
call conda list torch | findstr cuda%CUDA_VERSION% && exit /b 0
44+
echo "The installed package doesn't seem to be built for CUDA "%CUDA_VERSION_STR%
45+
echo "the full package is "
46+
call conda list torch
47+
)
48+
exit /b 1
49+
50+
:libtorch
51+
echo "install libtorch from nightly"
52+
if "%LIBTORCH_CONFIG%" == "debug" (
53+
set NAME_PREFIX=libtorch-win-shared-with-deps-debug
54+
) else (
55+
set NAME_PREFIX=libtorch-win-shared-with-deps
56+
)
57+
if "%DESIRED_CUDA%" == "cu102" (
58+
set package_name=%NAME_PREFIX%-%NIGHTLIES_DATE_PREAMBLE%%DATE%.zip
59+
) else (
60+
set package_name=%NAME_PREFIX%-%NIGHTLIES_DATE_PREAMBLE%%DATE%%%2B%DESIRED_CUDA%.zip
61+
)
62+
set libtorch_url="https://download.pytorch.org/libtorch/nightly/%DESIRED_CUDA%/%package_name%"
63+
curl --retry 3 -k "%libtorch_url%" -o %package_name%
64+
if ERRORLEVEL 1 exit /b 1
65+
66+
7z x %package_name% -otmp
67+
if ERRORLEVEL 1 exit /b 1

windows/internal/smoke_test.bat

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ set "PATH=%CD%\Python%PYTHON_VERSION%\Scripts;%CD%\Python%PYTHON_VERSION%;%PATH%
4949
pip install -q future numpy protobuf six "mkl>=2019"
5050
if errorlevel 1 exit /b 1
5151

52-
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do pip install "%%i"
53-
if errorlevel 1 exit /b 1
52+
if "%TEST_NIGHTLY_PACKAGE%" == "1" (
53+
call internal\install_nightly_package.bat
54+
if errorlevel 1 exit /b 1
55+
) else (
56+
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do pip install "%%i"
57+
if errorlevel 1 exit /b 1
58+
)
5459

5560
goto smoke_test
5661

@@ -79,16 +84,22 @@ if errorlevel 1 exit /b 1
7984
call conda install -yq future numpy protobuf six
8085
if ERRORLEVEL 1 exit /b 1
8186

82-
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.tar.bz2') do call conda install -y "%%i" --offline
83-
if ERRORLEVEL 1 exit /b 1
84-
85-
if "%CUDA_VERSION%" == "cpu" goto install_cpu_torch
86-
8787
set /a CUDA_VER=%CUDA_VERSION%
8888
set CUDA_VER_MAJOR=%CUDA_VERSION:~0,-1%
8989
set CUDA_VER_MINOR=%CUDA_VERSION:~-1,1%
9090
set CUDA_VERSION_STR=%CUDA_VER_MAJOR%.%CUDA_VER_MINOR%
9191

92+
if "%TEST_NIGHTLY_PACKAGE%" == "1" (
93+
call internal\install_nightly_package.bat
94+
if errorlevel 1 exit /b 1
95+
goto smoke_test
96+
)
97+
98+
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.tar.bz2') do call conda install -y "%%i" --offline
99+
if ERRORLEVEL 1 exit /b 1
100+
101+
if "%CUDA_VERSION%" == "cpu" goto install_cpu_torch
102+
92103
if "%CUDA_VERSION_STR%" == "9.2" (
93104
call conda install -y "cudatoolkit=%CUDA_VERSION_STR%" -c pytorch -c defaults -c numba/label/dev
94105
) else (
@@ -138,8 +149,13 @@ echo "install and test libtorch"
138149
if "%VC_YEAR%" == "2017" powershell internal\vs2017_install.ps1
139150
if ERRORLEVEL 1 exit /b 1
140151

141-
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *-latest.zip') do 7z x "%%i" -otmp
142-
if ERRORLEVEL 1 exit /b 1
152+
if "%TEST_NIGHTLY_PACKAGE%" == "1" (
153+
call internal\install_nightly_package.bat
154+
if errorlevel 1 exit /b 1
155+
) else (
156+
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *-latest.zip') do 7z x "%%i" -otmp
157+
if ERRORLEVEL 1 exit /b 1
158+
)
143159

144160
pushd tmp\libtorch
145161

0 commit comments

Comments
 (0)