Hello everyone, I try to build Pytorch 1.8 from source offline with VS 2019 (cuda11.1,cudnn8.2).
My Work Steps :
(1) I download the source code from GitHub - pytorch/pytorch at v1.8.1 (with all third party from their github).
(2) Install VS 2019 community (16.4.5 version).
(3) Install cuda11.1 , and test the command “nvcc -V” well.
(4) Install cudnn8.2 .
(5) Install anaconda and create enviroment (python==3.6) .
(6) Activate this enviromente and Follow the common reqiurements of GitHub - pytorch/pytorch at v1.8.1 , “conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses”, the result of install is okay.
(7) Refer to build_pytorch.bat .Then I download MKL ,MAGMA,SSCAHE,and Randomtemp.exe.
(8) I make a batch file script ,like the above [build_pytorch.bat].The key point lines are :
" echo @“E:\build_torch\needed\bin\randomtemp.exe” “E:\build_torch\needed\bin\sccache.exe” “%CUDA_PATH%\bin\nvcc.exe” %%* > “%TMP_DIR%\bin\nvcc.bat”
cat %TMP_DIR%\bin\nvcc.bat
set CUDA_NVCC_EXECUTABLE=%TMP_DIR%\bin\nvcc.bat "
(9) when I acitvate env and set my batch file script to build, MKL MAGMA SSCAHE could find and work,but the above 3 lines will cause that error “cuda could not found” .
Because in FindCUDA.camke line 786 “execute_process(COMMAN ${CUDA_NVCC_EXECUTABLE}) “–VERSION” ” , nvcc.bat do not work.
And CMAKE will modify USE_CUDA = 0.
This building result without cuda is not my target.
(10) Next time , I modify the above 3 lines . I just “set CUDA_NVCC_EXECUTABLE=%CUDA_PATH%\bin\nvcc.exe”.
(11) This time I set env vars and “python setup.py install --cmake”.
Cuda could find and work.
But Erros happen in about [4143/5177] :
“BinaryLogicalOpsKernels.cu
BinaryLogicalOpsKernels.cuninja: build stopped: subcommand failed.
Traceback (most recent call last):
File “setup.py”, line 818, in
build_deps()
File “setup.py”, line 320, in build_deps
cmake=cmake)
File “E:\build_torch\B14\pytorch\tools\build_pytorch_libs.py”, line 58, in build_caffe2
cmake.build(my_env)
File “E:\build_torch\B14\pytorch\tools\setup_helpers\cmake.py”, line 345, in build
self.run(build_args, my_env)
File “E:\build_torch\B14\pytorch\tools\setup_helpers\cmake.py”, line 140, in run
check_call(command, cwd=self.build_dir, env=env)
File “E:\Anaconda3\envs\mtorch\lib\subprocess.py”, line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘–build’, ‘.’, ‘–target’, ‘install’, ‘–config’, ‘Release’, ‘–’, ‘-j’, ‘8’]’ returned non-zero exit status 1.”
So I wanna know what’s wrong with my work ,please help me, many thanks!