From 1f88ec8eef88ec783a18a98816fbb15b21df6ee7 Mon Sep 17 00:00:00 2001 From: luke iwanski Date: Mon, 17 Oct 2016 21:14:25 +0100 Subject: [PATCH] Update to SYCL bazel toolchain. --- configure | 85 +++++++---- .../core/platform/default/build_config/BUILD | 16 ++ tensorflow/workspace.bzl | 3 + third_party/sycl/BUILD | 44 ------ third_party/sycl/crosstool/BUILD | 29 ---- third_party/sycl/crosstool/BUILD.tpl | 29 ++++ .../crosstool/{CROSSTOOL => CROSSTOOL.tpl} | 2 +- .../crosstool/{computecpp => computecpp.tpl} | 8 +- third_party/sycl/platform.bzl | 17 --- third_party/sycl/sycl/BUILD | 0 third_party/sycl/sycl/BUILD.tpl | 43 ++++++ .../build_defs.bzl.tpl} | 5 +- third_party/sycl/sycl/platform.bzl.tpl | 5 + third_party/sycl/sycl_config.sh | 143 ----------------- third_party/sycl/sycl_configure.bzl | 144 ++++++++++++++++++ tools/bazel.rc.template | 2 +- 16 files changed, 307 insertions(+), 268 deletions(-) mode change 100755 => 100644 third_party/sycl/BUILD mode change 100755 => 100644 third_party/sycl/crosstool/BUILD create mode 100755 third_party/sycl/crosstool/BUILD.tpl rename third_party/sycl/crosstool/{CROSSTOOL => CROSSTOOL.tpl} (97%) rename third_party/sycl/crosstool/{computecpp => computecpp.tpl} (93%) delete mode 100755 third_party/sycl/platform.bzl create mode 100644 third_party/sycl/sycl/BUILD create mode 100755 third_party/sycl/sycl/BUILD.tpl rename third_party/sycl/{build_defs.bzl => sycl/build_defs.bzl.tpl} (86%) create mode 100755 third_party/sycl/sycl/platform.bzl.tpl delete mode 100755 third_party/sycl/sycl_config.sh create mode 100644 third_party/sycl/sycl_configure.bzl diff --git a/configure b/configure index 08078d29d5c..759f317d0cb 100755 --- a/configure +++ b/configure @@ -365,17 +365,64 @@ fi # OpenCL configuration if [ "$TF_NEED_OPENCL" == "1" ]; then + +# Determine which C++ compiler should be used as the host compiler +while true; do + fromuser="" + if [ -z "$HOST_CXX_COMPILER" ]; then + default_cxx_host_compiler=$(which g++|| true) + read -p "Please specify which C++ compiler should be used as the host C++ compiler. [Default is $default_cxx_host_compiler]: " HOST_CXX_COMPILER + fromuser="1" + if [ -z "$HOST_CXX_COMPILER" ]; then + HOST_CXX_COMPILER=$default_cxx_host_compiler + fi + fi + if [ -e "$HOST_CXX_COMPILER" ]; then + export HOST_CXX_COMPILER + break + fi + echo "Invalid C++ compiler path. ${HOST_CXX_COMPILER} cannot be found" 1>&2 + if [ -z "$fromuser" ]; then + exit 1 + fi + HOST_CXX_COMPILER="" + # Retry +done + +# Determine which C compiler should be used as the host compiler +while true; do + fromuser="" + if [ -z "$HOST_C_COMPILER" ]; then + default_c_host_compiler=$(which gcc|| true) + read -p "Please specify which C compiler should be used as the host C compiler. [Default is $default_c_host_compiler]: " HOST_C_COMPILER + fromuser="1" + if [ -z "$HOST_C_COMPILER" ]; then + HOST_C_COMPILER=$default_c_host_compiler + fi + fi + if [ -e "$HOST_C_COMPILER" ]; then + export HOST_C_COMPILER + break + fi + echo "Invalid C compiler path. ${HOST_C_COMPILER} cannot be found" 1>&2 + if [ -z "$fromuser" ]; then + exit 1 + fi + HOST_C_COMPILER="" + # Retry +done + while true; do # Configure the OPENCL version to use. TF_OPENCL_VERSION="1.2" - # Point to ComputeCPP root - if [ -z "$COMPUTECPP_PATH" ]; then - default_computecpp_path=/usr/local/computecpp - read -p "Please specify the location where ComputeCPP $TF_OPENCL_VERSION is installed. Refer to README.md for more details. [Default is $default_computecpp_path]: " COMPUTECPP_PATH + # Point to ComputeCpp root + if [ -z "$COMPUTECPP_TOOLKIT_PATH" ]; then + default_computecpp_toolkit_path=/usr/local/computecpp + read -p "Please specify the location where ComputeCpp $TF_OPENCL_VERSION is installed. Refer to README.md for more details. [Default is $default_computecpp_toolkit_path]: " COMPUTECPP_TOOLKIT_PATH fromuser="1" - if [ -z "$COMPUTECPP_PATH" ]; then - COMPUTECPP_PATH=$default_computecpp_path + if [ -z "$COMPUTECPP_TOOLKIT_PATH" ]; then + COMPUTECPP_TOOLKIT_PATH=$default_computecpp_toolkit_path fi fi @@ -383,38 +430,20 @@ while true; do SYCL_RT_LIB_PATH="lib/libComputeCpp.so" fi - if [ -e "${COMPUTECPP_PATH}/${SYCL_RT_LIB_PATH}" ]; then + if [ -e "${COMPUTECPP_TOOLKIT_PATH}/${SYCL_RT_LIB_PATH}" ]; then + export COMPUTECPP_TOOLKIT_PATH break fi - echo "Invalid path to SYCL $TF_OPENCL_VERSION library. ${COMPUTECPP_PATH}/${SYCL_RT_LIB_PATH} cannot be found" + echo "Invalid SYCL $TF_OPENCL_VERSION library path. ${COMPUTECPP_TOOLKIT_PATH}/${SYCL_RT_LIB_PATH} cannot be found" if [ -z "$fromuser" ]; then exit 1 fi # Retry TF_OPENCL_VERSION="" - COMPUTECPP_PATH="" + COMPUTECPP_TOOLKIT_PATH="" done -cat > third_party/sycl/sycl.config <