File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 9
9
# If enabled, bazel has to be installed.
10
10
option (TENSORFLOW_SHARED "Build shared library (required for GPU support)." OFF )
11
11
option (ALLOW_CUDA "When building the shared library, try to find and use CUDA." ON )
12
+ option (REQUIRE_CUDA "When building the shared library, make sure to find and use CUDA (implies ALLOW_CUDA)." OFF )
12
13
option (TENSORFLOW_STATIC "Build static library." ON )
13
14
set (TENSORFLOW_TAG "v1.15.0" CACHE STRING "The tensorflow release tag to be checked out (default v1.15.0)." )
14
15
option (SYSTEM_PROTOBUF "Use system protobuf instead of static protobuf from contrib/makefile." OFF )
Original file line number Diff line number Diff line change @@ -33,7 +33,25 @@ export PYTHON_BIN_PATH=${PYTHON_BIN_PATH:-"$(which python3)"}
33
33
export PYTHON_LIB_PATH=" $( $PYTHON_BIN_PATH -c ' import site; print(site.getsitepackages()[0])' ) "
34
34
35
35
# check if cuda support requested and supported
36
- if [ " @ALLOW_CUDA@" = " ON" ] && hash nvcc 2> /dev/null; then
36
+ cuda_available=false
37
+ if hash nvcc 2> /dev/null; then
38
+ cuda_available=true
39
+ fi
40
+
41
+ cuda_allowed=false
42
+ if [ " @ALLOW_CUDA@" = " ON" ]; then
43
+ cuda_allowed=true
44
+ fi
45
+
46
+ if [ " @REQUIRE_CUDA@" = " ON" ]; then
47
+ cuda_allowed=true
48
+ if [ " $cuda_available " != true ]; then
49
+ echo " CUDA support is required but not available in the system (nvcc not found)"
50
+ exit 1
51
+ fi
52
+ fi
53
+
54
+ if [ " $cuda_allowed " == true ] && [ " $cuda_available " == true ]; then
37
55
echo " CUDA support enabled"
38
56
cuda_config_opts=" --config=cuda"
39
57
export TF_NEED_CUDA=1
You can’t perform that action at this time.
0 commit comments