From f2e2e63c06a7f8560d6ad330ed7bd90c8a461228 Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Mon, 9 Dec 2024 15:30:58 +0000 Subject: [PATCH] Remove windows batch scripts (#2051) * Remove windows batch scripts * more --- windows/build_pytorch.bat | 132 -------------- windows/condaenv.bat | 26 --- windows/cpu.bat | 28 --- windows/cuda118.bat | 58 ------ windows/cuda121.bat | 58 ------ windows/cuda124.bat | 58 ------ windows/cuda126.bat | 58 ------ windows/internal/7z_install.bat | 9 - windows/internal/build_wheels.bat | 11 -- windows/internal/check_deps.bat | 79 -------- windows/internal/check_opts.bat | 47 ----- windows/internal/clean.bat | 5 - windows/internal/clone.bat | 63 ------- windows/internal/copy.bat | 26 --- windows/internal/copy_cpu.bat | 3 - windows/internal/cuda_install.bat | 218 ---------------------- windows/internal/driver_update.bat | 9 - windows/internal/env_fix.bat | 38 ---- windows/internal/setup.bat | 107 ----------- windows/internal/smoke_test.bat | 241 ------------------------- windows/internal/static_lib_test.bat | 132 -------------- windows/internal/vc_install_helper.bat | 21 --- windows/internal/vs_install.bat | 28 --- windows/internal/xpu_install.bat | 119 ------------ windows/xpu.bat | 41 ----- 25 files changed, 1615 deletions(-) delete mode 100644 windows/build_pytorch.bat delete mode 100644 windows/condaenv.bat delete mode 100755 windows/cpu.bat delete mode 100644 windows/cuda118.bat delete mode 100644 windows/cuda121.bat delete mode 100644 windows/cuda124.bat delete mode 100644 windows/cuda126.bat delete mode 100644 windows/internal/7z_install.bat delete mode 100644 windows/internal/build_wheels.bat delete mode 100755 windows/internal/check_deps.bat delete mode 100755 windows/internal/check_opts.bat delete mode 100755 windows/internal/clean.bat delete mode 100755 windows/internal/clone.bat delete mode 100755 windows/internal/copy.bat delete mode 100755 windows/internal/copy_cpu.bat delete mode 100644 windows/internal/cuda_install.bat delete mode 100644 windows/internal/driver_update.bat delete mode 100644 windows/internal/env_fix.bat delete mode 100755 windows/internal/setup.bat delete mode 100644 windows/internal/smoke_test.bat delete mode 100644 windows/internal/static_lib_test.bat delete mode 100644 windows/internal/vc_install_helper.bat delete mode 100644 windows/internal/vs_install.bat delete mode 100644 windows/internal/xpu_install.bat delete mode 100755 windows/xpu.bat diff --git a/windows/build_pytorch.bat b/windows/build_pytorch.bat deleted file mode 100644 index 1b43df8bb..000000000 --- a/windows/build_pytorch.bat +++ /dev/null @@ -1,132 +0,0 @@ -@echo off - -:: 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 "%~1"=="" goto arg_error -if "%~2"=="" goto arg_error -if "%~3"=="" goto arg_error -if not "%~4"=="" goto arg_error -goto arg_end - -:arg_error - -echo Illegal number of parameters. Pass cuda version, pytorch version, build number -echo CUDA version should be Mm with no dot, e.g. '80' -echo DESIRED_PYTHON should be M.m, e.g. '2.7' -exit /b 1 - -:arg_end - -set CUDA_VERSION=%~1 -set PYTORCH_BUILD_VERSION=%~2 -set PYTORCH_BUILD_NUMBER=%~3 - -:env_end - -set CUDA_PREFIX=cuda%CUDA_VERSION% -if "%CUDA_VERSION%" == "cpu" set CUDA_PREFIX=cpu -if "%CUDA_VERSION%" == "xpu" set CUDA_PREFIX=xpu - -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% - -set SRC_DIR=%~dp0 -pushd %SRC_DIR% - -:: 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 --retry 3 -k https://repo.anaconda.com/miniconda/Miniconda3-py311_23.9.0-0-Windows-x86_64.exe -o "%miniconda_exe%" -call ..\conda\install_conda.bat -if ERRORLEVEL 1 exit /b 1 -set "ORIG_PATH=%PATH%" -set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%" - -:: create a new conda environment and install packages -:try -SET /A tries=3 -:loop -IF %tries% LEQ 0 GOTO :exception -call condaenv.bat -IF %ERRORLEVEL% EQU 0 GOTO :done -SET /A "tries=%tries%-1" -:exception -echo "Failed to create conda env" -exit /B 1 -:done - -:: Download MAGMA Files on CUDA builds -set MAGMA_VERSION=2.5.4 - -if "%DEBUG%" == "1" ( - set BUILD_TYPE=debug -) else ( - set BUILD_TYPE=release -) - -if not "%CUDA_VERSION%" == "cpu" if not "%CUDA_VERSION%" == "xpu" ( - 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 - 7z x -aoa magma_%CUDA_PREFIX%_%BUILD_TYPE%.7z -omagma_%CUDA_PREFIX%_%BUILD_TYPE% -) - -:: 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 - curl -k https://s3.amazonaws.com/ossci-windows/sccache-cl.exe --output %CD%\tmp_bin\sccache-cl.exe - if not "%CUDA_VERSION%" == "" ( - set ADDITIONAL_PATH=%CD%\tmp_bin - set SCCACHE_IDLE_TIMEOUT=1500 - - :: randomtemp is used to resolve the intermittent build error related to CUDA. - :: code: https://github.com/peterjc123/randomtemp-rust - :: issue: https://github.com/pytorch/pytorch/issues/25393 - :: - :: CMake requires a single command as CUDA_NVCC_EXECUTABLE, so we push the wrappers - :: randomtemp.exe and sccache.exe into a batch file which CMake invokes. - curl -kL https://github.com/peterjc123/randomtemp-rust/releases/download/v0.4/randomtemp.exe --output %SRC_DIR%\tmp_bin\randomtemp.exe - echo @"%SRC_DIR%\tmp_bin\randomtemp.exe" "%SRC_DIR%\tmp_bin\sccache.exe" "%CUDA_PATH%\bin\nvcc.exe" %%* > "%SRC_DIR%/tmp_bin/nvcc.bat" - cat %SRC_DIR%/tmp_bin/nvcc.bat - set CUDA_NVCC_EXECUTABLE=%SRC_DIR%/tmp_bin/nvcc.bat - :: CMake doesn't accept back-slashes in the path - for /F "usebackq delims=" %%n in (`cygpath -m "%CUDA_PATH%\bin\nvcc.exe"`) do set CMAKE_CUDA_COMPILER=%%n - set CMAKE_CUDA_COMPILER_LAUNCHER=%SRC_DIR%\tmp_bin\randomtemp.exe;%SRC_DIR%\tmp_bin\sccache.exe - ) -) - -set PYTORCH_BINARY_BUILD=1 -set TH_BINARY_BUILD=1 -set INSTALL_TEST=0 - -for %%v in (%DESIRED_PYTHON_PREFIX%) do ( - :: Activate Python Environment - set PYTHON_PREFIX=%%v - set "CONDA_LIB_PATH=%CONDA_HOME%\envs\%%v\Library\bin" - if not "%ADDITIONAL_PATH%" == "" ( - set "PATH=%ADDITIONAL_PATH%;%CONDA_HOME%\envs\%%v;%CONDA_HOME%\envs\%%v\scripts;%CONDA_HOME%\envs\%%v\Library\bin;%ORIG_PATH%" - ) else ( - set "PATH=%CONDA_HOME%\envs\%%v;%CONDA_HOME%\envs\%%v\scripts;%CONDA_HOME%\envs\%%v\Library\bin;%ORIG_PATH%" - ) - pip install ninja - @setlocal - :: Set Flags - if not "%CUDA_VERSION%"=="cpu" if not "%CUDA_VERSION%" == "xpu" ( - set MAGMA_HOME=%cd%\magma_%CUDA_PREFIX%_%BUILD_TYPE% - ) - call %CUDA_PREFIX%.bat - if ERRORLEVEL 1 exit /b 1 - @endlocal -) - -set "PATH=%ORIG_PATH%" -popd - -if ERRORLEVEL 1 exit /b 1 diff --git a/windows/condaenv.bat b/windows/condaenv.bat deleted file mode 100644 index 1f0be2d69..000000000 --- a/windows/condaenv.bat +++ /dev/null @@ -1,26 +0,0 @@ -IF "%DESIRED_PYTHON%"=="" ( - echo DESIRED_PYTHON is NOT defined. - exit /b 1 -) - -:: Create a new conda environment -setlocal EnableDelayedExpansion -FOR %%v IN (%DESIRED_PYTHON%) DO ( - set PYTHON_VERSION_STR=%%v - set PYTHON_VERSION_STR=!PYTHON_VERSION_STR:.=! - conda remove -n py!PYTHON_VERSION_STR! --all -y || rmdir %CONDA_HOME%\envs\py!PYTHON_VERSION_STR! /s - if "%%v" == "3.8" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy=1.11 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v - if "%%v" == "3.9" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy=2.0.1 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v - if "%%v" == "3.10" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=2.0.1 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v - if "%%v" == "3.11" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=2.0.1 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v - if "%%v" == "3.12" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=2.0.1 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v - if "%%v" == "3.13" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=2.1.2 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v - call conda run -n py!PYTHON_VERSION_STR! pip install mkl-include - call conda run -n py!PYTHON_VERSION_STR! pip install mkl-static -) -endlocal - -:: Install libuv -conda install -y -q -c conda-forge libuv=1.39 -set libuv_ROOT=%CONDA_HOME%\Library -echo libuv_ROOT=%libuv_ROOT% diff --git a/windows/cpu.bat b/windows/cpu.bat deleted file mode 100755 index 7b96816b8..000000000 --- a/windows/cpu.bat +++ /dev/null @@ -1,28 +0,0 @@ -@echo off - -set MODULE_NAME=pytorch - -IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" ( - call internal\clone.bat - cd .. -) ELSE ( - call internal\clean.bat -) -IF ERRORLEVEL 1 goto :eof - -call internal\check_deps.bat -IF ERRORLEVEL 1 goto :eof - -REM Check for optional components - -echo Disabling CUDA -set USE_CUDA=0 - -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 diff --git a/windows/cuda118.bat b/windows/cuda118.bat deleted file mode 100644 index 02d91adc3..000000000 --- a/windows/cuda118.bat +++ /dev/null @@ -1,58 +0,0 @@ -@echo off - -set MODULE_NAME=pytorch - -IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" ( - call internal\clone.bat - cd .. -) ELSE ( - call internal\clean.bat -) -IF ERRORLEVEL 1 goto :eof - -call internal\check_deps.bat -IF ERRORLEVEL 1 goto :eof - -REM Check for optional components - -set USE_CUDA= -set CMAKE_GENERATOR=Visual Studio 15 2017 Win64 - -IF "%NVTOOLSEXT_PATH%"=="" ( - IF EXIST "C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64\nvToolsExt64_1.lib" ( - set NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt - ) ELSE ( - echo NVTX ^(Visual Studio Extension ^for CUDA^) ^not installed, failing - exit /b 1 - ) -) - -IF "%CUDA_PATH_V118%"=="" ( - IF EXIST "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe" ( - set "CUDA_PATH_V118=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8" - ) ELSE ( - echo CUDA 11.8 not found, failing - exit /b 1 - ) -) - -IF "%BUILD_VISION%" == "" ( - set TORCH_CUDA_ARCH_LIST=3.7+PTX;5.0;6.0;6.1;7.0;7.5;8.0;8.6;9.0 - set TORCH_NVCC_FLAGS=-Xfatbin -compress-all -) ELSE ( - set NVCC_FLAGS=-D__CUDA_NO_HALF_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=compute_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_90,code=compute_90 -) - -set "CUDA_PATH=%CUDA_PATH_V118%" -set "PATH=%CUDA_PATH_V118%\bin;%PATH%" - -:optcheck - -call internal\check_opts.bat -IF ERRORLEVEL 1 goto :eof - -call internal\copy.bat -IF ERRORLEVEL 1 goto :eof - -call internal\setup.bat -IF ERRORLEVEL 1 goto :eof diff --git a/windows/cuda121.bat b/windows/cuda121.bat deleted file mode 100644 index e8be06baa..000000000 --- a/windows/cuda121.bat +++ /dev/null @@ -1,58 +0,0 @@ -@echo off - -set MODULE_NAME=pytorch - -IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" ( - call internal\clone.bat - cd .. -) ELSE ( - call internal\clean.bat -) -IF ERRORLEVEL 1 goto :eof - -call internal\check_deps.bat -IF ERRORLEVEL 1 goto :eof - -REM Check for optional components - -set USE_CUDA= -set CMAKE_GENERATOR=Visual Studio 15 2017 Win64 - -IF "%NVTOOLSEXT_PATH%"=="" ( - IF EXIST "C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64\nvToolsExt64_1.lib" ( - set NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt - ) ELSE ( - echo NVTX ^(Visual Studio Extension ^for CUDA^) ^not installed, failing - exit /b 1 - ) -) - -IF "%CUDA_PATH_V121%"=="" ( - IF EXIST "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\nvcc.exe" ( - set "CUDA_PATH_V121=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1" - ) ELSE ( - echo CUDA 12.1 not found, failing - exit /b 1 - ) -) - -IF "%BUILD_VISION%" == "" ( - set TORCH_CUDA_ARCH_LIST=5.0;6.0;6.1;7.0;7.5;8.0;8.6;9.0 - set TORCH_NVCC_FLAGS=-Xfatbin -compress-all -) ELSE ( - set NVCC_FLAGS=-D__CUDA_NO_HALF_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=compute_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_90,code=compute_90 -) - -set "CUDA_PATH=%CUDA_PATH_V121%" -set "PATH=%CUDA_PATH_V121%\bin;%PATH%" - -:optcheck - -call internal\check_opts.bat -IF ERRORLEVEL 1 goto :eof - -call internal\copy.bat -IF ERRORLEVEL 1 goto :eof - -call internal\setup.bat -IF ERRORLEVEL 1 goto :eof diff --git a/windows/cuda124.bat b/windows/cuda124.bat deleted file mode 100644 index b9594e159..000000000 --- a/windows/cuda124.bat +++ /dev/null @@ -1,58 +0,0 @@ -@echo off - -set MODULE_NAME=pytorch - -IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" ( - call internal\clone.bat - cd .. -) ELSE ( - call internal\clean.bat -) -IF ERRORLEVEL 1 goto :eof - -call internal\check_deps.bat -IF ERRORLEVEL 1 goto :eof - -REM Check for optional components - -set USE_CUDA= -set CMAKE_GENERATOR=Visual Studio 15 2017 Win64 - -IF "%NVTOOLSEXT_PATH%"=="" ( - IF EXIST "C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64\nvToolsExt64_1.lib" ( - set NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt - ) ELSE ( - echo NVTX ^(Visual Studio Extension ^for CUDA^) ^not installed, failing - exit /b 1 - ) -) - -IF "%CUDA_PATH_V124%"=="" ( - IF EXIST "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\nvcc.exe" ( - set "CUDA_PATH_V124=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" - ) ELSE ( - echo CUDA 12.4 not found, failing - exit /b 1 - ) -) - -IF "%BUILD_VISION%" == "" ( - set TORCH_CUDA_ARCH_LIST=5.0;6.0;6.1;7.0;7.5;8.0;8.6;9.0 - set TORCH_NVCC_FLAGS=-Xfatbin -compress-all -) ELSE ( - set NVCC_FLAGS=-D__CUDA_NO_HALF_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=compute_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_90,code=compute_90 -) - -set "CUDA_PATH=%CUDA_PATH_V124%" -set "PATH=%CUDA_PATH_V124%\bin;%PATH%" - -:optcheck - -call internal\check_opts.bat -IF ERRORLEVEL 1 goto :eof - -call internal\copy.bat -IF ERRORLEVEL 1 goto :eof - -call internal\setup.bat -IF ERRORLEVEL 1 goto :eof diff --git a/windows/cuda126.bat b/windows/cuda126.bat deleted file mode 100644 index b1839e310..000000000 --- a/windows/cuda126.bat +++ /dev/null @@ -1,58 +0,0 @@ -@echo off - -set MODULE_NAME=pytorch - -IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" ( - call internal\clone.bat - cd .. -) ELSE ( - call internal\clean.bat -) -IF ERRORLEVEL 1 goto :eof - -call internal\check_deps.bat -IF ERRORLEVEL 1 goto :eof - -REM Check for optional components - -set USE_CUDA= -set CMAKE_GENERATOR=Visual Studio 15 2017 Win64 - -IF "%NVTOOLSEXT_PATH%"=="" ( - IF EXIST "C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64\nvToolsExt64_1.lib" ( - set NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt - ) ELSE ( - echo NVTX ^(Visual Studio Extension ^for CUDA^) ^not installed, failing - exit /b 1 - ) -) - -IF "%CUDA_PATH_V126%"=="" ( - IF EXIST "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\bin\nvcc.exe" ( - set "CUDA_PATH_V126=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6" - ) ELSE ( - echo CUDA 12.6 not found, failing - exit /b 1 - ) -) - -IF "%BUILD_VISION%" == "" ( - set TORCH_CUDA_ARCH_LIST=5.0;6.0;6.1;7.0;7.5;8.0;8.6;9.0 - set TORCH_NVCC_FLAGS=-Xfatbin -compress-all -) ELSE ( - set NVCC_FLAGS=-D__CUDA_NO_HALF_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=compute_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_90,code=compute_90 -) - -set "CUDA_PATH=%CUDA_PATH_V126%" -set "PATH=%CUDA_PATH_V126%\bin;%PATH%" - -:optcheck - -call internal\check_opts.bat -IF ERRORLEVEL 1 goto :eof - -call internal\copy.bat -IF ERRORLEVEL 1 goto :eof - -call internal\setup.bat -IF ERRORLEVEL 1 goto :eof diff --git a/windows/internal/7z_install.bat b/windows/internal/7z_install.bat deleted file mode 100644 index d5a115636..000000000 --- a/windows/internal/7z_install.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off - -curl -k https://www.7-zip.org/a/7z1805-x64.exe -O -if errorlevel 1 exit /b 1 - -start /wait 7z1805-x64.exe /S -if errorlevel 1 exit /b 1 - -set "PATH=%ProgramFiles%\7-Zip;%PATH%" diff --git a/windows/internal/build_wheels.bat b/windows/internal/build_wheels.bat deleted file mode 100644 index c06c6f711..000000000 --- a/windows/internal/build_wheels.bat +++ /dev/null @@ -1,11 +0,0 @@ -call windows/internal/vc_install_helper.bat -if errorlevel 1 exit /b 1 - -call windows/internal/cuda_install.bat -if errorlevel 1 exit /b 1 - -call windows/internal/xpu_install.bat -if errorlevel 1 exit /b 1 - -call windows/build_pytorch.bat %CUDA_VERSION% %PYTORCH_BUILD_VERSION% %PYTORCH_BUILD_NUMBER% -if errorlevel 1 exit /b 1 diff --git a/windows/internal/check_deps.bat b/windows/internal/check_deps.bat deleted file mode 100755 index 72e2bd6e7..000000000 --- a/windows/internal/check_deps.bat +++ /dev/null @@ -1,79 +0,0 @@ -@echo off - -REM Check for necessary components - -IF NOT "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( - echo You should use 64 bits Windows to build and run PyTorch - exit /b 1 -) - -IF "%BUILD_VISION%" == "" ( - where /q cmake.exe - - IF ERRORLEVEL 1 ( - echo CMake is required to compile PyTorch on Windows - exit /b 1 - ) -) - -if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( - echo Visual Studio %VC_YEAR% C++ BuildTools is required to compile PyTorch on Windows - exit /b 1 -) - -set VC_VERSION_LOWER=17 -set VC_VERSION_UPPER=18 -if "%VC_YEAR%" == "2019" ( - set VC_VERSION_LOWER=16 - set VC_VERSION_UPPER=17 -) - -if NOT "%VS15INSTALLDIR%" == "" if exist "%VS15INSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" ( - set "VS15VCVARSALL=%VS15INSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" - goto vswhere -) - -for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do ( - if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" ( - set "VS15INSTALLDIR=%%i" - set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat" - goto vswhere - ) -) - -:vswhere -IF "%VS15VCVARSALL%"=="" ( - echo Visual Studio %VC_YEAR% C++ BuildTools is required to compile PyTorch on Windows - exit /b 1 -) - -set MSSdk=1 -set DISTUTILS_USE_SDK=1 - -where /q python.exe - -IF ERRORLEVEL 1 ( - echo Python x64 3.5 or up is required to compile PyTorch on Windows - exit /b 1 -) - -for /F "usebackq delims=" %%i in (`python -c "import sys; print('{0[0]}{0[1]}'.format(sys.version_info))"`) do ( - set /a PYVER=%%i -) - -if %PYVER% LSS 35 ( - echo Warning: PyTorch for Python 2 under Windows is experimental. - echo Python x64 3.5 or up is recommended to compile PyTorch on Windows - echo Maybe you can create a virual environment if you have conda installed: - echo ^> conda create -n test python=3.6 pyyaml numpy - echo ^> activate test -) - -for /F "usebackq delims=" %%i in (`python -c "import struct;print( 8 * struct.calcsize('P'))"`) do ( - set /a PYSIZE=%%i -) - -if %PYSIZE% NEQ 64 ( - echo Python x64 3.5 or up is required to compile PyTorch on Windows - exit /b 1 -) diff --git a/windows/internal/check_opts.bat b/windows/internal/check_opts.bat deleted file mode 100755 index 6dd7395f9..000000000 --- a/windows/internal/check_opts.bat +++ /dev/null @@ -1,47 +0,0 @@ -@echo off - -REM Check for optional components - -where /q ninja.exe - -IF NOT ERRORLEVEL 1 ( - echo Ninja found, using it to speed up builds - set CMAKE_GENERATOR=Ninja -) - -IF "%USE_SCCACHE%" == "0" goto sccache_end - -where /q clcache.exe - -IF NOT ERRORLEVEL 1 ( - echo clcache found, using it to speed up builds - set CC=clcache - set CXX=clcache -) - -where /q sccache-cl.exe - -IF NOT ERRORLEVEL 1 ( - echo sccache-cl found, using it to speed up builds - set CC=sccache-cl - set CXX=sccache-cl -) - -IF "%CC%" == "sccache-cl" IF "%CXX%" == "sccache-cl" goto sccache_end - -where /q sccache.exe - -IF NOT ERRORLEVEL 1 ( - echo sccache found, using it to speed up builds - set CC=sccache cl - set CXX=sccache cl -) - -:sccache_end - -IF exist "%MKLProductDir%\mkl\lib\intel64_win" ( - echo MKL found, adding it to build - set "LIB=%MKLProductDir%\mkl\lib\intel64_win;%MKLProductDir%\compiler\lib\intel64_win;%LIB%"; -) - -exit /b 0 diff --git a/windows/internal/clean.bat b/windows/internal/clean.bat deleted file mode 100755 index 7489640f4..000000000 --- a/windows/internal/clean.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off - -cd %MODULE_NAME% -python setup.py clean -cd .. diff --git a/windows/internal/clone.bat b/windows/internal/clone.bat deleted file mode 100755 index 7841818d4..000000000 --- a/windows/internal/clone.bat +++ /dev/null @@ -1,63 +0,0 @@ -@echo off - -:: The conda and wheels jobs are separated on Windows, so we don't need to clone again. -if not exist "%NIGHTLIES_PYTORCH_ROOT%" goto clone_pytorch -:: XPU windows build can't work with long src path, use NIGHTLIES_PYTORCH_ROOT directly. -:: Refer https://github.com/pytorch/pytorch/issues/134956 -if "%CUDA_VERSION%" == "xpu" ( - cd "%NIGHTLIES_PYTORCH_ROOT%" - goto submodule -) -:: Attempt to fix infinite copy of ittapi recursive symlinks on non-ephemeral runners -if exist pytorch rmdir /s /q pytorch -:: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy -:: Without symlink handling, robocopy could get into an infinite loop with ittapi. With /sl, -:: symlink is ignored so functorch/docs/source/notebooks won't work. The correct option is -:: /xj to exclude junction point (what the heck does that even mean Microsoft?) -robocopy "%NIGHTLIES_PYTORCH_ROOT%" pytorch\ /e /np /nfl /xjd -cd pytorch -goto submodule - -:clone_pytorch - -git clone https://github.com/%PYTORCH_REPO%/%MODULE_NAME% - -cd %MODULE_NAME% - -IF NOT "%PYTORCH_BRANCH%" == "latest" goto latest_end - -:latest_start - -if NOT "%NIGHTLIES_DATE%" == "" goto date_end - -:date_start - -set "DATE_CMD=Get-Date ([System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), [System.TimeZoneInfo]::FindSystemTimeZoneById('Pacific Standard Time'))) -f 'yyyy_MM_dd'" -set "DATE_COMPACT_CMD=Get-Date ([System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), [System.TimeZoneInfo]::FindSystemTimeZoneById('Pacific Standard Time'))) -f 'yyyyMMdd'" - -FOR /F "delims=" %%i IN ('powershell -c "%DATE_CMD%"') DO set NIGHTLIES_DATE=%%i -FOR /F "delims=" %%i IN ('powershell -c "%DATE_COMPACT_CMD%"') DO set NIGHTLIES_DATE_COMPACT=%%i - -:date_end - -if "%NIGHTLIES_DATE_COMPACT%" == "" set NIGHTLIES_DATE_COMPACT=%NIGHTLIES_DATE:~0,4%%NIGHTLIES_DATE:~5,2%%NIGHTLIES_DATE:~8,2% - -:: Switch to the latest commit by 11:59 yesterday -echo PYTORCH_BRANCH is set to latest so I will find the last commit -echo before 0:00 midnight on %NIGHTLIES_DATE% -set git_date=%NIGHTLIES_DATE:_=-% -FOR /F "delims=" %%i IN ('git log --before %git_date% -n 1 "--pretty=%%H"') DO set last_commit=%%i -echo Setting PYTORCH_BRANCH to %last_commit% since that was the last -echo commit before %NIGHTLIES_DATE% -set PYTORCH_BRANCH=%last_commit% - -:latest_end - -IF "%PYTORCH_BRANCH%" == "" set PYTORCH_BRANCH=v%PYTORCH_BUILD_VERSION% -git checkout %PYTORCH_BRANCH% -IF ERRORLEVEL 1 git checkout tags/%PYTORCH_BRANCH% - -:submodule - -git submodule update --init --recursive -IF ERRORLEVEL 1 exit /b 1 diff --git a/windows/internal/copy.bat b/windows/internal/copy.bat deleted file mode 100755 index b2d078944..000000000 --- a/windows/internal/copy.bat +++ /dev/null @@ -1,26 +0,0 @@ -copy "%CUDA_PATH%\bin\cusparse*64_*.dll*" pytorch\torch\lib -copy "%CUDA_PATH%\bin\cublas*64_*.dll*" pytorch\torch\lib -copy "%CUDA_PATH%\bin\cudart*64_*.dll*" pytorch\torch\lib -copy "%CUDA_PATH%\bin\curand*64_*.dll*" pytorch\torch\lib -copy "%CUDA_PATH%\bin\cufft*64_*.dll*" pytorch\torch\lib -copy "%CUDA_PATH%\bin\cusolver*64_*.dll*" pytorch\torch\lib - -copy "%CUDA_PATH%\bin\cudnn*64_*.dll*" pytorch\torch\lib -copy "%CUDA_PATH%\bin\nvrtc*64_*.dll*" pytorch\torch\lib -copy "%CUDA_PATH%\extras\CUPTI\lib64\cupti64_*.dll*" pytorch\torch\lib - -copy "C:\Program Files\NVIDIA Corporation\NvToolsExt\bin\x64\nvToolsExt64_1.dll*" pytorch\torch\lib -copy "%CONDA_LIB_PATH%\libiomp*5md.dll" pytorch\torch\lib - -:: Should be set in build_pytorch.bat -copy "%libuv_ROOT%\bin\uv.dll" pytorch\torch\lib - -::copy zlib if it exist in windows/system32 -if exist "C:\Windows\System32\zlibwapi.dll" ( - copy "C:\Windows\System32\zlibwapi.dll" pytorch\torch\lib -) - -::copy nvJitLink dll is requires for cuda 12+ -if exist "%CUDA_PATH%\bin\nvJitLink_*.dll*" ( - copy "%CUDA_PATH%\bin\nvJitLink_*.dll*" pytorch\torch\lib -) diff --git a/windows/internal/copy_cpu.bat b/windows/internal/copy_cpu.bat deleted file mode 100755 index 864180d85..000000000 --- a/windows/internal/copy_cpu.bat +++ /dev/null @@ -1,3 +0,0 @@ -copy "%CONDA_LIB_PATH%\libiomp*5md.dll" pytorch\torch\lib -:: Should be set in build_pytorch.bat -copy "%libuv_ROOT%\bin\uv.dll" pytorch\torch\lib \ No newline at end of file diff --git a/windows/internal/cuda_install.bat b/windows/internal/cuda_install.bat deleted file mode 100644 index b73240327..000000000 --- a/windows/internal/cuda_install.bat +++ /dev/null @@ -1,218 +0,0 @@ -@echo on - -if "%CUDA_VERSION%" == "cpu" ( - echo Skipping for CPU builds - exit /b 0 -) -if "%CUDA_VERSION%" == "xpu" ( - echo Skipping for XPU builds - exit /b 0 -) - -set SRC_DIR=%~dp0\.. - -if not exist "%SRC_DIR%\temp_build" mkdir "%SRC_DIR%\temp_build" - -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% -set CUDNN_FOLDER="cuda" -set CUDNN_LIB_FOLDER="lib\x64" - -:: Skip all of this if we already have cuda installed -if exist "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin\nvcc.exe" goto set_cuda_env_vars - -if %CUDA_VER% EQU 118 goto cuda118 -if %CUDA_VER% EQU 121 goto cuda121 -if %CUDA_VER% EQU 124 goto cuda124 -if %CUDA_VER% EQU 126 goto cuda126 - -echo CUDA %CUDA_VERSION_STR% is not supported -exit /b 1 - -:cuda118 - -set CUDA_INSTALL_EXE=cuda_11.8.0_522.06_windows.exe -if not exist "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" ( - curl -k -L "https://ossci-windows.s3.amazonaws.com/%CUDA_INSTALL_EXE%" --output "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" - if errorlevel 1 exit /b 1 - set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" - set "ARGS=cuda_profiler_api_11.8 thrust_11.8 nvcc_11.8 cuobjdump_11.8 nvprune_11.8 nvprof_11.8 cupti_11.8 cublas_11.8 cublas_dev_11.8 cudart_11.8 cufft_11.8 cufft_dev_11.8 curand_11.8 curand_dev_11.8 cusolver_11.8 cusolver_dev_11.8 cusparse_11.8 cusparse_dev_11.8 npp_11.8 npp_dev_11.8 nvrtc_11.8 nvrtc_dev_11.8 nvml_dev_11.8 nvtx_11.8" -) - -set CUDNN_FOLDER=cudnn-windows-x86_64-9.5.0.50_cuda11-archive -set CUDNN_LIB_FOLDER="lib" -set "CUDNN_INSTALL_ZIP=%CUDNN_FOLDER%.zip" -if not exist "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" ( - curl -k -L "http://s3.amazonaws.com/ossci-windows/%CUDNN_INSTALL_ZIP%" --output "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" - if errorlevel 1 exit /b 1 - set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" -) - -@REM cuDNN 8.3+ required zlib to be installed on the path -echo Installing ZLIB dlls -curl -k -L "http://s3.amazonaws.com/ossci-windows/zlib123dllx64.zip" --output "%SRC_DIR%\temp_build\zlib123dllx64.zip" -7z x "%SRC_DIR%\temp_build\zlib123dllx64.zip" -o"%SRC_DIR%\temp_build\zlib" -xcopy /Y "%SRC_DIR%\temp_build\zlib\dll_x64\*.dll" "C:\Windows\System32" - -goto cuda_common - -:cuda121 - -set CUDA_INSTALL_EXE=cuda_12.1.1_531.14_windows.exe -if not exist "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" ( - curl -k -L "https://ossci-windows.s3.amazonaws.com/%CUDA_INSTALL_EXE%" --output "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" - if errorlevel 1 exit /b 1 - set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" - set "ARGS=cuda_profiler_api_12.1 thrust_12.1 nvcc_12.1 cuobjdump_12.1 nvprune_12.1 nvprof_12.1 cupti_12.1 cublas_12.1 cublas_dev_12.1 cudart_12.1 cufft_12.1 cufft_dev_12.1 curand_12.1 curand_dev_12.1 cusolver_12.1 cusolver_dev_12.1 cusparse_12.1 cusparse_dev_12.1 npp_12.1 npp_dev_12.1 nvrtc_12.1 nvrtc_dev_12.1 nvml_dev_12.1 nvjitlink_12.1 nvtx_12.1" -) - -set CUDNN_FOLDER=cudnn-windows-x86_64-9.5.0.50_cuda12-archive -set CUDNN_LIB_FOLDER="lib" -set "CUDNN_INSTALL_ZIP=%CUDNN_FOLDER%.zip" -if not exist "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" ( - curl -k -L "http://s3.amazonaws.com/ossci-windows/%CUDNN_INSTALL_ZIP%" --output "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" - if errorlevel 1 exit /b 1 - set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" -) - -@REM cuDNN 8.3+ required zlib to be installed on the path -echo Installing ZLIB dlls -curl -k -L "http://s3.amazonaws.com/ossci-windows/zlib123dllx64.zip" --output "%SRC_DIR%\temp_build\zlib123dllx64.zip" -7z x "%SRC_DIR%\temp_build\zlib123dllx64.zip" -o"%SRC_DIR%\temp_build\zlib" -xcopy /Y "%SRC_DIR%\temp_build\zlib\dll_x64\*.dll" "C:\Windows\System32" - -goto cuda_common - -:cuda124 - -set CUDA_INSTALL_EXE=cuda_12.4.0_551.61_windows.exe -if not exist "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" ( - curl -k -L "https://ossci-windows.s3.amazonaws.com/%CUDA_INSTALL_EXE%" --output "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" - if errorlevel 1 exit /b 1 - set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" - set "ARGS=cuda_profiler_api_12.4 thrust_12.4 nvcc_12.4 cuobjdump_12.4 nvprune_12.4 nvprof_12.4 cupti_12.4 cublas_12.4 cublas_dev_12.4 cudart_12.4 cufft_12.4 cufft_dev_12.4 curand_12.4 curand_dev_12.4 cusolver_12.4 cusolver_dev_12.4 cusparse_12.4 cusparse_dev_12.4 npp_12.4 npp_dev_12.4 nvrtc_12.4 nvrtc_dev_12.4 nvml_dev_12.4 nvjitlink_12.4 nvtx_12.4" -) - -set CUDNN_FOLDER=cudnn-windows-x86_64-9.5.0.50_cuda12-archive -set CUDNN_LIB_FOLDER="lib" -set "CUDNN_INSTALL_ZIP=%CUDNN_FOLDER%.zip" -if not exist "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" ( - curl -k -L "http://s3.amazonaws.com/ossci-windows/%CUDNN_INSTALL_ZIP%" --output "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" - if errorlevel 1 exit /b 1 - set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" -) - -@REM cuDNN 8.3+ required zlib to be installed on the path -echo Installing ZLIB dlls -curl -k -L "http://s3.amazonaws.com/ossci-windows/zlib123dllx64.zip" --output "%SRC_DIR%\temp_build\zlib123dllx64.zip" -7z x "%SRC_DIR%\temp_build\zlib123dllx64.zip" -o"%SRC_DIR%\temp_build\zlib" -xcopy /Y "%SRC_DIR%\temp_build\zlib\dll_x64\*.dll" "C:\Windows\System32" - -goto cuda_common - -:cuda126 - -set CUDA_INSTALL_EXE=cuda_12.6.2_560.94_windows.exe -if not exist "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" ( - curl -k -L "https://ossci-windows.s3.amazonaws.com/%CUDA_INSTALL_EXE%" --output "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" - if errorlevel 1 exit /b 1 - set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" - set "ARGS=cuda_profiler_api_12.6 thrust_12.6 nvcc_12.6 cuobjdump_12.6 nvprune_12.6 nvprof_12.6 cupti_12.6 cublas_12.6 cublas_dev_12.6 cudart_12.6 cufft_12.6 cufft_dev_12.6 curand_12.6 curand_dev_12.6 cusolver_12.6 cusolver_dev_12.6 cusparse_12.6 cusparse_dev_12.6 npp_12.6 npp_dev_12.6 nvrtc_12.6 nvrtc_dev_12.6 nvml_dev_12.6 nvjitlink_12.6 nvtx_12.6" -) - -set CUDNN_FOLDER=cudnn-windows-x86_64-9.5.0.50_cuda12-archive -set CUDNN_LIB_FOLDER="lib" -set "CUDNN_INSTALL_ZIP=%CUDNN_FOLDER%.zip" -if not exist "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" ( - curl -k -L "http://s3.amazonaws.com/ossci-windows/%CUDNN_INSTALL_ZIP%" --output "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" - if errorlevel 1 exit /b 1 - set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" -) - -@REM cuDNN 8.3+ required zlib to be installed on the path -echo Installing ZLIB dlls -curl -k -L "http://s3.amazonaws.com/ossci-windows/zlib123dllx64.zip" --output "%SRC_DIR%\temp_build\zlib123dllx64.zip" -7z x "%SRC_DIR%\temp_build\zlib123dllx64.zip" -o"%SRC_DIR%\temp_build\zlib" -xcopy /Y "%SRC_DIR%\temp_build\zlib\dll_x64\*.dll" "C:\Windows\System32" - -goto cuda_common - -:cuda_common -:: NOTE: We only install CUDA if we don't have it installed already. -:: With GHA runners these should be pre-installed as part of our AMI process -:: If you cannot find the CUDA version you want to build for here then please -:: add it @ https://github.com/pytorch/test-infra/tree/main/aws/ami/windows -if not exist "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin\nvcc.exe" ( - if not exist "%SRC_DIR%\temp_build\NvToolsExt.7z" ( - curl -k -L https://ossci-windows.s3.us-east-1.amazonaws.com/builder/NvToolsExt.7z --output "%SRC_DIR%\temp_build\NvToolsExt.7z" - if errorlevel 1 exit /b 1 - ) - - if not exist "%SRC_DIR%\temp_build\gpu_driver_dlls.zip" ( - curl -k -L "https://ossci-windows.s3.us-east-1.amazonaws.com/builder/additional_dlls.zip" --output "%SRC_DIR%\temp_build\gpu_driver_dlls.zip" - if errorlevel 1 exit /b 1 - ) - - echo Installing CUDA toolkit... - 7z x %CUDA_SETUP_FILE% -o"%SRC_DIR%\temp_build\cuda" - pushd "%SRC_DIR%\temp_build\cuda" - - sc config wuauserv start= disabled - sc stop wuauserv - sc query wuauserv - - start /wait setup.exe -s %ARGS% -loglevel:6 -log:"%cd%/cuda_install_logs" - echo %errorlevel% - - popd - - echo Installing VS integration... - if "%VC_YEAR%" == "2019" ( - xcopy /Y "%SRC_DIR%\temp_build\cuda\CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions\*.*" "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\BuildCustomizations" - ) - if "%VC_YEAR%" == "2022" ( - xcopy /Y "%SRC_DIR%\temp_build\cuda\CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions\*.*" "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\BuildCustomizations" - ) - - echo Installing NvToolsExt... - 7z x %SRC_DIR%\temp_build\NvToolsExt.7z -o"%SRC_DIR%\temp_build\NvToolsExt" - mkdir "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\bin\x64" - mkdir "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\include" - mkdir "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\lib\x64" - xcopy /Y "%SRC_DIR%\temp_build\NvToolsExt\bin\x64\*.*" "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\bin\x64" - xcopy /Y "%SRC_DIR%\temp_build\NvToolsExt\include\*.*" "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\include" - xcopy /Y "%SRC_DIR%\temp_build\NvToolsExt\lib\x64\*.*" "%ProgramFiles%\NVIDIA Corporation\NvToolsExt\lib\x64" - - echo Installing cuDNN... - 7z x %CUDNN_SETUP_FILE% -o"%SRC_DIR%\temp_build\cudnn" - xcopy /Y "%SRC_DIR%\temp_build\cudnn\%CUDNN_FOLDER%\bin\*.*" "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin" - xcopy /Y "%SRC_DIR%\temp_build\cudnn\%CUDNN_FOLDER%\%CUDNN_LIB_FOLDER%\*.*" "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\lib\x64" - xcopy /Y "%SRC_DIR%\temp_build\cudnn\%CUDNN_FOLDER%\include\*.*" "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\include" - - echo Installing GPU driver DLLs - 7z x %SRC_DIR%\temp_build\gpu_driver_dlls.zip -o"C:\Windows\System32" - - echo Cleaning temp files - rd /s /q "%SRC_DIR%\temp_build" || ver > nul - - if not exist "%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin\nvcc.exe" ( - echo CUDA %CUDA_VERSION_STR% installed failed. - echo --------- setup.exe.log ------- - type "%SRC_DIR%\temp_build\cuda\cuda_install_logs\LOG.setup.exe.log" - echo --------- RunDll32.exe.log - type "%SRC_DIR%\temp_build\cuda\cuda_install_logs\LOG.RunDll32.exe.log" - exit /b 1 - ) -) - -goto set_cuda_env_vars - -:set_cuda_env_vars - -echo Setting up environment... -set "PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin;%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\libnvvp;%PATH%" -set "CUDA_PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%" -set "CUDA_PATH_V%CUDA_VER_MAJOR%_%CUDA_VER_MINOR%=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%" -set "NVTOOLSEXT_PATH=%ProgramFiles%\NVIDIA Corporation\NvToolsExt" diff --git a/windows/internal/driver_update.bat b/windows/internal/driver_update.bat deleted file mode 100644 index 551aa9c7a..000000000 --- a/windows/internal/driver_update.bat +++ /dev/null @@ -1,9 +0,0 @@ -set WIN_DRIVER_VN=528.89 -set "DRIVER_DOWNLOAD_LINK=https://ossci-windows.s3.amazonaws.com/%WIN_DRIVER_VN%-data-center-tesla-desktop-winserver-2016-2019-2022-dch-international.exe" -curl --retry 3 -kL %DRIVER_DOWNLOAD_LINK% --output %WIN_DRIVER_VN%-data-center-tesla-desktop-winserver-2016-2019-2022-dch-international.exe -if errorlevel 1 exit /b 1 - -start /wait %WIN_DRIVER_VN%-data-center-tesla-desktop-winserver-2016-2019-2022-dch-international.exe -s -noreboot -if errorlevel 1 exit /b 1 - -del %WIN_DRIVER_VN%-data-center-tesla-desktop-winserver-2016-2019-2022-dch-international.exe || ver > NUL diff --git a/windows/internal/env_fix.bat b/windows/internal/env_fix.bat deleted file mode 100644 index 2a53198a9..000000000 --- a/windows/internal/env_fix.bat +++ /dev/null @@ -1,38 +0,0 @@ -@echo off - -:: Caution: Please don't use this script locally -:: It may destroy your build environment. - -setlocal - -if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( - echo Visual Studio %VC_YEAR% C++ BuildTools is required to compile PyTorch on Windows - exit /b 1 -) - -set VC_VERSION_LOWER=17 -set VC_VERSION_UPPER=18 -if "%VC_YEAR%" == "2019" ( - set VC_VERSION_LOWER=16 - set VC_VERSION_UPPER=17 -) - -for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do ( - if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" ( - set "VS15INSTALLDIR=%%i" - set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat" - goto vswhere - ) -) - -:vswhere - -if "%VS15VCVARSALL%"=="" ( - echo Visual Studio %VC_YEAR% C++ BuildTools is required to compile PyTorch on Windows - exit /b 1 -) - -call "%VS15VCVARSALL%" x86_amd64 -for /f "usebackq tokens=*" %%i in (`where link.exe`) do move "%%i" "%%i.bak" - -endlocal diff --git a/windows/internal/setup.bat b/windows/internal/setup.bat deleted file mode 100755 index 53b72ff11..000000000 --- a/windows/internal/setup.bat +++ /dev/null @@ -1,107 +0,0 @@ -@echo off - -echo The flags after configuring: -echo USE_CUDA=%USE_CUDA% -echo CMAKE_GENERATOR=%CMAKE_GENERATOR% -if "%USE_CUDA%"=="" echo CUDA_PATH=%CUDA_PATH% -if NOT "%CC%"=="" echo CC=%CC% -if NOT "%CXX%"=="" echo CXX=%CXX% -if NOT "%DISTUTILS_USE_SDK%"=="" echo DISTUTILS_USE_SDK=%DISTUTILS_USE_SDK% - -set SRC_DIR=%~dp0\.. -if exist "%NIGHTLIES_PYTORCH_ROOT%" if "%CUDA_VERSION%" == "xpu" set SRC_DIR=%NIGHTLIES_PYTORCH_ROOT% - -IF "%VSDEVCMD_ARGS%" == "" ( - call "%VS15VCVARSALL%" x64 -) ELSE ( - call "%VS15VCVARSALL%" x64 %VSDEVCMD_ARGS% -) - -pushd %SRC_DIR% - -IF NOT exist "setup.py" ( - cd %MODULE_NAME% -) - -if "%CXX%"=="sccache cl" goto sccache_start -if "%CXX%"=="sccache-cl" goto sccache_start -goto sccache_end - -:sccache_start -set SCCACHE_IDLE_TIMEOUT=0 - -sccache --stop-server -sccache --start-server -sccache --zero-stats - -:sccache_end - - -if "%BUILD_PYTHONLESS%" == "" goto pytorch else goto libtorch - -:libtorch -set VARIANT=shared-with-deps - -mkdir libtorch -mkdir libtorch\bin -mkdir libtorch\cmake -mkdir libtorch\include -mkdir libtorch\lib -mkdir libtorch\share -mkdir libtorch\test - -mkdir build -pushd build -python ../tools/build_libtorch.py -popd - -IF ERRORLEVEL 1 exit /b 1 -IF NOT ERRORLEVEL 0 exit /b 1 - -move /Y torch\bin\*.* libtorch\bin\ -move /Y torch\cmake\*.* libtorch\cmake\ -robocopy /move /e torch\include\ libtorch\include\ -move /Y torch\lib\*.* libtorch\lib\ -robocopy /move /e torch\share\ libtorch\share\ -move /Y torch\test\*.* libtorch\test\ - -move /Y libtorch\bin\*.dll libtorch\lib\ - -echo %PYTORCH_BUILD_VERSION% > libtorch\build-version -git rev-parse HEAD > libtorch\build-hash - -IF "%DEBUG%" == "" ( - set LIBTORCH_PREFIX=libtorch-win-%VARIANT% -) ELSE ( - set LIBTORCH_PREFIX=libtorch-win-%VARIANT%-debug -) - -7z a -tzip "%LIBTORCH_PREFIX%-%PYTORCH_BUILD_VERSION%.zip" libtorch\* -:: Cleanup raw data to save space -rmdir /s /q libtorch - -if not exist ..\output mkdir ..\output -copy /Y "%LIBTORCH_PREFIX%-%PYTORCH_BUILD_VERSION%.zip" "%PYTORCH_FINAL_PACKAGE_DIR%\" -copy /Y "%LIBTORCH_PREFIX%-%PYTORCH_BUILD_VERSION%.zip" "%PYTORCH_FINAL_PACKAGE_DIR%\%LIBTORCH_PREFIX%-latest.zip" - -goto build_end - -:pytorch -python setup.py bdist_wheel -d "%PYTORCH_FINAL_PACKAGE_DIR%" - -:build_end -IF ERRORLEVEL 1 exit /b 1 -IF NOT ERRORLEVEL 0 exit /b 1 - -if "%CXX%"=="sccache cl" goto sccache_cleanup -if "%CXX%"=="sccache-cl" goto sccache_cleanup -goto sccache_cleanup_end - -:sccache_cleanup -sccache --show-stats -taskkill /im sccache.exe /f /t || ver > nul -taskkill /im nvcc.exe /f /t || ver > nul - -:sccache_cleanup_end - -cd .. diff --git a/windows/internal/smoke_test.bat b/windows/internal/smoke_test.bat deleted file mode 100644 index 0c5650f1e..000000000 --- a/windows/internal/smoke_test.bat +++ /dev/null @@ -1,241 +0,0 @@ -set SRC_DIR=%~dp0 - -pushd %SRC_DIR%\.. - -if not "%CUDA_VERSION%" == "cpu" if not "%CUDA_VERSION%" == "xpu" call internal\driver_update.bat -if errorlevel 1 exit /b 1 - -if "%CUDA_VERSION%" == "xpu" ( - call internal\xpu_install.bat - if errorlevel 1 exit /b 1 - call "%ProgramFiles(x86)%\Intel\oneAPI\setvars.bat" - if errorlevel 1 exit /b 1 -) - -set "ORIG_PATH=%PATH%" - -setlocal EnableDelayedExpansion -set NVIDIA_GPU_EXISTS=0 -for /F "delims=" %%i in ('wmic path win32_VideoController get name') do ( - set GPUS=%%i - if not "x!GPUS:NVIDIA=!" == "x!GPUS!" ( - SET NVIDIA_GPU_EXISTS=1 - goto gpu_check_end - ) -) -:gpu_check_end -endlocal & set NVIDIA_GPU_EXISTS=%NVIDIA_GPU_EXISTS% - -if "%PACKAGE_TYPE%" == "wheel" goto wheel -if "%PACKAGE_TYPE%" == "conda" goto conda -if "%PACKAGE_TYPE%" == "libtorch" goto libtorch - -echo "unknown package type" -exit /b 1 - -:wheel -echo "install wheel package" - -set PYTHON_INSTALLER_URL= -if "%DESIRED_PYTHON%" == "3.13" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe" -if "%DESIRED_PYTHON%" == "3.12" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.12.0/python-3.12.0-amd64.exe" -if "%DESIRED_PYTHON%" == "3.11" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.11.0/python-3.11.0-amd64.exe" -if "%DESIRED_PYTHON%" == "3.10" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe" -if "%DESIRED_PYTHON%" == "3.9" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.9.0/python-3.9.0-amd64.exe" -if "%DESIRED_PYTHON%" == "3.8" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.8.2/python-3.8.2-amd64.exe" -if "%PYTHON_INSTALLER_URL%" == "" ( - echo Python %DESIRED_PYTHON% not supported yet -) - -del python-amd64.exe -curl --retry 3 -kL "%PYTHON_INSTALLER_URL%" --output python-amd64.exe -if errorlevel 1 exit /b 1 - -:: According to https://docs.python.org/3/using/windows.html, setting PrependPath to 1 will prepend -:: the installed Python to PATH system-wide. Even calling set PATH=%ORIG_PATH% later on won't make -:: a change. As the builder directory will be removed after the smoke test, all subsequent non-binary -:: jobs will fail to find any Python executable there -start /wait "" python-amd64.exe /quiet InstallAllUsers=1 PrependPath=0 Include_test=0 TargetDir=%CD%\Python -if errorlevel 1 exit /b 1 - -set "PATH=%CD%\Python%PYTHON_VERSION%\Scripts;%CD%\Python;%PATH%" - -if "%DESIRED_PYTHON%" == "3.13" pip install -q --pre numpy==2.1.0 protobuf -if "%DESIRED_PYTHON%" == "3.12" pip install -q --pre numpy==2.0.2 protobuf -if "%DESIRED_PYTHON%" == "3.11" pip install -q --pre numpy==2.0.2 protobuf -if "%DESIRED_PYTHON%" == "3.10" pip install -q --pre numpy==2.0.2 protobuf -if "%DESIRED_PYTHON%" == "3.9" pip install -q --pre numpy==2.0.2 protobuf -if "%DESIRED_PYTHON%" == "3.8" pip install -q numpy protobuf - -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 - -goto smoke_test - -:conda -echo "install conda package" - -:: Install Miniconda3 -set "CONDA_HOME=%CD%\conda" -set "tmp_conda=%CONDA_HOME%" -set "miniconda_exe=%CD%\miniconda.exe" -set "CONDA_EXTRA_ARGS=cpuonly -c pytorch-nightly" -if "%CUDA_VERSION%" == "118" ( - set "CONDA_EXTRA_ARGS=pytorch-cuda=11.8 -c nvidia -c pytorch-nightly" -) -if "%CUDA_VERSION%" == "121" ( - set "CONDA_EXTRA_ARGS=pytorch-cuda=12.1 -c nvidia -c pytorch-nightly" -) -if "%CUDA_VERSION%" == "124" ( - set "CONDA_EXTRA_ARGS=pytorch-cuda=12.4 -c nvidia -c pytorch-nightly" -) -if "%CUDA_VERSION%" == "126" ( - set "CONDA_EXTRA_ARGS=pytorch-cuda=12.6 -c nvidia -c pytorch-nightly" -) - -rmdir /s /q conda -del miniconda.exe -curl -k https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o "%miniconda_exe%" -call ..\conda\install_conda.bat -if ERRORLEVEL 1 exit /b 1 - -set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%" - -conda create -qyn testenv python=%DESIRED_PYTHON% -if errorlevel 1 exit /b 1 -call conda install -yq conda-build -if errorlevel 1 exit /b 1 -call %CONDA_HOME%\condabin\activate.bat testenv -if errorlevel 1 exit /b 1 -set "NO_ARCH_PATH=%PYTORCH_FINAL_PACKAGE_DIR:/=\%\noarch" -mkdir %NO_ARCH_PATH% -for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *') do xcopy "%%i" %NO_ARCH_PATH% /Y -if ERRORLEVEL 1 exit /b 1 -call conda index %PYTORCH_FINAL_PACKAGE_DIR% -if errorlevel 1 exit /b 1 -call conda install -yq -c "file:///%PYTORCH_FINAL_PACKAGE_DIR%" pytorch==%PYTORCH_BUILD_VERSION% -c pytorch -c numba/label/dev -c nvidia -if ERRORLEVEL 1 exit /b 1 -call conda install -yq numpy -if ERRORLEVEL 1 exit /b 1 - -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% - -:: Install package we just build - - -:smoke_test -python -c "import torch" -if ERRORLEVEL 1 exit /b 1 - -echo Checking that MKL is available -python -c "import torch; exit(0 if torch.backends.mkl.is_available() else 1)" -if ERRORLEVEL 1 exit /b 1 - -if "%NVIDIA_GPU_EXISTS%" == "0" ( - echo "Skip CUDA tests for machines without a Nvidia GPU card" - goto end -) - -echo Checking that CUDA archs are setup correctly -python -c "import torch; torch.randn([3,5]).cuda()" -if ERRORLEVEL 1 exit /b 1 - -echo Checking that magma is available -python -c "import torch; torch.rand(1).cuda(); exit(0 if torch.cuda.has_magma else 1)" -if ERRORLEVEL 1 exit /b 1 - -echo Checking that CuDNN is available -python -c "import torch; exit(0 if torch.backends.cudnn.is_available() else 1)" -if ERRORLEVEL 1 exit /b 1 - -echo Checking that basic RNN works -python %BUILDER_ROOT%\test_example_code\rnn_smoke.py -if ERRORLEVEL 1 exit /b 1 - -echo Checking that basic CNN works -python %BUILDER_ROOT%\test_example_code\cnn_smoke.py -if ERRORLEVEL 1 exit /b 1 - -goto end - -:libtorch -echo "install and test libtorch" - -if "%VC_YEAR%" == "2019" powershell internal\vs2019_install.ps1 -if "%VC_YEAR%" == "2022" powershell internal\vs2022_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 - -pushd tmp\libtorch - -set VC_VERSION_LOWER=17 -set VC_VERSION_UPPER=18 -IF "%VC_YEAR%" == "2019" ( - set VC_VERSION_LOWER=16 - set VC_VERSION_UPPER=17 -) - -for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do ( - if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" ( - set "VS15INSTALLDIR=%%i" - set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat" - goto vswhere - ) -) - -:vswhere -IF "%VS15VCVARSALL%"=="" ( - echo Visual Studio %VC_YEAR% C++ BuildTools is required to compile PyTorch test on Windows - exit /b 1 -) -call "%VS15VCVARSALL%" x64 - -set install_root=%CD% -set INCLUDE=%INCLUDE%;%install_root%\include;%install_root%\include\torch\csrc\api\include -set LIB=%LIB%;%install_root%\lib -set PATH=%PATH%;%install_root%\lib - -cl %BUILDER_ROOT%\test_example_code\simple-torch-test.cpp c10.lib torch_cpu.lib /EHsc /std:c++17 -if ERRORLEVEL 1 exit /b 1 - -.\simple-torch-test.exe -if ERRORLEVEL 1 exit /b 1 - -cl %BUILDER_ROOT%\test_example_code\check-torch-mkl.cpp c10.lib torch_cpu.lib /EHsc /std:c++17 -if ERRORLEVEL 1 exit /b 1 - -.\check-torch-mkl.exe -if ERRORLEVEL 1 exit /b 1 - -if "%NVIDIA_GPU_EXISTS%" == "0" ( - echo "Skip CUDA tests for machines without a Nvidia GPU card" - goto end -) - -set BUILD_SPLIT_CUDA= -if exist "%install_root%\lib\torch_cuda_cu.lib" if exist "%install_root%\lib\torch_cuda_cpp.lib" set BUILD_SPLIT_CUDA=ON - -if "%BUILD_SPLIT_CUDA%" == "ON" ( - cl %BUILDER_ROOT%\test_example_code\check-torch-cuda.cpp torch_cpu.lib c10.lib torch_cuda_cu.lib torch_cuda_cpp.lib /EHsc /std:c++17 /link /INCLUDE:?warp_size@cuda@at@@YAHXZ /INCLUDE:?_torch_cuda_cu_linker_symbol_op_cuda@native@at@@YA?AVTensor@2@AEBV32@@Z -) else ( - cl %BUILDER_ROOT%\test_example_code\check-torch-cuda.cpp torch_cpu.lib c10.lib torch_cuda.lib /EHsc /std:c++17 /link /INCLUDE:?warp_size@cuda@at@@YAHXZ -) -.\check-torch-cuda.exe -if ERRORLEVEL 1 exit /b 1 - -popd - -echo Cleaning temp files -rd /s /q "tmp" || ver > nul - -:end -set "PATH=%ORIG_PATH%" -popd diff --git a/windows/internal/static_lib_test.bat b/windows/internal/static_lib_test.bat deleted file mode 100644 index 2335ce0b3..000000000 --- a/windows/internal/static_lib_test.bat +++ /dev/null @@ -1,132 +0,0 @@ -set SRC_DIR=%~dp0 - -pushd %SRC_DIR%\.. - -if "%CUDA_VERSION%" == "cpu" call internal\driver_update.bat -if errorlevel 1 exit /b 1 - -call internal\cuda_install.bat -set LIB=%CUDA_PATH%\lib\x64;%LIB% -if errorlevel 1 exit /b 1 -set "ORIG_PATH=%PATH%" - -setlocal EnableDelayedExpansion -set NVIDIA_GPU_EXISTS=0 -for /F "delims=" %%i in ('wmic path win32_VideoController get name') do ( - set GPUS=%%i - if not "x!GPUS:NVIDIA=!" == "x!GPUS!" ( - SET NVIDIA_GPU_EXISTS=1 - goto gpu_check_end - ) -) -:gpu_check_end -endlocal & set NVIDIA_GPU_EXISTS=%NVIDIA_GPU_EXISTS% - -:: Download MAGMA Files on CUDA builds -set MAGMA_VERSION=2.5.4 -set CUDA_PREFIX=cuda%CUDA_VERSION% -if "%CUDA_VERSION%" == "92" set MAGMA_VERSION=2.5.2 -if "%CUDA_VERSION%" == "100" set MAGMA_VERSION=2.5.2 - -if "%DEBUG%" == "1" ( - set BUILD_TYPE=debug -) else ( - set BUILD_TYPE=release -) - -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 - 7z x -aoa magma_%CUDA_PREFIX%_%BUILD_TYPE%.7z -omagma_%CUDA_PREFIX%_%BUILD_TYPE% - set LIB=%CD%\magma_%CUDA_PREFIX%_%BUILD_TYPE%\lib;%LIB% -) - -echo "install conda package" - -:: 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.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o "%miniconda_exe%" -call ..\conda\install_conda.bat -if ERRORLEVEL 1 exit /b 1 - -set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%" - -conda create -qyn testenv python=%DESIRED_PYTHON% -if errorlevel 1 exit /b 1 - -call %CONDA_HOME%\condabin\activate.bat testenv -if errorlevel 1 exit /b 1 - -call conda install -y -q -c conda-forge libuv=1.39 -call conda install -y -q intel-openmp - -echo "install and test libtorch" -pip install cmake -echo "installing cmake" - -if "%VC_YEAR%" == "2019" powershell internal\vs2019_install.ps1 -if "%VC_YEAR%" == "2022" powershell internal\vs2022_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 - - -pushd tmp\libtorch - -set VC_VERSION_LOWER=17 -set VC_VERSION_UPPER=18 -IF "%VC_YEAR%" == "2019" ( - set VC_VERSION_LOWER=16 - set VC_VERSION_UPPER=17 -) - -for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do ( - if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" ( - set "VS15INSTALLDIR=%%i" - set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat" - goto vswhere - ) -) - -:vswhere -IF "%VS15VCVARSALL%"=="" ( - echo Visual Studio %VC_YEAR% C++ BuildTools is required to compile PyTorch test on Windows - exit /b 1 -) -call "%VS15VCVARSALL%" x64 - -set install_root=%CD% -set INCLUDE=%INCLUDE%;%install_root%\include;%install_root%\include\torch\csrc\api\include -set LIB=%LIB%;%install_root%\lib\x64 -set PATH=%PATH%;%install_root%\lib - - -cd %BUILDER_ROOT%\test_example_code\ -mkdir build -cd build - -cmake -DCMAKE_PREFIX_PATH=%install_root% .. - -if ERRORLEVEL 1 exit /b 1 - -cmake --build . --config Release - -.\Release\simple-torch-test.exe -if ERRORLEVEL 1 exit /b 1 - -popd - -echo Cleaning temp files -rd /s /q "tmp" || ver > nul - -:end -set "PATH=%ORIG_PATH%" -popd diff --git a/windows/internal/vc_install_helper.bat b/windows/internal/vc_install_helper.bat deleted file mode 100644 index 61ab6d5f8..000000000 --- a/windows/internal/vc_install_helper.bat +++ /dev/null @@ -1,21 +0,0 @@ -if "%VC_YEAR%" == "2019" powershell windows/internal/vs2019_install.ps1 -if "%VC_YEAR%" == "2022" powershell windows/internal/vs2022_install.ps1 - -set VC_VERSION_LOWER=17 -set VC_VERSION_UPPER=18 -if "%VC_YEAR%" == "2019" ( - set VC_VERSION_LOWER=16 - set VC_VERSION_UPPER=17 -) - -for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do ( - if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" ( - set "VS15INSTALLDIR=%%i" - goto vswhere - ) -) - -:vswhere -echo "Setting VSINSTALLDIR to %VS15INSTALLDIR%" - -if errorlevel 1 exit /b 1 diff --git a/windows/internal/vs_install.bat b/windows/internal/vs_install.bat deleted file mode 100644 index 221ec3313..000000000 --- a/windows/internal/vs_install.bat +++ /dev/null @@ -1,28 +0,0 @@ -@echo off - -set VS_DOWNLOAD_LINK=https://download.visualstudio.microsoft.com/download/pr/8f480125-28b8-4a2c-847c-c2b02a8cdd1b/64be21d4ada005d7d07896ed0b004c322409bd04d6e8eba4c03c9fa39c928e7a/vs_BuildTools.exe -IF "%VS_LATEST%" == "1" ( - set VS_INSTALL_ARGS= --nocache --norestart --quiet --wait --add Microsoft.VisualStudio.Workload.VCTools - set VSDEVCMD_ARGS= -) ELSE ( - set VS_INSTALL_ARGS=--nocache --quiet --wait --add Microsoft.VisualStudio.Workload.VCTools ^ - --add Microsoft.VisualStudio.Component.VC.Tools.14.34 ^ - --add Microsoft.Component.MSBuild ^ - --add Microsoft.VisualStudio.Component.Roslyn.Compiler ^ - --add Microsoft.VisualStudio.Component.TextTemplating ^ - --add Microsoft.VisualStudio.Component.VC.CoreIde ^ - --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest ^ - --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core ^ - --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^ - --add Microsoft.VisualStudio.Component.VC.Tools.14.34 ^ - --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 - set VSDEVCMD_ARGS=-vcvars_ver=14.34 -) - -curl -k -L %VS_DOWNLOAD_LINK% --output vs_installer.exe -if errorlevel 1 exit /b 1 - -start /wait .\vs_installer.exe %VS_INSTALL_ARGS% -if not errorlevel 0 exit /b 1 -if errorlevel 1 if not errorlevel 3010 exit /b 1 -if errorlevel 3011 exit /b 1 diff --git a/windows/internal/xpu_install.bat b/windows/internal/xpu_install.bat deleted file mode 100644 index 4d86d6ab1..000000000 --- a/windows/internal/xpu_install.bat +++ /dev/null @@ -1,119 +0,0 @@ -@echo on -REM Description: Install Intel Support Packages on Windows -REM BKM reference: https://www.intel.com/content/www/us/en/developer/articles/tool/pytorch-prerequisites-for-intel-gpus.html - -if not "%CUDA_VERSION%" == "xpu" ( - echo Skipping for non XPU builds - exit /b 0 -) - -set XPU_INSTALL_MODE=%~1 -if "%XPU_INSTALL_MODE%"=="" goto xpu_bundle_install_start -if "%XPU_INSTALL_MODE%"=="bundle" goto xpu_bundle_install_start -if "%XPU_INSTALL_MODE%"=="driver" goto xpu_driver_install_start -if "%XPU_INSTALL_MODE%"=="all" goto xpu_driver_install_start - -:arg_error - -echo Illegal XPU installation mode. The value can be "bundle"/"driver"/"all" -echo If keep the value as space, will use default "bundle" mode -exit /b 1 - -:xpu_driver_install_start -:: TODO Need more testing for driver installation -set XPU_DRIVER_LINK=https://downloadmirror.intel.com/830975/gfx_win_101.5972.exe -curl -o xpu_driver.exe --retry 3 --retry-all-errors -k %XPU_DRIVER_LINK% -echo "XPU Driver installing..." -start /wait "Intel XPU Driver Installer" "xpu_driver.exe" -if errorlevel 1 exit /b 1 -del xpu_driver.exe -if "%XPU_INSTALL_MODE%"=="driver" goto xpu_install_end - -:xpu_bundle_install_start - -set XPU_BUNDLE_PARENT_DIR=C:\Program Files (x86)\Intel\oneAPI -set XPU_BUNDLE_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/9d1a91e2-e8b8-40a5-8c7f-5db768a6a60c/w_intel-for-pytorch-gpu-dev_p_0.5.3.37_offline.exe -set XPU_BUNDLE_PRODUCT_NAME=intel.oneapi.win.intel-for-pytorch-gpu-dev.product -set XPU_BUNDLE_VERSION=0.5.3+31 -set XPU_BUNDLE_INSTALLED=0 -set XPU_BUNDLE_UNINSTALL=0 -set XPU_EXTRA_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/9d1a91e2-e8b8-40a5-8c7f-5db768a6a60c/w_intel-pti-dev_p_0.9.0.37_offline.exe -set XPU_EXTRA_PRODUCT_NAME=intel.oneapi.win.intel-pti-dev.product -set XPU_EXTRA_VERSION=0.9.0+36 -set XPU_EXTRA_INSTALLED=0 -set XPU_EXTRA_UNINSTALL=0 - -if not [%XPU_VERSION%]==[] if [%XPU_VERSION%]==[2025.0] ( - set XPU_BUNDLE_URL=https://registrationcenter-download.intel.com/akdlm/IRC_NAS/efc86abd-cb77-452e-a03f-a741895b8ece/intel-deep-learning-essentials-2025.0.0.336_offline.exe - set XPU_BUNDLE_PRODUCT_NAME=intel.oneapi.win.deep-learning-essentials.product - set XPU_BUNDLE_VERSION=2025.0.0+335 - set XPU_BUNDLE_INSTALLED=0 - set XPU_BUNDLE_UNINSTALL=0 - set XPU_EXTRA_URL=NULL - set XPU_EXTRA_PRODUCT_NAME=intel.oneapi.win.compiler.product - set XPU_EXTRA_VERSION=2025.0.1+1226 - set XPU_EXTRA_INSTALLED=0 - set XPU_EXTRA_UNINSTALL=0 -) - -:: Check if XPU bundle is target version or already installed -if exist "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" goto xpu_bundle_ver_check -goto xpu_bundle_install - -:xpu_bundle_ver_check - -"%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --list-products > xpu_bundle_installed_ver.log - -for /f "tokens=1,2" %%a in (xpu_bundle_installed_ver.log) do ( - if "%%a"=="%XPU_BUNDLE_PRODUCT_NAME%" ( - echo %%a Installed Version: %%b - set XPU_BUNDLE_INSTALLED=1 - if not "%XPU_BUNDLE_VERSION%"=="%%b" ( - start /wait "Installer Title" "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --action=remove --eula=accept --silent --product-id %%a --product-ver %%b --log-dir uninstall_bundle - set XPU_BUNDLE_UNINSTALL=1 - ) - ) - if "%%a"=="%XPU_EXTRA_PRODUCT_NAME%" ( - echo %%a Installed Version: %%b - set XPU_EXTRA_INSTALLED=1 - if not "%XPU_EXTRA_VERSION%"=="%%b" ( - start /wait "Installer Title" "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --action=remove --eula=accept --silent --product-id %%a --product-ver %%b --log-dir uninstall_bundle - set XPU_EXTRA_UNINSTALL=1 - ) - ) - if not "%%b" == "Version" if not [%%b]==[] if not "%%a"=="%XPU_BUNDLE_PRODUCT_NAME%" if not "%%a"=="%XPU_EXTRA_PRODUCT_NAME%" ( - echo "Uninstalling...." - start /wait "Installer Title" "%XPU_BUNDLE_PARENT_DIR%\Installer\installer.exe" --action=remove --eula=accept --silent --product-id %%a --product-ver %%b --log-dir uninstall_bundle - ) -) -if errorlevel 1 exit /b 1 -if exist xpu_bundle_installed_ver.log del xpu_bundle_installed_ver.log -if exist uninstall_bundle rmdir /s /q uninstall_bundle -if "%XPU_BUNDLE_INSTALLED%"=="0" goto xpu_bundle_install -if "%XPU_BUNDLE_UNINSTALL%"=="1" goto xpu_bundle_install - -:xpu_extra_check - -if "%XPU_EXTRA_URL%"=="NULL" goto xpu_install_end -if "%XPU_EXTRA_INSTALLED%"=="0" goto xpu_extra_install -if "%XPU_EXTRA_UNINSTALL%"=="1" goto xpu_extra_install -goto xpu_install_end - -:xpu_bundle_install - -curl -o xpu_bundle.exe --retry 3 --retry-all-errors -k %XPU_BUNDLE_URL% -echo "XPU Bundle installing..." -start /wait "Intel Pytorch Bundle Installer" "xpu_bundle.exe" --action=install --eula=accept --silent --log-dir install_bundle -if errorlevel 1 exit /b 1 -del xpu_bundle.exe -goto xpu_extra_check - -:xpu_extra_install - -curl -o xpu_extra.exe --retry 3 --retry-all-errors -k %XPU_EXTRA_URL% -echo "Intel XPU EXTRA installing..." -start /wait "Intel XPU EXTRA Installer" "xpu_extra.exe" --action=install --eula=accept --silent --log-dir install_bundle -if errorlevel 1 exit /b 1 -del xpu_extra.exe - -:xpu_install_end diff --git a/windows/xpu.bat b/windows/xpu.bat deleted file mode 100755 index d95d889ee..000000000 --- a/windows/xpu.bat +++ /dev/null @@ -1,41 +0,0 @@ -@echo on - -set MODULE_NAME=pytorch - -IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" ( - call internal\clone.bat - cd %~dp0 -) ELSE ( - call internal\clean.bat -) -IF ERRORLEVEL 1 goto :eof - -call internal\check_deps.bat -IF ERRORLEVEL 1 goto :eof - -REM Check for optional components - -echo Disabling CUDA -set USE_CUDA=0 - -call internal\check_opts.bat -IF ERRORLEVEL 1 goto :eof - -echo Activate XPU Bundle env -set VS2022INSTALLDIR=%VS15INSTALLDIR% -set XPU_BUNDLE_ROOT=%ProgramFiles(x86)%\Intel\oneAPI -call "%XPU_BUNDLE_ROOT%\compiler\latest\env\vars.bat" -call "%XPU_BUNDLE_ROOT%\ocloc\latest\env\vars.bat" -IF ERRORLEVEL 1 goto :eof - -:: Workaround for https://github.com/pytorch/pytorch/issues/134989 -set CMAKE_SHARED_LINKER_FLAGS=/FORCE:MULTIPLE -set CMAKE_MODULE_LINKER_FLAGS=/FORCE:MULTIPLE -set CMAKE_EXE_LINKER_FLAGS=/FORCE:MULTIPLE - -if exist "%NIGHTLIES_PYTORCH_ROOT%" cd %NIGHTLIES_PYTORCH_ROOT%\.. -call %~dp0\internal\copy_cpu.bat -IF ERRORLEVEL 1 goto :eof - -call %~dp0\internal\setup.bat -IF ERRORLEVEL 1 goto :eof