@@ -28,48 +28,25 @@ export TF_NEED_KAFKA=${TF_NEED_KAFKA:-0}
2828export TF_DOWNLOAD_CLANG=${TF_DOWNLOAD_CLANG:- 0}
2929export TF_NEED_IGNITE=${TF_NEED_IGNITE:- 0}
3030export TF_NEED_ROCM=${TF_NEED_ROCM:- 0}
31- export TF_NCCL_VERSION=${TF_NCCL_VERSION:- 2.3} # _DEFAULT_NCCL_VERSION from configure.py
3231export NCCL_INSTALL_PATH=${NCCL_INSTALL_PATH:-/ usr}
3332export PYTHON_BIN_PATH=${PYTHON_BIN_PATH:- " $( which python3) " }
3433export PYTHON_LIB_PATH=" $( $PYTHON_BIN_PATH -c ' import site; print(site.getsitepackages()[0])' ) "
3534
36- # configure cuda environmental variables
37-
38- if [ -e /opt/cuda ]; then
39- echo " Using CUDA from /opt/cuda"
40- export CUDA_TOOLKIT_PATH=/opt/cuda
41- elif [ -e /usr/local/cuda ]; then
42- echo " Using CUDA from /usr/local/cuda"
43- export CUDA_TOOLKIT_PATH=/usr/local/cuda
44- fi
45-
46- if [ -e /opt/cuda/include/cudnn.h ]; then
47- echo " Using CUDNN from /opt/cuda"
48- export CUDNN_INSTALL_PATH=/opt/cuda
49- elif [ -e /usr/local/cuda/include/cudnn.h ]; then
50- echo " Using CUDNN from /usr/local/cuda"
51- export CUDNN_INSTALL_PATH=/usr/local/cuda
52- elif [ -e /usr/include/cudnn.h ]; then
53- echo " Using CUDNN from /usr"
54- export CUDNN_INSTALL_PATH=/usr
55- fi
56-
57- if [ " @ALLOW_CUDA@" = " ON" ] && [ -n " ${CUDA_TOOLKIT_PATH} " ]; then
58- if [[ -z " ${CUDNN_INSTALL_PATH} " ]]; then
59- echo " CUDA found but no cudnn.h found. Please install cuDNN."
60- exit 1
61- fi
35+ # check if cuda support requested and supported
36+ if [ " @ALLOW_CUDA@" = " ON" ] && hash nvcc 2> /dev/null; then
6237 echo " CUDA support enabled"
6338 cuda_config_opts=" --config=cuda"
6439 export TF_NEED_CUDA=1
6540 export TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES:- " 3.5,7.0" } # default from configure.py
66- export TF_CUDA_VERSION=" $( $CUDA_TOOLKIT_PATH /bin/nvcc --version | sed -n ' s/^.*release \(.*\),.*/\1/p' ) "
67- export TF_CUDNN_VERSION=" $( sed -n ' s/^#define CUDNN_MAJOR\s*\(.*\).*/\1/p' $CUDNN_INSTALL_PATH /include/cudnn.h) "
41+ export TF_CUDA_PATHS=${TF_CUDA_PATHS:- " /opt/cuda,/usr/local/cuda,/usr/local,/usr/cuda,/usr" }
42+ export TF_CUDA_VERSION=" $( nvcc --version | sed -n ' s/^.*release \(.*\),.*/\1/p' ) "
43+ export TF_NCCL_VERSION=" $( find / -name ' libnccl.so.*' | tail -n1 | sed -r ' s/^.*\.so\.//' ) "
44+ export TF_CUDNN_VERSION=" $( find / -name ' libcudnn.so.*' | tail -n1 | sed -r ' s/^.*\.so\.//' ) "
6845
6946 # choose the right version of CUDA compiler
7047 if [ -z " $GCC_HOST_COMPILER_PATH " ]; then
71- if hash gcc 2> /dev/null && version_gt 8.5 ` gcc -dumpversion` ; then
72- export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:- " /usr/bin/gcc" }
48+ if hash gcc-8 2> /dev/null && version_gt 8.5 ` gcc-8 -dumpversion` ; then
49+ export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:- " /usr/bin/gcc-8 " }
7350 elif hash gcc-7 2> /dev/null && version_gt 7.5 ` gcc-7 -dumpversion` ; then
7451 export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:- " /usr/bin/gcc-7" }
7552 elif hash gcc-6 2> /dev/null && version_gt 6.4 ` gcc-6 -dumpversion` ; then
0 commit comments