@@ -7,19 +7,17 @@ function version_gt {
77}
88
99# configure environmental variables
10- export CC_OPT_FLAGS=${CC_OPT_FLAGS:- " -march=ivybridge " }
10+ export CC_OPT_FLAGS=${CC_OPT_FLAGS:- " -march=haswell " }
1111export TF_NEED_GCP=${TF_NEED_GCP:- 0}
1212export TF_NEED_HDFS=${TF_NEED_HDFS:- 0}
1313export TF_NEED_OPENCL=${TF_NEED_OPENCL:- 0}
14- export TF_NEED_OPENCL_SYCL=${TF_NEED_OPENCL_SYCL:- 0}
1514export TF_NEED_TENSORRT=${TF_NEED_TENSORRT:- 0}
1615export TF_NEED_NGRAPH=${TF_NEED_NGRAPH:- 0}
1716export TF_NEED_JEMALLOC=${TF_NEED_JEMALLOC:- 1}
1817export TF_NEED_VERBS=${TF_NEED_VERBS:- 0}
1918export TF_NEED_MKL=${TF_NEED_MKL:- 1}
2019export TF_DOWNLOAD_MKL=${TF_DOWNLOAD_MKL:- 1}
2120export TF_NEED_MPI=${TF_NEED_MPI:- 0}
22- export TF_ENABLE_XLA=${TF_ENABLE_XLA:- 1}
2321export TF_NEED_AWS=${TF_NEED_AWS:- 0}
2422export TF_NEED_GDR=${TF_NEED_GDR:- 0}
2523export TF_CUDA_CLANG=${TF_CUDA_CLANG:- 0}
@@ -58,12 +56,14 @@ if [ "$cuda_allowed" == true ] && [ "$cuda_available" == true ]; then
5856 export TF_CUDA_COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES:- " 3.5,7.0" } # default from configure.py
5957 export TF_CUDA_PATHS=${TF_CUDA_PATHS:- " /opt/cuda,/usr/local/cuda,/usr/local,/usr/cuda,/usr" }
6058 export TF_CUDA_VERSION=" $( nvcc --version | sed -n ' s/^.*release \(.*\),.*/\1/p' ) "
61- export TF_NCCL_VERSION=" $( find /opt /usr -name ' libnccl.so.*' | tail -n1 | sed -r ' s/^.*\.so\.//' ) "
62- export TF_CUDNN_VERSION=" $( find /opt /usr -name ' libcudnn.so.*' | tail -n1 | sed -r ' s/^.*\.so\.//' ) "
59+ export TF_NCCL_VERSION=" $( find /opt /usr -name ' libnccl.so.*' -path ' */cuda* ' | tail -n1 | sed -r ' s/^.*\.so\.//' ) "
60+ export TF_CUDNN_VERSION=" $( find /opt /usr -name ' libcudnn.so.*' -path ' */cuda* ' | tail -n1 | sed -r ' s/^.*\.so\.//' ) "
6361
6462 # choose the right version of CUDA compiler
6563 if [ -z " $GCC_HOST_COMPILER_PATH " ]; then
66- if hash gcc-9 2> /dev/null && version_gt 9.4 ` gcc-9 -dumpversion` ; then
64+ if hash gcc-10 2> /dev/null && version_gt 10.3 ` gcc-10 -dumpversion` ; then
65+ export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:- " /usr/bin/gcc-10" }
66+ elif hash gcc-9 2> /dev/null && version_gt 9.4 ` gcc-9 -dumpversion` ; then
6767 export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:- " /usr/bin/gcc-9" }
6868 elif hash gcc-8 2> /dev/null && version_gt 8.5 ` gcc-8 -dumpversion` ; then
6969 export GCC_HOST_COMPILER_PATH=${GCC_HOST_COMPILER_PATH:- " /usr/bin/gcc-8" }
9393 export TF_NEED_CUDA=0
9494fi
9595
96+ # set bazel options for c++17 standard if necessary
97+ cxx_std_opts=" "
98+ if [ " @CMAKE_CXX_STANDARD@" == 17 ]; then
99+ echo " Using C++17 standard"
100+ cxx_std_opts=" --config=c++17_gcc"
101+ fi
102+
96103# configure and build
97104./configure
98- bazel build --config=opt \
105+ JVM_RAM_RESOURCES=$(( @LOCAL_RAM_RESOURCES@ / 4 ))
106+ JVM_RAM_RESOURCES=$(( ${JVM_RAM_RESOURCES} < 1024 ? 1024 : ${JVM_RAM_RESOURCES} ))
107+ bazel --host_jvm_args=" -Xmx${JVM_RAM_RESOURCES} m" \
108+ build --config=opt \
99109 --config=monolithic \
110+ --local_ram_resources=@LOCAL_RAM_RESOURCES@ \
111+ --local_cpu_resources=@LOCAL_CPU_RESOURCES@ \
112+ --discard_analysis_cache \
113+ $cxx_std_opts \
100114 $cuda_config_opts \
101115 tensorflow:libtensorflow_cc.so \
102116 tensorflow:install_headers
0 commit comments