Skip to content

Instantly share code, notes, and snippets.

@fo40225
Last active February 20, 2018 14:58
Show Gist options
  • Save fo40225/a2fd04ea75771c4518d6fac0b1063d94 to your computer and use it in GitHub Desktop.
Save fo40225/a2fd04ea75771c4518d6fac0b1063d94 to your computer and use it in GitHub Desktop.
tensorflow 1.4.0 on windows with avx2 & cuda by cmake
tensorflow 1.4.0 on windows with avx2 & cuda by cmake
win 10 1703
git 2.10.2
cmake 3.8.2
anaconda3 4.4.0
visual studio 2015 update 3 with c++ installed
cuda 8.0.61
cudnn 6
swigwin-3.0.10
git clone https://github.com/tensorflow/tensorflow.git -b v1.4.0
cd tensorflow/tensorflow/contrib/cmake
mkdir build
cd build
change compute capabilities (1080ti)
tensorflow\tensorflow\contrib\cmake\CMakeLists.txt
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_61,code=\"compute_61\")
add_definitions(-DGOOGLE_CUDA=1 -DTF_EXTRA_CUDA_CAPABILITIES=6.1)
"#define TF_CUDA_CAPABILITIES CudaVersion(\"6.1\")\n"
cmake .. -G "Visual Studio 14 2015" -A x64 -T host=x64 ^
-DCMAKE_BUILD_TYPE=Release ^
-DSWIG_EXECUTABLE=C:\Users\User\swigwin-3.0.10\swig.exe ^
-DPYTHON_EXECUTABLE=C:\Users\User\Anaconda3\python.exe ^
-DPYTHON_LIBRARY=C:\Users\User\Anaconda3\libs\python36.lib ^
-Dtensorflow_ENABLE_GPU=ON ^
-DCUDNN_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0" ^
-Dtensorflow_WIN_CPU_SIMD_OPTIONS="/arch:AVX2"
// MSBuild /p:Configuration=Release tf_python_build_pip_package.vcxproj
cmake --build . --target tf_python_build_pip_package --config Release
locale win fix
tensorflow\tensorflow\contrib\cmake\build\re2\src\re2\CMakeCache.txt:35
CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc /utf-8
2015 avx2 fix
https://github.com/tensorflow/tensorflow/pull/13525
pip install tf_python\dist\tensorflow_gpu-1.4.0-cp36-cp36m-win_amd64.whl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment