From ac580c8cce2db1d986b256a66322cb9c3a2fd918 Mon Sep 17 00:00:00 2001 From: atalman Date: Mon, 5 Dec 2022 11:07:52 -0800 Subject: [PATCH] Refactor not to cal install nightly package --- windows/internal/install_nightly_package.bat | 67 -------------------- windows/internal/smoke_test.bat | 30 +++------ 2 files changed, 10 insertions(+), 87 deletions(-) delete mode 100644 windows/internal/install_nightly_package.bat diff --git a/windows/internal/install_nightly_package.bat b/windows/internal/install_nightly_package.bat deleted file mode 100644 index 7db23ebd6..000000000 --- a/windows/internal/install_nightly_package.bat +++ /dev/null @@ -1,67 +0,0 @@ -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 diff --git a/windows/internal/smoke_test.bat b/windows/internal/smoke_test.bat index e81532438..cc7919358 100644 --- a/windows/internal/smoke_test.bat +++ b/windows/internal/smoke_test.bat @@ -51,10 +51,7 @@ set "PATH=%CD%\Python%PYTHON_VERSION%\Scripts;%CD%\Python;%PATH%" pip install -q numpy protobuf "mkl>=2019" if errorlevel 1 exit /b 1 -if NOT "%PYTORCH_BUILD_VERSION%"=="%PYTORCH_BUILD_VERSION:dev=%" ( - call internal\install_nightly_package.bat - if errorlevel 1 exit /b 1 -) else ( +if "%PYTORCH_BUILD_VERSION%"=="%PYTORCH_BUILD_VERSION:dev=%" ( for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do pip install "%%i" if errorlevel 1 exit /b 1 ) @@ -106,20 +103,16 @@ 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 NOT "%PYTORCH_BUILD_VERSION%"=="%PYTORCH_BUILD_VERSION:dev=%" ( - 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 %CONDA_EXTRA_ARGS% -y "%%i" --offline -if ERRORLEVEL 1 exit /b 1 +if "%PYTORCH_BUILD_VERSION%"=="%PYTORCH_BUILD_VERSION:dev=%" ( + for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.tar.bz2') do call conda install %CONDA_EXTRA_ARGS% -y "%%i" --offline + if ERRORLEVEL 1 exit /b 1 -if "%CUDA_VERSION%" == "cpu" goto install_cpu_torch + if "%CUDA_VERSION%" == "cpu" goto install_cpu_torch -:: We do an update --all here since that will install the dependencies for any package that's installed offline -call conda update --all %CONDA_EXTRA_ARGS% -y -c pytorch -c defaults -c numba/label/dev -if ERRORLEVEL 1 exit /b 1 + :: We do an update --all here since that will install the dependencies for any package that's installed offline + call conda update --all %CONDA_EXTRA_ARGS% -y -c pytorch -c defaults -c numba/label/dev + if ERRORLEVEL 1 exit /b 1 +) goto smoke_test @@ -168,10 +161,7 @@ echo "install and test libtorch" if "%VC_YEAR%" == "2017" powershell internal\vs2017_install.ps1 if ERRORLEVEL 1 exit /b 1 -if NOT "%PYTORCH_BUILD_VERSION%"=="%PYTORCH_BUILD_VERSION:dev=%" ( - call internal\install_nightly_package.bat - if errorlevel 1 exit /b 1 -) else ( +if "%PYTORCH_BUILD_VERSION%"=="%PYTORCH_BUILD_VERSION:dev=%" ( for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *-latest.zip') do 7z x "%%i" -otmp if ERRORLEVEL 1 exit /b 1 )