"git@developer.sourcefind.cn:OpenDAS/ktransformers.git" did not exist on "b22cded890e8e4e06ee0b68c9efb8e39d3118d38"
Unverified Commit 968cefc2 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Remove unneeded packaging files (#3618)



* remove some files

* Also remove entire packaging/conda folder
Co-authored-by: default avatarFrancisco Massa <fvsmassa@gmail.com>
parent f05bfc00
#!/usr/bin/env bash
if [[ -x "/remote/anaconda_token" ]]; then
. /remote/anaconda_token || true
fi
set -ex
if [[ "$CIRCLECI" == 'true' ]]; then
export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.:$PATH"
fi
# Function to retry functions that sometimes timeout or have flaky failures
retry () {
$* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*)
}
# Parse arguments and determmine version
###########################################################
if [[ -n "$DESIRED_CUDA" && -n "$TORCHVISION_BUILD_VERSION" && -n "$TORCHVISION_BUILD_NUMBER" ]]; then
desired_cuda="$DESIRED_CUDA"
build_version="$PYTORCH_BUILD_VERSION"
build_number="$PYTORCH_BUILD_NUMBER"
else
if [ "$#" -ne 3 ]; then
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 1
fi
desired_cuda="$1"
build_version="$2"
build_number="$3"
fi
if [[ "$desired_cuda" != cpu ]]; then
desired_cuda="$(echo $desired_cuda | tr -d cuda. )"
fi
echo "Building cuda version $desired_cuda and torchvision version: $build_version build_number: $build_number"
if [[ "$desired_cuda" == 'cpu' ]]; then
cpu_only=1
cuver="cpu"
else
# Switch desired_cuda to be M.m to be consistent with other scripts in
# pytorch/builder
export FORCE_CUDA=1
cuda_nodot="$desired_cuda"
if [[ ${#cuda_nodot} -eq 2 ]]; then
desired_cuda="${desired_cuda:0:1}.${desired_cuda:1:1}"
elif [[ ${#cuda_nodot} -eq 3 ]]; then
desired_cuda="${desired_cuda:0:2}.${desired_cuda:2:1}"
else
echo "unknown cuda version $cuda_nodot"
exit 1
fi
cuver="cu$cuda_nodot"
fi
export TORCHVISION_BUILD_VERSION=$build_version
export TORCHVISION_BUILD_NUMBER=$build_number
if [[ -z "$DESIRED_PYTHON" ]]; then
DESIRED_PYTHON=('3.5' '3.6' '3.7')
fi
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
if [[ -z "$WIN_PACKAGE_WORK_DIR" ]]; then
WIN_PACKAGE_WORK_DIR="$(echo $(pwd -W) | tr '/' '\\')\\tmp_conda_$(date +%H%M%S)"
fi
mkdir -p "$WIN_PACKAGE_WORK_DIR" || true
vision_rootdir="$(realpath ${WIN_PACKAGE_WORK_DIR})/torchvision-src"
git config --system core.longpaths true
if [[ ! -d "$vision_rootdir" ]]; then
rm -rf "$vision_rootdir"
git clone "https://github.com/pytorch/vision" "$vision_rootdir"
pushd "$vision_rootdir"
git checkout $PYTORCH_BRANCH
popd
fi
cd "$SOURCE_DIR"
export tmp_conda="${WIN_PACKAGE_WORK_DIR}\\conda"
export miniconda_exe="${WIN_PACKAGE_WORK_DIR}\\miniconda.exe"
rm -rf "$tmp_conda"
rm -f "$miniconda_exe"
curl -sSk https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o "$miniconda_exe"
"$SOURCE_DIR/install_conda.bat" && rm "$miniconda_exe"
pushd $tmp_conda
export PATH="$(pwd):$(pwd)/Library/usr/bin:$(pwd)/Library/bin:$(pwd)/Scripts:$(pwd)/bin:$PATH"
popd
retry conda install -yq conda-build
ANACONDA_USER=pytorch-nightly
conda config --set anaconda_upload no
export TORCHVISION_PACKAGE_SUFFIX=""
if [[ "$desired_cuda" == 'cpu' ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT=""
export CONDA_CPUONLY_FEATURE="- cpuonly # [not osx]"
export CUDA_VERSION="None"
else
export CONDA_CPUONLY_FEATURE=""
. ./switch_cuda_version.sh $desired_cuda
if [[ "$desired_cuda" == "10.2" ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=10.2,<10.3 # [not osx]"
elif [[ "$desired_cuda" == "10.1" ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=10.1,<10.2 # [not osx]"
elif [[ "$desired_cuda" == "10.0" ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=10.0,<10.1 # [not osx]"
elif [[ "$desired_cuda" == "9.2" ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=9.2,<9.3 # [not osx]"
elif [[ "$desired_cuda" == "9.0" ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=9.0,<9.1 # [not osx]"
elif [[ "$desired_cuda" == "8.0" ]]; then
export CONDA_CUDATOOLKIT_CONSTRAINT="- cudatoolkit >=8.0,<8.1 # [not osx]"
else
echo "unhandled desired_cuda: $desired_cuda"
exit 1
fi
fi
if [[ -z "$PYTORCH_VERSION" ]]; then
export CONDA_CHANNEL_FLAGS="-c pytorch-nightly -c pytorch"
export PYTORCH_VERSION="$(conda search --json 'pytorch[channel=pytorch-nightly]' | \
python -c "import os, sys, json, re; cuver = '$cuver'; \
cuver = cuver.replace('cu', 'cuda') if cuver != 'cpu' else cuver; \
print(re.sub(r'\\+.*$', '', \
[x['version'] for x in json.load(sys.stdin)['pytorch'] \
if (x['platform'] == 'darwin' or cuver in x['fn']) \
and 'py' + os.environ['DESIRED_PYTHON'] in x['fn']][-1]))")"
if [[ -z "$PYTORCH_VERSION" ]]; then
echo "PyTorch version auto detection failed"
echo "No package found for desired_cuda=$desired_cuda and DESIRED_PYTHON=$DESIRED_PYTHON"
exit 1
fi
else
export CONDA_CHANNEL_FLAGS="-c pytorch -c pytorch-nightly"
fi
if [[ "$desired_cuda" == 'cpu' ]]; then
export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==$PYTORCH_VERSION"
export CONDA_PYTORCH_CONSTRAINT="- pytorch==$PYTORCH_VERSION"
else
export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==${PYTORCH_VERSION}"
export CONDA_PYTORCH_CONSTRAINT="- pytorch==${PYTORCH_VERSION}"
fi
# Loop through all Python versions to build a package for each
for py_ver in "${DESIRED_PYTHON[@]}"; do
build_string="py${py_ver}_${build_string_suffix}"
folder_tag="${build_string}_$(date +'%Y%m%d')"
# Create the conda package into this temporary folder. This is so we can find
# the package afterwards, as there's no easy way to extract the final filename
# from conda-build
output_folder="out_$folder_tag"
rm -rf "$output_folder"
mkdir "$output_folder"
export VSTOOLCHAIN_PACKAGE=vs2017
# We need to build the compiler activation scripts first on Windows
time VSDEVCMD_ARGS=${VSDEVCMD_ARGS[@]} \
conda build -c "$ANACONDA_USER" \
--no-anaconda-upload \
--output-folder "$output_folder" \
../$VSTOOLCHAIN_PACKAGE
cp ../$VSTOOLCHAIN_PACKAGE/conda_build_config.yaml ../torchvision/conda_build_config.yaml
conda config --set anaconda_upload no
echo "Calling conda-build at $(date)"
if [[ "$desired_cuda" == "9.2" ]]; then
time CMAKE_ARGS=${CMAKE_ARGS[@]} \
BUILD_VERSION="$TORCHVISION_BUILD_VERSION" \
CU_VERSION="$cuver" \
SOURCE_ROOT_DIR="$vision_rootdir" \
conda build -c "$ANACONDA_USER" \
-c defaults \
-c conda-forge \
-c "numba/label/dev" \
--no-anaconda-upload \
--python "$py_ver" \
--output-folder "$output_folder" \
--no-verify \
--no-test \
../torchvision
else
time CMAKE_ARGS=${CMAKE_ARGS[@]} \
BUILD_VERSION="$TORCHVISION_BUILD_VERSION" \
CU_VERSION="$cuver" \
SOURCE_ROOT_DIR="$vision_rootdir" \
conda build -c "$ANACONDA_USER" \
-c defaults \
-c conda-forge \
--no-anaconda-upload \
--python "$py_ver" \
--output-folder "$output_folder" \
--no-verify \
--no-test \
../torchvision
fi
echo "Finished conda-build at $(date)"
# Extract the package for testing
ls -lah "$output_folder"
built_package="$(find $output_folder/ -name '*torchvision*.tar.bz2')"
# Copy the built package to the host machine for persistence before testing
if [[ -n "$PYTORCH_FINAL_PACKAGE_DIR" ]]; then
mkdir -p "$PYTORCH_FINAL_PACKAGE_DIR" || true
cp "$built_package" "$PYTORCH_FINAL_PACKAGE_DIR/"
fi
done
set +e
start /wait "" "%miniconda_exe%" /S /InstallationType=JustMe /RegisterPython=0 /AddToPath=0 /D=%tmp_conda%
if [[ "$OSTYPE" == "msys" ]]; then
CUDA_DIR="/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v$1"
else
CUDA_DIR="/usr/local/cuda-$1"
fi
if ! ls "$CUDA_DIR"
then
echo "folder $CUDA_DIR not found to switch"
fi
echo "Switching symlink to $CUDA_DIR"
mkdir -p /usr/local
rm -fr /usr/local/cuda
ln -s "$CUDA_DIR" /usr/local/cuda
if [[ "$OSTYPE" == "msys" ]]; then
export CUDA_VERSION=`ls /usr/local/cuda/bin/cudart64*.dll | head -1 | tr '._' ' ' | cut -d ' ' -f2`
export CUDNN_VERSION=`ls /usr/local/cuda/bin/cudnn64*.dll | head -1 | tr '._' ' ' | cut -d ' ' -f2`
else
export CUDA_VERSION=$(ls /usr/local/cuda/lib64/libcudart.so.*|sort|tac | head -1 | rev | cut -d"." -f -3 | rev)
export CUDNN_VERSION=$(ls /usr/local/cuda/lib64/libcudnn.so.*|sort|tac | head -1 | rev | cut -d"." -f -3 | rev)
fi
ls -alh /usr/local/cuda
echo "CUDA_VERSION=$CUDA_VERSION"
echo "CUDNN_VERSION=$CUDNN_VERSION"
# Turn off auto builds for commits
trigger: none
pr: none
jobs:
- template: templates/build_task.yml
parameters:
package: 'Wheels'
spec: 'CPU'
msagent: true
# Turn off auto builds for commits
trigger: none
pr: none
jobs:
- template: templates/auth_task.yml
- template: templates/build_task.yml
parameters:
package: 'Wheels'
spec: 'CPU'
msagent: true
- template: templates/build_task.yml
parameters:
package: 'Conda'
spec: 'CPU'
msagent: true
- template: templates/build_task.yml
parameters:
package: 'Wheels'
spec: 'CUDA'
msagent: true
- template: templates/build_task.yml
parameters:
package: 'Conda'
spec: 'CUDA'
msagent: true
- template: templates/linux_build_task.yml
parameters:
msagent: $(ms.hosted.agent.cpu)
@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 "%TORCHVISION_BUILD_VERSION%" == "" if NOT "%TORCHVISION_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 TORCHVISION_BUILD_VERSION=%~2
set TORCHVISION_BUILD_NUMBER=%~3
set BUILD_VERSION=%TORCHVISION_BUILD_VERSION%
:env_end
if NOT "%CUDA_VERSION%" == "cpu" (
set CUDA_PREFIX=cuda%CUDA_VERSION%
set CUVER=cu%CUDA_VERSION%
set FORCE_CUDA=1
) else (
set CUDA_PREFIX=cpu
set CUVER=cpu
)
set BUILD_VISION=1
REM set TORCH_WHEEL=torch -f https://download.pytorch.org/whl/%CUVER%/stable.html --no-index
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 -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 "ORIG_PATH=%PATH%"
set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%"
:: 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
conda create -n py!PYTHON_VERSION_STR! -y -q -c defaults -c conda-forge numpy>=1.11 mkl>=2018 python=%%v ca-certificates scipy
)
:: Uncomment for stable releases
:: FOR %%v IN (%DESIRED_PYTHON%) DO (
:: set PYTHON_VERSION_STR=%%v
:: set PYTHON_VERSION_STR=!PYTHON_VERSION_STR:.=!
:: set "PATH=%CONDA_HOME%\envs\py!PYTHON_VERSION_STR!;%CONDA_HOME%\envs\py!PYTHON_VERSION_STR!\scripts;%CONDA_HOME%\envs\py!PYTHON_VERSION_STR!\Library\bin;%ORIG_PATH%"
:: if "%CUDA_VERSION%" == "100" (
:: set TORCH_WHEEL=https://download.pytorch.org/whl/%CUVER%/torch-1.2.0-cp!PYTHON_VERSION_STR!-cp!PYTHON_VERSION_STR!m-win_amd64.whl
:: ) else (
:: set TORCH_WHEEL=https://download.pytorch.org/whl/%CUVER%/torch-1.2.0%%2B%CUVER%-cp!PYTHON_VERSION_STR!-cp!PYTHON_VERSION_STR!m-win_amd64.whl
:: )
:: echo Installing !TORCH_WHEEL!...
:: pip install "!TORCH_WHEEL!"
:: )
:: Uncomment for nightly releases
FOR %%v IN (%DESIRED_PYTHON%) DO (
set PYTHON_VERSION_STR=%%v
set PYTHON_VERSION_STR=!PYTHON_VERSION_STR:.=!
set "PATH=%CONDA_HOME%\envs\py!PYTHON_VERSION_STR!;%CONDA_HOME%\envs\py!PYTHON_VERSION_STR!\scripts;%CONDA_HOME%\envs\py!PYTHON_VERSION_STR!\Library\bin;%ORIG_PATH%"
set TORCH_WHEEL=torch --pre -f https://download.pytorch.org/whl/nightly/%CUVER%/torch_nightly.html
echo Installing !TORCH_WHEEL!...
pip install !TORCH_WHEEL!
)
endlocal
if "%DEBUG%" == "1" (
set BUILD_TYPE=debug
) ELSE (
set BUILD_TYPE=release
)
:: 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
if not "%CUDA_VERSION%" == "" (
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%"
)
)
for %%v in (%DESIRED_PYTHON_PREFIX%) do (
:: Activate Python Environment
set PYTHON_PREFIX=%%v
set "PATH=%CONDA_HOME%\envs\%%v;%CONDA_HOME%\envs\%%v\scripts;%CONDA_HOME%\envs\%%v\Library\bin;%ORIG_PATH%"
if defined INCLUDE (
set "INCLUDE=%INCLUDE%;%CONDA_HOME%\envs\%%v\Library\include"
) else (
set "INCLUDE=%CONDA_HOME%\envs\%%v\Library\include"
)
if defined LIB (
set "LIB=%LIB%;%CONDA_HOME%\envs\%%v\Library\lib"
) else (
set "LIB=%CONDA_HOME%\envs\%%v\Library\lib"
)
@setlocal
:: Set Flags
if NOT "%CUDA_VERSION%"=="cpu" (
set CUDNN_VERSION=7
)
call %CUDA_PREFIX%.bat
IF ERRORLEVEL 1 exit /b 1
call internal\test.bat
IF ERRORLEVEL 1 exit /b 1
@endlocal
)
set "PATH=%ORIG_PATH%"
popd
IF ERRORLEVEL 1 exit /b 1
@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 NO_CUDA=1
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
set NO_CUDA=
set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
IF "%NVTOOLSEXT_PATH%"=="" (
echo NVTX ^(Visual Studio Extension ^for CUDA^) ^not installed, failing
exit /b 1
goto optcheck
)
IF "%CUDA_PATH_V10_1%"=="" (
echo CUDA 10.1 not found, failing
exit /b 1
) ELSE (
IF "%BUILD_VISION%" == "" (
set TORCH_CUDA_ARCH_LIST=3.5;5.0+PTX;6.0;6.1;7.0;7.5
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_50,code=compute_50
)
set "CUDA_PATH=%CUDA_PATH_V10_1%"
set "PATH=%CUDA_PATH_V10_1%\bin;%PATH%"
)
:optcheck
IF "%BUILD_VISION%" == "" (
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
: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
set NO_CUDA=
set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
IF "%NVTOOLSEXT_PATH%"=="" (
echo NVTX ^(Visual Studio Extension ^for CUDA^) ^not installed, failing
exit /b 1
goto optcheck
)
IF "%CUDA_PATH_V10_2%"=="" (
echo CUDA 10.2 not found, failing
exit /b 1
) ELSE (
IF "%BUILD_VISION%" == "" (
set TORCH_CUDA_ARCH_LIST=3.5;5.0+PTX;6.0;6.1;7.0;7.5
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_50,code=compute_50
)
set "CUDA_PATH=%CUDA_PATH_V10_2%"
set "PATH=%CUDA_PATH_V10_2%\bin;%PATH%"
)
:optcheck
IF "%BUILD_VISION%" == "" (
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
: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
set USE_CUDA=
set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
IF "%NVTOOLSEXT_PATH%"=="" (
echo NVTX ^(Visual Studio Extension ^for CUDA^) ^not installed, failing
exit /b 1
goto optcheck
)
IF "%CUDA_PATH_V9_2%"=="" (
echo CUDA 9.2 not found, failing
exit /b 1
) ELSE (
IF "%BUILD_VISION%" == "" (
set TORCH_CUDA_ARCH_LIST=3.5;5.0+PTX;6.0;6.1;7.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_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_50,code=compute_50
)
set "CUDA_PATH=%CUDA_PATH_V9_2%"
set "PATH=%CUDA_PATH_V9_2%\bin;%PATH%"
)
:optcheck
IF "%BUILD_VISION%" == "" (
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
:eof
@echo off
: From the following doc, the build won't be triggered if the users don't sign in daily.
: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers?tabs=yaml&view=vsts#my-build-didnt-run-what-happened
: To avoid this problem, we can just go through the sign in process using the following command.
:auth_start
if "%RETRY_TIMES%" == "" (
set /a RETRY_TIMES=10
set /a SLEEP_TIME=2
) else (
set /a RETRY_TIMES=%RETRY_TIMES%-1
set /a SLEEP_TIME=%SLEEP_TIME%*2
)
for /f "usebackq tokens=*" %%i in (`curl -so NUL -w "%%{http_code}" -u %VSTS_AUTH% https://dev.azure.com/pytorch`) do (
set STATUS_CODE=%%i
)
IF NOT "%STATUS_CODE%" == "200" (
echo Auth retry times remaining: %RETRY_TIMES%
echo Sleep time: %SLEEP_TIME% seconds
IF %RETRY_TIMES% EQU 0 (
echo Auth failed
goto err
)
waitfor SomethingThatIsNeverHappening /t %SLEEP_TIME% 2>nul || ver >nul
goto auth_start
) ELSE (
echo Login Attempt Succeeded
goto auth_end
)
:err
: Throw a warning if it fails
powershell -c "Write-Warning 'Login Attempt Failed'"
:auth_end
set RETRY_TIMES=
set SLEEP_TIME=
set STATUS_CODE=
exit /b 0
if "%VC_YEAR%" == "2017" set VSDEVCMD_ARGS=-vcvars_ver=14.13
if "%VC_YEAR%" == "2017" powershell packaging/windows/internal/vs2017_install.ps1
if errorlevel 1 exit /b 1
call packaging/windows/internal/cuda_install.bat
if errorlevel 1 exit /b 1
call packaging/windows/internal/nightly_defaults.bat Conda
if errorlevel 1 exit /b 1
set PYTORCH_FINAL_PACKAGE_DIR=%CD%\packaging\windows\output
if not exist "%PYTORCH_FINAL_PACKAGE_DIR%" mkdir %PYTORCH_FINAL_PACKAGE_DIR%
bash ./packaging/conda/build_vision.sh %CUDA_VERSION% %TORCHVISION_BUILD_VERSION% %TORCHVISION_BUILD_NUMBER%
if errorlevel 1 exit /b 1
if "%VC_YEAR%" == "2017" set VSDEVCMD_ARGS=-vcvars_ver=14.13
if "%VC_YEAR%" == "2017" powershell packaging/windows/internal/vs2017_install.ps1
if errorlevel 1 exit /b 1
call packaging/windows/internal/cuda_install.bat
if errorlevel 1 exit /b 1
call packaging/windows/internal/nightly_defaults.bat Wheels
if errorlevel 1 exit /b 1
call packaging/windows/build_vision.bat %CUDA_VERSION% %TORCHVISION_BUILD_VERSION% %TORCHVISION_BUILD_NUMBER%
if errorlevel 1 exit /b 1
@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 2017 C++ BuildTools is required to compile PyTorch on Windows
exit /b 1
)
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [15^,16^) -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 2017 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 mkl 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
)
@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
)
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.exe
IF NOT ERRORLEVEL 1 (
echo sccache found, using it to speed up builds
set CC=sccache cl
set CXX=sccache cl
)
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
@echo off
cd %MODULE_NAME%
python setup.py clean
cd ..
@echo off
:: The conda and wheels jobs are seperated on Windows, so we don't need to clone again.
IF "%BUILD_VISION%" == "" (
if exist "%NIGHTLIES_PYTORCH_ROOT%" (
xcopy /E /Y /Q "%NIGHTLIES_PYTORCH_ROOT%" pytorch\
cd pytorch
goto submodule
)
)
git clone https://github.com/%PYTORCH_REPO%/%MODULE_NAME%
cd %MODULE_NAME%
IF NOT "%BUILD_VISION%" == "" goto latest_end
IF "%PYTORCH_BRANCH%" == "latest" ( goto latest_start ) else ( goto latest_end )
:latest_start
if "%NIGHTLIES_DATE%" == "" ( goto date_start ) else ( 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%TORCHVISION_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
copy "%CUDA_PATH%\bin\cusparse64_%CUDA_VERSION%.dll*" pytorch\torch\lib
copy "%CUDA_PATH%\bin\cublas64_%CUDA_VERSION%.dll*" pytorch\torch\lib
copy "%CUDA_PATH%\bin\cudart64_%CUDA_VERSION%.dll*" pytorch\torch\lib
copy "%CUDA_PATH%\bin\curand64_%CUDA_VERSION%.dll*" pytorch\torch\lib
copy "%CUDA_PATH%\bin\cufft64_%CUDA_VERSION%.dll*" pytorch\torch\lib
copy "%CUDA_PATH%\bin\cufftw64_%CUDA_VERSION%.dll*" pytorch\torch\lib
copy "%CUDA_PATH%\bin\cudnn64_%CUDNN_VERSION%.dll*" pytorch\torch\lib
copy "%CUDA_PATH%\bin\nvrtc64_%CUDA_VERSION%*.dll*" pytorch\torch\lib
copy "%CUDA_PATH%\bin\nvrtc-builtins64_%CUDA_VERSION%.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
copy "%CONDA_LIB_PATH%\libiomp*5md.dll" pytorch\torch\lib
@echo off
REM curl -k https://www.7-zip.org/a/7z1805-x64.exe -O
REM if errorlevel 1 exit /b 1
REM start /wait 7z1805-x64.exe /S
REM if errorlevel 1 exit /b 1
REM set "PATH=%ProgramFiles%\7-Zip;%PATH%"
choco feature disable --name showDownloadProgress
choco feature enable --name allowGlobalConfirmation
choco install curl 7zip
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment