Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the corresponding --action_env to .bazelrc from ./configure #8637

Merged
merged 1 commit into from Mar 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions configure
Expand Up @@ -38,7 +38,7 @@ function is_windows() {
fi
}

function bazel_clean_and_fetch() {
function bazel_fetch() {
if [ -z "$TF_BAZEL_TARGETS" ]; then
bazel fetch "//tensorflow/... -//tensorflow/contrib/nccl/... -//tensorflow/examples/android/..."
else
Expand Down Expand Up @@ -279,11 +279,17 @@ while [ "$TF_NEED_CUDA" == "" ]; do
esac
done

sed_hyphen_i -e "/--action_env TF_NEED_CUDA/d" .bazelrc
sed_hyphen_i -e "/--action_env CUD/d" .bazelrc
sed_hyphen_i -e "/--action_env GCC_HOST/d" .bazelrc
sed_hyphen_i -e "/--action_env TF_CUD/d" .bazelrc
echo "build --action_env TF_NEED_CUDA=$TF_NEED_CUDA" >>.bazelrc

export TF_NEED_CUDA
export TF_NEED_OPENCL
if [[ "$TF_NEED_CUDA" == "0" ]] && [[ "$TF_NEED_OPENCL" == "0" ]]; then
echo "Configuration finished"
bazel_clean_and_fetch
bazel_fetch
exit
fi

Expand All @@ -302,6 +308,7 @@ while ! is_windows && true; do
fi
if [ -e "$GCC_HOST_COMPILER_PATH" ]; then
export GCC_HOST_COMPILER_PATH
echo "build --action_env GCC_HOST_COMPILER_PATH=$GCC_HOST_COMPILER_PATH" >>.bazelrc
break
fi
echo "Invalid gcc path. ${GCC_HOST_COMPILER_PATH} cannot be found" 1>&2
Expand Down Expand Up @@ -352,7 +359,9 @@ while true; do

if [ -e "${CUDA_TOOLKIT_PATH}/${CUDA_RT_LIB_PATH}" ]; then
export CUDA_TOOLKIT_PATH
echo "build --action_env CUDA_TOOLKIT_PATH=$CUDA_TOOLKIT_PATH" >>.bazelrc
export TF_CUDA_VERSION
echo "build --action_env TF_CUDA_VERSION=$TF_CUDA_VERSION" >>.bazelrc
break
fi
echo "Invalid path to CUDA $TF_CUDA_VERSION toolkit. ${CUDA_TOOLKIT_PATH}/${CUDA_RT_LIB_PATH} cannot be found"
Expand Down Expand Up @@ -404,7 +413,9 @@ while true; do

if [ -e "$CUDNN_INSTALL_PATH/${CUDA_DNN_LIB_ALT_PATH}" -o -e "$CUDNN_INSTALL_PATH/${CUDA_DNN_LIB_PATH}" ]; then
export TF_CUDNN_VERSION
echo "build --action_env TF_CUDNN_VERSION=$TF_CUDNN_VERSION" >>.bazelrc
export CUDNN_INSTALL_PATH
echo "build --action_env CUDNN_INSTALL_PATH=$CUDNN_INSTALL_PATH" >>.bazelrc
break
fi

Expand All @@ -417,7 +428,9 @@ while true; do
CUDNN_PATH_FROM_LDCONFIG="$($LDCONFIG_BIN -p | sed -n 's/.*libcudnn.so .* => \(.*\)/\1/p')"
if [ -e "${CUDNN_PATH_FROM_LDCONFIG}${TF_CUDNN_EXT}" ]; then
export TF_CUDNN_VERSION
echo "build --action_env TF_CUDNN_VERSION=$TF_CUDNN_VERSION" >>.bazelrc
export CUDNN_INSTALL_PATH="$(dirname ${CUDNN_PATH_FROM_LDCONFIG})"
echo "build --action_env CUDNN_INSTALL_PATH=$CUDNN_INSTALL_PATH" >>.bazelrc
break
fi
fi
Expand Down Expand Up @@ -469,6 +482,7 @@ EOF
fi
else
export TF_CUDA_COMPUTE_CAPABILITIES
echo "build --action_env TF_CUDA_COMPUTE_CAPABILITIES=$TF_CUDA_COMPUTE_CAPABILITIES" >>.bazelrc
break
fi
TF_CUDA_COMPUTE_CAPABILITIES=""
Expand Down Expand Up @@ -572,6 +586,6 @@ done
# end of if "$TF_NEED_OPENCL" == "1"
fi

bazel_clean_and_fetch
bazel_fetch

echo "Configuration finished"