Tensorflow r1.5 윈도우10에서 C++ 컴파일 수행기 (x64)
Tensorflow r1.3 버젼에서는 CUDA Toolkit 8을 이용하였으나, Tensorflow 1.5 Version에서는 CUDA Toolkit 9를 찾음.
D:\Workspace\tensorflow\tensorflow\contrib\cmake\build> D:\Workspace\tensorflow\tensorflow\contrib\cmake\build> D:\Workspace\tensorflow\tensorflow\contrib\cmake\build> D:\Workspace\tensorflow\tensorflow\contrib\cmake\build> D:\Workspace\tensorflow\tensorflow\contrib\cmake\build>cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release ^ More? -DSWIG_EXECUTABLE=D:/Workspace/swigwin-3.0.10/swigwin-3.0.10/swig.exe ^ More? -DPYTHON_EXECUTABLE=C:/Anaconda3/python.exe ^ More? -DPYTHON_LIBRARIES=C:/Anaconda3/libs/python35.lib ^ More? -Dtensorflow_ENABLE_GPU=ON ^ More? -DCUDNN_HOME="D:\Workspace\cudnn-8.0-windows10-x64-v5.1\cuda" ^ More? -Dtensorflow_WIN_CPU_SIMD_OPTIONS=/arch:AVX -- Building for: Visual Studio 14 2015 -- The C compiler identification is MSVC 19.0.24215.1 -- The CXX compiler identification is MSVC 19.0.24215.1 -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED -- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed -- Performing Test COMPILER_OPT_WIN_CPU_SIMD_SUPPORTED -- Performing Test COMPILER_OPT_WIN_CPU_SIMD_SUPPORTED - Success CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find CUDA: Found unsuitable version "8.0", but required is at least "9.0" (found C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0) Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:386 (_FPHSA_FAILURE_MESSAGE) C:/Program Files/CMake/share/cmake-3.6/Modules/FindCUDA.cmake:958 (find_package_handle_standard_args) CMakeLists.txt:278 (find_package) -- Configuring incomplete, errors occurred! See also "D:/Workspace/tensorflow/tensorflow/contrib/cmake/build/CMakeFiles/CMakeOutput.log". See also "D:/Workspace/tensorflow/tensorflow/contrib/cmake/build/CMakeFiles/CMakeError.log". |
CUDA Toolkit 9.1 다운 및 설치
https://developer.nvidia.com/cuda-downloads
cudnn-9.1-windows10-x64-v7 다운 및 압축 해제후, CUDA Toolkit 디렉토리에 복사 수행
https://developer.nvidia.com/rdp/cudnn-download
Cmd 명령수행
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
set PATH=%PATH%;C:\Program Files\Git\bin\
cd D:\Workspace\tensorflow\tensorflow\contrib\cmake\build
cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release ^
-DSWIG_EXECUTABLE=D:/Workspace/swigwin-3.0.10/swigwin-3.0.10/swig.exe ^
-DPYTHON_EXECUTABLE=C:/Anaconda3/python.exe ^
-DPYTHON_LIBRARIES=C:/Anaconda3/libs/python35.lib ^
-Dtensorflow_ENABLE_GPU=ON ^
-DCUDNN_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1" ^
-DCUDA_SDK_ROOT_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1" ^
-Dtensorflow_WIN_CPU_SIMD_OPTIONS=/arch:AVX
Cmd 창으로 돌아와 컴파일 빌드 수행.
D:\...\build> MSBuild /p:Configuration=Release tf_tutorials_example_trainer.vcxproj
빌드 수행후 에러 발생 -> math_functions.hpp를 찾지 못하였다고 나오는 경우.
Visual Studio를 이용하여 프로젝트 오픈후 tf_core_gpu_kernels 프로젝트에 Include 디렉토리에
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\include\crt 추가수행후 재시도
D:\...\build> Release\tf_tutorials_example_trainer.exe
-------------------------------------------------------------------------------------------------------------------------------------------------
Tensorflow C++ r1.3에서 r1.5로 변경작업. (enuSpace-Tensorflow)
Tensorflow r1.5를 이용하여 tf_tutorials_example_tranier의 환경중 참조된 Object Libraries를 복사 수행.
- Visual studio 프로젝트 솔루션에서 tf_tutorials_example_trainer의 Object Libraries를 복사 및 붙여넣기 수행. (release용 obj파일 적용)
빌드 수행시 에러
1>D:\Workspace\tensorflow\tensorflow/core/platform/default/mutex.h(25): fatal error C1083: Cannot open include file: 'nsync_cv.h': No such file or directory
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\nsync\install 하위 디렉토리에 include, lib 디렉토리 존재
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\nsync\install\include 디렉토리 Additional Include Directories에 추가 수행
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\nsync\install\lib\nsync.lib 를 Additional Dependencies에 추가 수행.
1>summary_db_writer.obj : error LNK2001: unresolved external symbol sqlite3_bind_blob64
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\sqlite\install 하위 디렉토리에 include, lib 디렉토리 존재
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\sqlite\install\include 디렉토리 Additional Include Directories에 추가 수행
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\sqlite\install\lib\sqlite.lib 를 Additional Dependencies에 추가 수행.
1>port.obj : error LNK2001: unresolved external symbol "void __cdecl snappy::RawCompress(char const *,unsigned __int64,char *,unsigned __int64 *)" (?RawCompress@snappy@@YAXPEBD_KPEADPEA_K@Z)
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\snappy\src\snappy\Release\snappy.lib 를 Additional Dependencies에 추가 수행.
1>cuda_dnn.obj : error LNK2001: unresolved external symbol cudnnSetConvolutionMathType
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib\x64\cudart_static.lib // 8.0에서 9.1로 변경
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib\x64\cuda.lib // 8.0에서 9.1로 변경
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib\x64\cublas.lib // 8.0에서 9.1로 변경
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib\x64\cublas_device.lib // 8.0에서 9.1로 변경
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib\x64\cufft.lib // 8.0에서 9.1로 변경
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib\x64\curand.lib // 8.0에서 9.1로 변경
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\extras\CUPTI\libx64\cupti.lib // 8.0에서 9.1로 변경
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib\x64\cusolver.lib // 8.0에서 9.1로 변경
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib\x64\cudnn.lib // 8.0에서 9.1로 변경
1>tf_cc.lib(while_gradients.obj) : error LNK2001: unresolved external symbol "class tensorflow::Status __cdecl tensorflow::ops::BuildWhileLoop(class tensorflow::Scope const &,class std::vector<class tensorflow::Output,class std::allocator<class tensorflow::Output> > const &,class std::function<class tensorflow::Status __cdecl(class tensorflow::Scope const &,class std::vector<class tensorflow::Output,class std::allocator<class tensorflow::Output> > const &,class tensorflow::Output *)> const &,class std::function<class tensorflow::Status __cdecl(class tensorflow::Scope const &,class std::vector<class tensorflow::Output,class std::allocator<class tensorflow::Output> > const &,class std::vector<class tensorflow::Output,class std::allocator<class tensorflow::Output> > *)> const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class tensorflow::Output,class std::allocator<class tensorflow::Output> > *,bool,class tensorflow::Output *)" (?BuildWhileLoop@ops@tensorflow@@YA?AVStatus@2@AEBVScope@2@AEBV?$vector@VOutput@tensorflow@@V?$allocator@VOutput@tensorflow@@@std@@@std@@AEBV?$function@$$A6A?AVStatus@tensorflow@@AEBVScope@2@AEBV?$vector@VOutput@tensorflow@@V?$allocator@VOutput@tensorflow@@@std@@@std@@PEAVOutput@2@@Z@6@AEBV?$function@$$A6A?AVStatus@tensorflow@@AEBVScope@2@AEBV?$vector@VOutput@tensorflow@@V?$allocator@VOutput@tensorflow@@@std@@@std@@PEAV45@@Z@6@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@6@PEAV56@_NPEAVOutput@2@@Z)
실행중 No gradient defined for op: MatMul 오류 메세지 나타날경우
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\tf_cc.dir\Release\math_grad.obj // Object Libraries에 추가
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\tf_cc.dir\Release\nn_grad.obj // Object Libraries에 추가
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\tf_cc.dir\Release\array_grad.obj // Object Libraries에 추가
tf_core_kernels (one_hot_op가 포함되지 않은 경우, 포함하여 빌드 수행.
- D:\Workspace\tensorflow\tensorflow\core\kernels\one_hot_op.cc
- D:\Workspace\tensorflow\tensorflow\core\kernels\one_hot_op.h
- D:\Workspace\tensorflow\tensorflow\contrib\cmake\build\tf_core_kernels.dir\Release\one_hot_op.obj // Object Libraries에 추가
Add Object Libraries (포함되지않은 obj 파일이 있는 경우 포함하여 빌드 수행.
- tf_core_kernels.dir\Release\sparse_fill_empty_rows_op.obj
- tf_core_kernels.dir\Release\sparse_reduce_op.obj
- tf_core_kernels.dir\Release\sparse_slice_op.obj
------------------------------------------------------------------------------------------------------------------------------------------------
'enuSpace for jupiter(2019) > Work note(jupiter)' 카테고리의 다른 글
enuSpace Tensorflow(텐서플로우)를 이용한 XOR 학습 구현 (0) | 2017.12.14 |
---|---|
MNIST linear regression training 결과 (0) | 2017.12.08 |
Tensorflow를 이용한 MNIST linear regression 구현 (그래픽 블럭-enuSpace) (1) | 2017.12.08 |
Tensorflow를 이용한 GradientDescent 구현 (그래픽 블럭) (0) | 2017.10.20 |
Tensorflow (r1.3) 윈도우10에서 C++ 컴파일 방법 (0) | 2017.08.22 |