-
-
Save peterjc123/a4ac6ce4b0ed4b1b497334baaeb595e3 to your computer and use it in GitHub Desktop.
# Prerequisites | |
# 1. MSVC 2017 C++ Build Tools | |
# 2. CMAKE 3.0 or up | |
# 3. 64 bits of Windows | |
# 4. Anaconda / MiniConda 64 bits | |
# Prerequisites for CUDA | |
# 1. CUDA 8.0 or up | |
# 2. NVTX( in CUDA as Visual Studio Integration. if fail to install, you can extract | |
# the CUDA installer exe and found the NVTX installer under the CUDAVisualStudioIntegration) | |
# 3. MSVC 2015 with Update 2 or up for CUDA 8 | |
# Optional | |
# 1. cuDNN 6.0 or up | |
# 2. Blas (MKL, OpenBlas) | |
git clone --recursive https://github.com/pytorch/pytorch | |
cd pytorch | |
xcopy /Y aten\src\ATen\common_with_cwrap.py tools\shared\cwrap_common.py | |
# Open X86_64 Developer Command Prompt for MSVC 2017 and type in the following commands: | |
# If you don't want to enable CUDA | |
set NO_CUDA=1 | |
# If multiple versions of CUDA are installed,it will build for the last one installed. To override | |
set CUDA_PATH=%CUDA_PATH_V8_0% | |
set PATH=%CUDA_PATH_V8_0%\bin;%PATH% | |
# or | |
set CUDA_PATH=%CUDA_PATH_V9_0% | |
set PATH=%CUDA_PATH_V9_0%\bin;%PATH% | |
# For CUDA 8 builds | |
set CMAKE_GENERATOR=Visual Studio 14 2015 Win64 | |
# For CUDA 9 / CPU builds | |
set CMAKE_GENERATOR=Visual Studio 15 2017 Win64 | |
# If you want to speed up CUDA builds, use Ninja | |
pip install ninja | |
set CMAKE_GENERATOR=Ninja | |
# If you use Ninja with CUDA 8 | |
set PREBUILD_COMMAND=%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat | |
set PREBUILD_COMMAND_ARGS=x86_amd64 | |
# If you want to save time for rebuilding it next time, use clcache | |
pip install git+https://github.com/frerich/clcache.git | |
set USE_CLCACHE=1 | |
set CC=clcache | |
set CXX=clcache | |
# If you want to add BLAS(OpenBLAS, MKL) | |
set LIB=[PATH_TO_BLAS_LIBS];%LIB% | |
# If your main python version is < 3.5 | |
set PYTHON_VERSION=3.5 # 3.6 or up is also fine | |
conda create -q -n test python=PYTHON_VERSION numpy mkl cffi pyyaml | |
activate test | |
# If you have both VS2015 and VS2017 | |
set DISTUTILS_USE_SDK=1 | |
# Now you can start install PyTorch here | |
python setup.py install |
I have same error like prithviraj23, but after installing cmake binary and adding it to path + running script in MSBuild Command Promt for VS2015 it seemed to be ok (it was a lot of warnings about casting int, but no errors). After 45 minutes I've got this:
F:\pytorch\torch\lib\build\ATen\INSTALL.vcxproj" (default target) (1) ->
"F:\pytorch\torch\lib\build\ATen\ALL_BUILD.vcxproj" (default target) (3) ->
"F:\pytorch\torch\lib\build\ATen\src\ATen\ATen.vcxproj" (default target) (4) ->
(ClCompile target) ->
F:\pytorch\aten\src\TH\vector\AVX2.c(60): error C2440: 'function': cannot convert from 'int' to '__m256' [F:\pytorch\
torch\lib\build\ATen\src\ATen\ATen.vcxproj]
6764 Warning(s)
1 Error(s)
Time Elapsed 00:45:04.37
A subdirectory or file build\nanopb already exists.
-- Selecting Windows SDK version to target Windows 10.0.16299.
-- Configuring done
-- Generating done
@peterjc123
Hi Peter,
I have the following error while building:
"C:\Users\Utilisateur\OneDrive\Documents\git\pytorch\torch\lib\build\ATen\INSTALL.vcxproj" (default target) (1) ->
"C:\Users\Utilisateur\OneDrive\Documents\git\pytorch\torch\lib\build\ATen\ALL_BUILD.vcxproj" (default target) (3) ->
"C:\Users\Utilisateur\OneDrive\Documents\git\pytorch\torch\lib\build\ATen\src\ATen\ATen.vcxproj" (default target) (4) -
(Link target) ->
THAtomic.obj : error LNK2019: unresolved external symbol __InterlockedExchange64 referenced in function _THAtomicSetL
ong [C:\Users\Utilisateur\OneDrive\Documents\git\pytorch\torch\lib\build\ATen\src\ATen\ATen.vcxproj]
THAtomic.obj : error LNK2019: unresolved external symbol __InterlockedExchangeAdd64 referenced in function _THAtomicA
ddLong [C:\Users\Utilisateur\OneDrive\Documents\git\pytorch\torch\lib\build\ATen\src\ATen\ATen.vcxproj]
C:\Users\Utilisateur\OneDrive\Documents\git\pytorch\torch\lib\build\ATen\src\ATen\Release\ATen.dll : fatal error LNK1
120: 2 unresolved externals [C:\Users\Utilisateur\OneDrive\Documents\git\pytorch\torch\lib\build\ATen\src\ATen\ATen.vcx
proj]
5397 Warning(s)
3 Error(s)
@peterjc123
Hi Peter,
I get error code here...
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeDetermineCCompiler.cmake:57 (message):
Could not find compiler set in environment variable CC:
clcache.
Call Stack (most recent call first):
CMakeLists.txt:9 (project)
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
ninja: error: loading 'build.ninja':
could you help me fix that?
thanks
Guys, don't ask here. Since there's no notification on this. Please ask here instead.
@prithviraj23 This error will occur if there's anything wrong with the ATen build. Please send me the first error you met.