Compile Tensorflow 1.14 for windows
Required :
1. Download sources from GitHub - tensorflow/tensorflow at r1.14
2. Be sure you have installed Cuda 10.0, and CuDNN7.4.1 for Cuda 10.0 (you have to login for CuDNN download)
- Note : see Build from source | TensorFlow for compatibility table
- add path below to system path
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp
- be sure you have system variables
CUDA_PATH
C:\Program
Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
CUDA_PATH_V10_0 C:\Program
Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
3. Download bazel compiler system ver. 0.24.1 as recommended by compatibility table
- unpack it to separate folder and add this path to the system path
- Note : probably it could
fail to download some packages and compile time (server is updated
continuously, same packages became obsolete), then try to use different
version, another versions may do compilation job as well, just try it
4. Additionally you will need to install Cuda_10.1 (temporarily)
- replace cudaf++.exe from 10.1 (nvcc 10.0 has crash problem)
- Note : see https://github.com/tensorflow/tensorflow/issues/27576
- you may remove Cuda_10.1 after it is done
5. Bazel is using a lot of space on disc C: (Upto ~20G). If you have not enough space on disc C:, consider :
- move windows temp buffer to another disc (System variables TEMP and TMP)
- disable pagefile.sys on disc C: and enable it on another disc (for example D:)
- disable hibernation mode (hiberfil.sys will be removed)
- clean recycle bin
- you may also use 'cleanmgr' to empty additional space
- you may revert back all changes above after compilation is done
Compiling :
1. Configure
- open CMD window and change to tensorflow main source directory
- run >> python configure.py
- answer on configuration questions:
- Usually I'm setting everything by default, but
change computing compatibility to GPUs I have (for ex. 3.0, 6.1)
- you will get ".tf_configure.bazelrc"
- in .tf_configure.bazelrc
- change true->false for
compile without XLA (dont remember why I did it, may be to
avoid compilation error)
build:xla
--define with_xla_support=false
- add definitions
build
--action_env TF_CUDA_VERSION="10.0"
build
--action_env TF_CUDNN_VERSION="7"
2. Run compilation
- run >> bazel build
--config=opt --config=cuda
//tensorflow/tools/pip_package:build_pip_package
- it will take ~4hours on 4core desktop PC
3. Build wheel package
- run >> ./bazel-bin/tensorflow/tools/pip_package/build_pip_package ./tensorflow_pkg
------------------------
Note (just comment) : at configuration stage I made configuration as below (but default values ar also Ok):
c:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v10.0\lib\x64\,c:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v10.0\include\,c:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v10.0\bin\,c:\Program Files\NVIDIA GPU Computing
Toolkit\CUDA\v10.0\
c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\,c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include\