-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable windows cuda unit tests (#4421)
* enable cuda for unittest * add one check * rename * minor fix * add more check * add cuda envs * add more cuda envs * add driver update * update vs integration * get cuda version * merge * add envs in install.sh * reduce some change and add comments * minor improve * fix typo * exit if driver update failed * fix lint * fix lint * Avoid catching exception to show error message * try 11.1 * try 11.1 * "try 11.1" * set the downloaded gpu driver dlls only for 10.2 * check torch.cuda.is_available() * add display.driver * Revert "Avoid catching exception to show error message" This reverts commit 1ce58c5. * Update .circleci/unittest/windows/scripts/set_cuda_envs.sh * Update .circleci/unittest/windows/scripts/set_cuda_envs.sh * Update .circleci/unittest/windows/scripts/set_cuda_envs.sh Co-authored-by: Nicolas Hug <nicolashug@fb.com> Co-authored-by: Vasilis Vryniotis <datumbox@users.noreply.github.com> Co-authored-by: Nikita Shulga <nikita.shulga@gmail.com> Co-authored-by: Nikita Shulga <nshulga@fb.com>
- Loading branch information
1 parent
eb2fb25
commit 932ca5a
Showing
7 changed files
with
114 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,48 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
if [ "${CU_VERSION:-}" == "cpu" ] ; then | ||
exit 0 | ||
fi | ||
echo CU_VERSION is "${CU_VERSION}" | ||
echo CUDA_VERSION is "${CUDA_VERSION}" | ||
|
||
if [[ ${#CU_VERSION} -eq 5 ]]; then | ||
CUDA_VERSION="${CU_VERSION:2:2}.${CU_VERSION:4:1}" | ||
# Currenly, CU_VERSION and CUDA_VERSION are not consistent. | ||
# to understand this code, see https://github.com/pytorch/vision/issues/4443 | ||
version="cpu" | ||
if [[ ! -z "${CUDA_VERSION}" ]] ; then | ||
version="$CUDA_VERSION" | ||
else | ||
if [[ ${#CU_VERSION} -eq 5 ]]; then | ||
version="${CU_VERSION:2:2}.${CU_VERSION:4:1}" | ||
fi | ||
fi | ||
|
||
# It's a log to see if CU_VERSION exists, if not, we use environment CUDA_VERSION directly | ||
# in unittest_windows_gpu, there's no CU_VERSION, but CUDA_VERSION. | ||
echo "Using CUDA $CUDA_VERSION, CU_VERSION is $CU_VERSION now" | ||
# Don't use if [[ "$version" == "cpu" ]]; then exit 0 fi. | ||
# It would exit the shell. One result is cpu tests would not run if the shell exit. | ||
# Unless there's an error, Don't exit. | ||
if [[ "$version" != "cpu" ]]; then | ||
# set cuda envs | ||
export PATH="/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${version}/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${version}/libnvvp:$PATH" | ||
export CUDA_PATH_V${version/./_}="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version}" | ||
export CUDA_PATH="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version}" | ||
|
||
version=$CUDA_VERSION | ||
if [ ! -d "$CUDA_PATH" ]; then | ||
echo "$CUDA_PATH" does not exist | ||
exit 1 | ||
fi | ||
|
||
# set cuda envs | ||
export PATH="/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${version}/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${version}/libnvvp:$PATH" | ||
export CUDA_PATH_V${version/./_}="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version}" | ||
export CUDA_PATH="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${version}" | ||
if [ ! -f "${CUDA_PATH}\include\nvjpeg.h" ]; then | ||
echo "nvjpeg does not exist" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d "$CUDA_PATH" ] | ||
then | ||
echo "$CUDA_PATH" does not exist | ||
exit 1 | ||
fi | ||
# check cuda driver version | ||
for path in '/c/Program Files/NVIDIA Corporation/NVSMI/nvidia-smi.exe' /c/Windows/System32/nvidia-smi.exe; do | ||
if [[ -x "$path" ]]; then | ||
"$path" || echo "true"; | ||
break | ||
fi | ||
done | ||
|
||
# check cuda driver version | ||
for path in '/c/Program Files/NVIDIA Corporation/NVSMI/nvidia-smi.exe' /c/Windows/System32/nvidia-smi.exe; do | ||
if [[ -x "$path" ]]; then | ||
"$path" || echo "true"; | ||
break | ||
fi | ||
done | ||
which nvcc | ||
which nvcc | ||
nvcc --version | ||
env | grep CUDA | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
set "DRIVER_DOWNLOAD_LINK=https://ossci-windows.s3.amazonaws.com/461.09-data-center-tesla-desktop-winserver-2019-2016-international.exe" | ||
curl --retry 3 -kL %DRIVER_DOWNLOAD_LINK% --output 461.09-data-center-tesla-desktop-winserver-2019-2016-international.exe | ||
if errorlevel 1 exit /b 1 | ||
|
||
start /wait 461.09-data-center-tesla-desktop-winserver-2019-2016-international.exe -s -noreboot | ||
if errorlevel 1 exit /b 1 | ||
|
||
del 461.09-data-center-tesla-desktop-winserver-2019-2016-international.exe || ver > NUL | ||
|
||
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 "%NVIDIA_GPU_EXISTS%" == "0" ( | ||
echo "CUDA Driver installation Failed" | ||
exit /b 1 | ||
) |