Skip to content

Commit e2d51a8

Browse files
zheng-xqtensorflower-gardener
authored andcommitted
Merge changes from github.
Change: 137532946
1 parent f80ef2d commit e2d51a8

97 files changed

Lines changed: 1729 additions & 403 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ and discussion.**
3333

3434
People who are a little more adventurous can also try our nightly binaries:
3535

36-
* Linux CPU-only: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-cp27-none-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave)) / [Python 3.4](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-cp34-cp34m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=cpu-slave/)) / [Python 3.5](https://ci.tensorflow.org/view/Nightly/job/nightly-python35-linux-cpu/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-cp35-cp35m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-python35-linux-cpu/))
37-
* Linux GPU: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-cp27-none-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/)) / [Python 3.4](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-cp34-cp34m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/)) / [Python 3.5](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-cp35-cp35m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/))
38-
* Mac CPU-only: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-py2-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac-slave/)) / [Python 3](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-py3-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac-slave/))
39-
* Mac GPU: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-mac/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-py2-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-mac/)) / [Python 3](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-mac/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-py3-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-mac/))
36+
* Linux CPU-only: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-cp27-none-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave)) / [Python 3.4](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-cp34-cp34m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=cpu-slave/)) / [Python 3.5](https://ci.tensorflow.org/view/Nightly/job/nightly-python35-linux-cpu/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-cp35-cp35m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-python35-linux-cpu/))
37+
* Linux GPU: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-cp27-none-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/)) / [Python 3.4](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-cp34-cp34m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/)) / [Python 3.5](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-cp35-cp35m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/))
38+
* Mac CPU-only: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac1-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-py2-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac1-slave/)) / [Python 3](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac1-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-py3-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac1-slave/))
39+
* Mac GPU: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-mac/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-py2-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-mac/)) / [Python 3](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-mac/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-py3-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-mac/))
4040
* [Android](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-android/TF_BUILD_CONTAINER_TYPE=ANDROID,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=NO_PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=android-slave/lastSuccessfulBuild/artifact/bazel-out/local_linux/bin/tensorflow/examples/android/tensorflow_demo.apk) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-android/TF_BUILD_CONTAINER_TYPE=ANDROID,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=NO_PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=android-slave/))
4141

4242
#### *Try your first TensorFlow program*

tensorflow/contrib/cmake/CMakeLists.txt

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ cmake_policy(SET CMP0022 NEW)
1515

1616
# Options
1717
option(tensorflow_VERBOSE "Enable for verbose output" OFF)
18+
option(tensorflow_ENABLE_GPU "Enable GPU support" OFF)
1819
option(tensorflow_ENABLE_SSL_SUPPORT "Enable boringssl support" OFF)
1920
option(tensorflow_ENABLE_GRPC_SUPPORT "Enable gRPC support" ON)
2021
option(tensorflow_BUILD_CC_EXAMPLE "Build the C++ tutorial example" ON)
@@ -48,8 +49,13 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
4849
add_definitions(-DEIGEN_AVOID_STL_ARRAY)
4950
if(WIN32)
5051
add_definitions(-DNOMINMAX -D_WIN32_WINNT=0x0A00 -DLANG_CXX11 -DCOMPILER_MSVC -D__VERSION__=\"MSVC\")
52+
add_definitions(-DWIN32 -DOS_WIN -D_MBCS -DWIN64 -DWIN32_LEAN_AND_MEAN -DNOGDI -DPLATFORM_WINDOWS)
53+
add_definitions(-DTENSORFLOW_USE_EIGEN_THREADPOOL -DEIGEN_HAS_C99_MATH -D_ITERATOR_DEBUG_LEVEL=0)
54+
add_definitions(/bigobj /nologo /EHsc /GF /FC /MP /Gm-)
5155
# Suppress warnings to reduce build log size.
5256
add_definitions(/wd4267 /wd4244 /wd4800 /wd4503 /wd4554 /wd4996 /wd4348 /wd4018)
57+
add_definitions(/wd4099 /wd4146 /wd4267 /wd4305 /wd4307)
58+
add_definitions(/wd4715 /wd4722 /wd4723 /wd4838 /wd4309 /wd4334)
5359
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
5460
endif()
5561
@@ -80,7 +86,16 @@ set(tensorflow_EXTERNAL_LIBRARIES
8086
${protobuf_STATIC_LIBRARIES}
8187
)
8288
set(tensorflow_EXTERNAL_DEPENDENCIES
83-
gif_copy_headers_to_destination png_copy_headers_to_destination jpeg_copy_headers_to_destination jsoncpp farmhash_copy_headers_to_destination highwayhash_copy_headers_to_destination protobuf eigen)
89+
zlib_copy_headers_to_destination
90+
gif_copy_headers_to_destination
91+
png_copy_headers_to_destination
92+
jpeg_copy_headers_to_destination
93+
jsoncpp
94+
farmhash_copy_headers_to_destination
95+
highwayhash_copy_headers_to_destination
96+
protobuf
97+
eigen
98+
)
8499
85100
include_directories(
86101
# Source and generated code.
@@ -118,19 +133,67 @@ if(UNIX)
118133
list(APPEND tensorflow_EXTERNAL_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
119134
endif()
120135
136+
if (tensorflow_ENABLE_GPU)
137+
if (WIN32)
138+
find_package(CUDA 8.0 REQUIRED)
139+
140+
# by default we assume compute cabability 3.5 and 5.2. If you change this change it in
141+
# CUDA_NVCC_FLAGS and cuda_config.h below
142+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_35,code=\"sm_35,compute_35\";-gencode arch=compute_52,code=\"sm_52,compute_52\")
143+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};--include-path ${PROJECT_BINARY_DIR}/$\{build_configuration\};--expt-relaxed-constexpr)
144+
set(CUDA_INCLUDE ${CUDA_TOOLKIT_TARGET_DIR} ${CUDA_TOOLKIT_TARGET_DIR}/extras/CUPTI/include)
145+
include_directories(${CUDA_INCLUDE})
146+
add_definitions(-DGOOGLE_CUDA=1 -DTF_EXTRA_CUDA_CAPABILITIES=3.5,5.2)
147+
148+
# add cudnn
149+
include_directories(${CUDNN_HOME})
150+
set(CUDA_LIBRARIES ${CUDA_LIBRARIES} ${CUDNN_HOME}/lib/x64/cudnn.lib)
151+
152+
# create cuda_config.h
153+
FILE(WRITE ${tensorflow_source_dir}/third_party/gpus/cuda/cuda_config.h
154+
"#ifndef CUDA_CUDA_CONFIG_H_\n"
155+
"#define CUDA_CUDA_CONFIG_H_\n"
156+
"#define TF_CUDA_CAPABILITIES CudaVersion(\"3.5\"),CudaVersion(\"5.2\")\n"
157+
"#define TF_CUDA_VERSION \"64_80\"\n"
158+
"#define TF_CUDNN_VERSION \"64_5\"\n"
159+
"#endif // CUDA_CUDA_CONFIG_H_\n"
160+
)
161+
162+
# tf assumes in various places header files to be in cuda/include. On windows the cuda sdk
163+
# installs them under cuda/version/include and to avoid that we need to change tf we copy a
164+
# few files to cuda/include
165+
FILE(COPY
166+
${CUDA_TOOLKIT_TARGET_DIR}/include/cuda.h ${CUDA_TOOLKIT_TARGET_DIR}/include/cuComplex.h
167+
${CUDA_TOOLKIT_TARGET_DIR}/include/cublas_v2.h ${CUDNN_HOME}/include/cudnn.h
168+
${CUDA_TOOLKIT_TARGET_DIR}/include/cufft.h ${CUDA_TOOLKIT_TARGET_DIR}/include/curand.h
169+
DESTINATION ${tensorflow_source_dir}/third_party/gpus/cuda/include
170+
)
171+
include_directories(${tensorflow_source_dir}/third_party/gpus)
172+
# add cuda libraries to tensorflow_EXTERNAL_LIBRARIES
173+
list(APPEND tensorflow_EXTERNAL_LIBRARIES ${CUDA_LIBRARIES})
174+
endif()
175+
endif()
176+
121177
# Let's get to work!
122178
include(tf_core_framework.cmake)
123179
include(tf_tools.cmake)
124180
# NOTE: Disabled until issue #3996 is fixed.
125181
# include(tf_stream_executor.cmake)
182+
if (tensorflow_ENABLE_GPU)
183+
if (WIN32)
184+
include(tf_stream_executor.cmake)
185+
endif()
186+
endif()
187+
126188
include(tf_core_cpu.cmake)
127189
include(tf_models.cmake)
128190
include(tf_core_ops.cmake)
129191
include(tf_core_direct_session.cmake)
192+
include(tf_core_kernels.cmake)
130193
if(tensorflow_ENABLE_GRPC_SUPPORT)
131194
include(tf_core_distributed_runtime.cmake)
132195
endif()
133-
include(tf_core_kernels.cmake)
196+
134197
include(tf_cc_ops.cmake)
135198
if(tensorflow_BUILD_CC_EXAMPLE)
136199
include(tf_tutorials.cmake)

tensorflow/contrib/cmake/README.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ Current Status
1515

1616
The CMake files in this directory can build the core TensorFlow runtime, an
1717
example C++ binary, and a PIP package containing the runtime and Python
18-
bindings. Currently, only CPU builds are supported, but we are working on
19-
providing a GPU build as well.
18+
bindings.
2019

2120
Note: Windows support is in an **alpha** state, and we welcome your feedback.
2221

2322
### Pre-requisites
2423

25-
* CMake version 3.1 or later
24+
* CMake version 3.1 up to 3.6
2625

2726
* [Git](http://git-scm.com)
2827

@@ -45,21 +44,13 @@ Note: Windows support is in an **alpha** state, and we welcome your feedback.
4544
- [Anaconda 4.1.1 (Python 3.5 64-bit)](https://www.continuum.io/downloads)
4645
- [Git for Windows version 2.9.2.windows.1](https://git-scm.com/download/win)
4746
- [swigwin-3.0.10](http://www.swig.org/download.html)
48-
47+
- [NVidia CUDA Toolkit 8.0] (https://developer.nvidia.com/cuda-downloads)
48+
- [NVidia CUDNN 5.1] (https://developer.nvidia.com/cudnn)
4949
* Ubuntu 14.04
5050
- Makefile generator
5151
- Docker 1.9.1 (for automated testing)
5252

5353
### Current known limitations
54-
55-
* CPU support only
56-
57-
- We are in the process of porting the GPU code in
58-
`tensorflow/stream_executor` to build with CMake and work on non-POSIX
59-
platforms.
60-
61-
* Additional limitations for the Windows build:
62-
6354
- The Python package supports **Python 3.5 only**, because that is the only
6455
version for which standard Python binaries exist and those binaries are
6556
compatible with the TensorFlow runtime. (On Windows, the standard Python
@@ -114,6 +105,17 @@ Step-by-step Windows build
114105
D:\temp> "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvarsall.bat"
115106
```
116107
108+
* When building with GPU support after installing the CUDNN zip file from NVidia, append its
109+
bin directory to your PATH environment variable.
110+
In case TensorFlow fails to find the CUDA dll's during initialization, check your PATH environment variable.
111+
It should contain the directory of the CUDA dlls and the directory of the CUDNN dll.
112+
For example:
113+
114+
```
115+
D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
116+
D:\local\cuda\bin
117+
```
118+
117119
* We assume that `cmake` and `git` are installed and in your `%PATH%`. If
118120
for example `cmake` is not in your path and it is installed in
119121
`C:\Program Files (x86)\CMake\bin\cmake.exe`, you can add this directory
@@ -145,9 +147,14 @@ Step-by-step Windows build
145147
D:\...\build> cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release ^
146148
More? -DSWIG_EXECUTABLE=C:/tools/swigwin-3.0.10/swig.exe ^
147149
More? -DPYTHON_EXECUTABLE=C:/Users/%USERNAME%/AppData/Local/Continuum/Anaconda3/python.exe ^
148-
More? -DPYTHON_LIBRARIES=C:/Users/%USERNAME%/AppData/Local/Continuum/Anaconda3/libs/python35.lib
150+
More? -DPYTHON_LIBRARIES=C:/Users/%USERNAME%/AppData/Local/Continuum/Anaconda3/libs/python35.lib
149151
```
150-
152+
To build with GPU support add "^" at the end of the last line above following with:
153+
```
154+
More? -Dtensorflow_ENABLE_GPU=ON ^
155+
More? -DCUDNN_HOME="D:\...\cudnn"
156+
```
157+
151158
Note that the `-DCMAKE_BUILD_TYPE=Release` flag must match the build
152159
configuration that you choose when invoking `msbuild`. The known-good
153160
values are `Release` and `RelWithDebInfo`. The `Debug` build type is
@@ -184,6 +191,11 @@ Step-by-step Windows build
184191
SSL support (for making secure HTTP requests) in the TensorFlow runtime.
185192
This support is incomplete, and will be used for Google Cloud Storage
186193
support.
194+
195+
* `-Dtensorflow_ENABLE_GPU=(ON|OFF)`. Defaults to `OFF`. Include
196+
GPU support. If GPU is enabled you need to install the CUDA 8.0 Toolkit and CUDNN 5.1.
197+
CMake will expect the location of CUDNN in -DCUDNN_HOME=path_you_unziped_cudnn.
198+
187199
188200
4. Invoke MSBuild to build TensorFlow.
189201
@@ -202,7 +214,6 @@ Step-by-step Windows build
202214
D:\...\build> MSBuild /p:Configuration=Release tf_python_build_pip_package.vcxproj
203215
```
204216
205-
206217
Linux Continuous Integration build
207218
==================================
208219

tensorflow/contrib/cmake/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from setuptools.command.install import install as InstallCommandBase
2727
from setuptools.dist import Distribution
2828

29-
_VERSION = '0.11.0rc0-cmake-experimental'
29+
_VERSION = '0.11.0rc1-cmake-experimental'
3030

3131
REQUIRED_PACKAGES = [
3232
'numpy >= 1.11.0',

tensorflow/contrib/cmake/tf_core_cpu.cmake

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,27 @@ file(GLOB_RECURSE tf_core_cpu_exclude_srcs
2121
"${tensorflow_source_dir}/tensorflow/core/common_runtime/session_factory.cc"
2222
"${tensorflow_source_dir}/tensorflow/core/common_runtime/session_options.cc"
2323
)
24-
2524
list(REMOVE_ITEM tf_core_cpu_srcs ${tf_core_cpu_exclude_srcs})
25+
2626
# We need to include stubs for the GPU tracer, which are in the exclude glob.
2727
list(APPEND tf_core_cpu_srcs
2828
"${tensorflow_source_dir}/tensorflow/core/common_runtime/gpu/gpu_tracer.cc"
2929
"${tensorflow_source_dir}/tensorflow/core/common_runtime/gpu/gpu_tracer.h"
3030
)
3131

32+
if (tensorflow_ENABLE_GPU)
33+
file(GLOB_RECURSE tf_core_gpu_srcs
34+
"${tensorflow_source_dir}/tensorflow/core/common_runtime/gpu/*.cc"
35+
"${tensorflow_source_dir}/tensorflow/core/platform/default/gpu/cupti_wrapper.cc"
36+
"${tensorflow_source_dir}/tensorflow/core/common_runtime/gpu_device_factory.cc"
37+
)
38+
file(GLOB_RECURSE tf_core_gpu_exclude_srcs
39+
"${tensorflow_source_dir}/tensorflow/core/*test*.cc"
40+
"${tensorflow_source_dir}/tensorflow/core/*test*.cc"
41+
)
42+
list(REMOVE_ITEM tf_core_gpu_srcs ${tf_core_gpu_exclude_srcs})
43+
list(APPEND tf_core_cpu_srcs ${tf_core_gpu_srcs})
44+
endif()
45+
3246
add_library(tf_core_cpu OBJECT ${tf_core_cpu_srcs})
3347
add_dependencies(tf_core_cpu tf_core_framework)

tensorflow/contrib/cmake/tf_core_distributed_runtime.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ add_executable(grpc_tensorflow_server
3838
$<TARGET_OBJECTS:tf_core_ops>
3939
$<TARGET_OBJECTS:tf_core_direct_session>
4040
$<TARGET_OBJECTS:tf_core_distributed_runtime>
41+
$<$<BOOL:${tensorflow_ENABLE_GPU}>:$<TARGET_OBJECTS:tf_stream_executor>>
4142
)
4243

4344
target_link_libraries(grpc_tensorflow_server PUBLIC
4445
tf_protos_cc
46+
${tf_core_gpu_kernels_lib}
4547
${tensorflow_EXTERNAL_LIBRARIES}
4648
)

0 commit comments

Comments
 (0)