From e2b2c29a5a2fcfe729242201e3c7fa75a866ab58 Mon Sep 17 00:00:00 2001 From: Amit Patankar Date: Tue, 8 Sep 2020 08:48:47 -0700 Subject: [PATCH] Adding `host_*` compiler flags to the presubmit builds for Linux. PiperOrigin-RevId: 330517240 Change-Id: I4fed2c12e11805060dcb4e505632c255ceff03f1 --- .bazelrc | 7 +++++++ .../ci_build/presubmit/ubuntu_16/cpu_py36_full/build.sh | 6 +++++- .../ci_build/presubmit/ubuntu_16/gpu_py36_full/build.sh | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index a745adf7dd8..e5e1c082d39 100644 --- a/.bazelrc +++ b/.bazelrc @@ -294,6 +294,7 @@ build:ios --noenable_platform_specific_config build:android --copt=-w build:ios --copt=-w build:linux --copt=-w +build:linux --host_copt=-w build:macos --copt=-w build:windows --copt=/w @@ -359,6 +360,7 @@ build --config=short_logs # TODO(gunan): Create a feature in toolchains for avx/avx2 to # avoid having to define linux/win separately. build:avx_linux --copt=-mavx +build:avx_linux --host_copt=-mavx build:avx2_linux --copt=-mavx2 build:native_arch_linux --copt=-march=native build:avx_win --copt=/arch=AVX @@ -412,9 +414,12 @@ build:rbe_linux --config=avx_linux build:rbe_linux --config=short_logs # TODO(gunan): Check why we need this specified in rbe, but not in other builds. build:rbe_linux --linkopt=-lrt +build:rbe_linux --host_linkopt=-lrt build:rbe_linux --linkopt=-lm +build:rbe_linux --host_linkopt=-lm build:rbe_cpu_linux --config=rbe_linux +build:rbe_cpu_linux --host_crosstool_top="//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010:toolchain" build:rbe_cpu_linux --crosstool_top="//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010:toolchain" build:rbe_cpu_linux --extra_toolchains="//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010:cc-toolchain-k8" build:rbe_cpu_linux --extra_execution_platforms="@ubuntu16.04-manylinux2010-py3_config_platform//:platform" @@ -432,6 +437,7 @@ test:rbe_linux_cuda_base --test_env=LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/ build:rbe_linux_cuda10.1_nvcc_base --config=rbe_linux_cuda_base build:rbe_linux_cuda10.1_nvcc_base --define=using_cuda_nvcc=true +build:rbe_linux_cuda10.1_nvcc_base --host_crosstool_top="@ubuntu18.04-gcc7_manylinux2010-cuda10.1-cudnn7-tensorrt6.0_config_cuda//crosstool:toolchain" build:rbe_linux_cuda10.1_nvcc_base --crosstool_top="@ubuntu18.04-gcc7_manylinux2010-cuda10.1-cudnn7-tensorrt6.0_config_cuda//crosstool:toolchain" build:rbe_linux_cuda10.1_nvcc_base --extra_toolchains="@ubuntu18.04-gcc7_manylinux2010-cuda10.1-cudnn7-tensorrt6.0_config_cuda//crosstool:toolchain-linux-x86_64" build:rbe_linux_cuda10.1_nvcc_base --extra_execution_platforms="@ubuntu18.04-gcc7_manylinux2010-cuda10.1-cudnn7-tensorrt6.0_config_platform//:platform" @@ -448,6 +454,7 @@ build:rbe_linux_cuda10.1_nvcc_py3.8 --config=rbe_linux_cuda10.1_nvcc_base --repo build:rbe_linux_cuda11.0_nvcc_base --config=rbe_linux_cuda_base build:rbe_linux_cuda11.0_nvcc_base --define=using_cuda_nvcc=true +build:rbe_linux_cuda11.0_nvcc_base --host_crosstool_top="@ubuntu18.04-gcc7_manylinux2010-cuda11.0-cudnn8-tensorrt7.1_config_cuda//crosstool:toolchain" build:rbe_linux_cuda11.0_nvcc_base --crosstool_top="@ubuntu18.04-gcc7_manylinux2010-cuda11.0-cudnn8-tensorrt7.1_config_cuda//crosstool:toolchain" build:rbe_linux_cuda11.0_nvcc_base --extra_toolchains="@ubuntu18.04-gcc7_manylinux2010-cuda11.0-cudnn8-tensorrt7.1_config_cuda//crosstool:toolchain-linux-x86_64" build:rbe_linux_cuda11.0_nvcc_base --extra_execution_platforms="@ubuntu18.04-gcc7_manylinux2010-cuda11.0-cudnn8-tensorrt7.1_config_platform//:platform" diff --git a/tensorflow/tools/ci_build/presubmit/ubuntu_16/cpu_py36_full/build.sh b/tensorflow/tools/ci_build/presubmit/ubuntu_16/cpu_py36_full/build.sh index bde3c3d55e3..2be1dbc3948 100644 --- a/tensorflow/tools/ci_build/presubmit/ubuntu_16/cpu_py36_full/build.sh +++ b/tensorflow/tools/ci_build/presubmit/ubuntu_16/cpu_py36_full/build.sh @@ -65,11 +65,15 @@ function run_build () { --define=framework_shared_object=true \ --define=with_xla_support=true \ -c opt \ + --host_copt="-w" \ --copt="-w" \ + --host_copt=-mavx \ --copt=-mavx \ + --host_linkopt=-lrt \ --linkopt=-lrt \ --distinct_host_configuration=false \ - --remote_default_exec_properties=build=${CACHE_SILO_VAL} \ + --remote_default_platform_properties="properties:{name:\"build\" value:\"${CACHE_SILO_VAL}\"}" \ + --host_crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010:toolchain \ --crosstool_top=//third_party/toolchains/preconfig/ubuntu16.04/gcc7_manylinux2010:toolchain \ --host_javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.1:jdk8 \ --javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.1:jdk8 \ diff --git a/tensorflow/tools/ci_build/presubmit/ubuntu_16/gpu_py36_full/build.sh b/tensorflow/tools/ci_build/presubmit/ubuntu_16/gpu_py36_full/build.sh index a27cc881f41..dd461b7578f 100644 --- a/tensorflow/tools/ci_build/presubmit/ubuntu_16/gpu_py36_full/build.sh +++ b/tensorflow/tools/ci_build/presubmit/ubuntu_16/gpu_py36_full/build.sh @@ -94,12 +94,17 @@ function run_build () { --define=allow_oversize_protos=true \ --define=grpc_no_ares=true \ -c opt \ + --host_copt="-w" \ --copt="-w" \ + --host_copt=-mavx \ --copt=-mavx \ + --host_linkopt=-lrt \ --linkopt=-lrt \ + --host_linkopt=-lm \ --linkopt=-lm \ --distinct_host_configuration=false \ --remote_default_exec_properties=build=${CACHE_SILO_VAL} \ + --host_crosstool_top="${TF_CUDA_CONFIG_REPO}//crosstool:toolchain" \ --crosstool_top="${TF_CUDA_CONFIG_REPO}//crosstool:toolchain" \ --host_javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.1:jdk8 \ --javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:jdk8 \