From 860a4e2b6538a96415a4dfa6e1c2973a19eb37d9 Mon Sep 17 00:00:00 2001 From: Shanqing Cai Date: Wed, 19 Oct 2016 14:52:59 -0800 Subject: [PATCH] Relax assumption about CUDA library path On mac 64-bit, the library paths is actually at /usr/local/cuda/lib by default. The assumption that it is always at /usr/local/cuda/lib64 has led to build failures, e.g., http://ci.tensorflow.org/view/Nightly/job/nightly-matrix-mac-gpu/100/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-mac/console Change: 136653210 --- tensorflow/tools/ci_build/builds/test_user_ops.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tensorflow/tools/ci_build/builds/test_user_ops.sh b/tensorflow/tools/ci_build/builds/test_user_ops.sh index 4751157efee..216abbe8e67 100755 --- a/tensorflow/tools/ci_build/builds/test_user_ops.sh +++ b/tensorflow/tools/ci_build/builds/test_user_ops.sh @@ -184,11 +184,23 @@ else -I "${TF_INC}" -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC || \ die "nvcc compilation of ${OP_KERNEL_CC} FAILED" + CUDA_LIB_DIR="/usr/local/cuda/lib64" + if [[ ! -d "${CUDA_LIB_DIR}" ]]; then + CUDA_LIB_DIR="/usr/local/cuda/lib" + fi + if [[ ! -d "${CUDA_LIB_DIR}" ]]; then + die "ERROR: Failed to find CUDA library directory at either of " +"/usr/local/cuda/lib and /usr/local/cuda/lib64" + fi + + echo "Found CUDA library diretory at: ${CUDA_LIB_DIR}" + echo "" + # USER_OP_SO=$(basename $(echo "${OP_KERNEL_CC}" | sed -e 's/\.cc/\.so/')) USER_OP_SO="add_one.so" "${GPP_BIN}" -std=c++11 ${EXTRA_GPP_FLAGS} \ -shared -o "${USER_OP_SO}" "${OP_KERNEL_CC}" \ - "${OP_KERNEL_O}" -I "${TF_INC}" -L "/usr/local/cuda/lib64" \ + "${OP_KERNEL_O}" -I "${TF_INC}" -L "${CUDA_LIB_DIR}" \ -fPIC -lcudart || \ die "g++ compilation of ${OP_KERNEL_CC}" FAILED fi -- GitLab