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

[TF] Added build with GPU support but default is to build without GPU #7617

Merged
merged 7 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions tensorflow-requires.file
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ Requires: py3-cython py3-protobuf py3-astor py3-six py3-termcolor py3-absl-py
Requires: py3-opt-einsum py3-flatbuffers
Requires: eigen protobuf zlib libpng libjpeg-turbo curl giflib sqlite grpc flatbuffers py3-pybind11
BuildRequires: py3-wheel
%define enable_gpu 0
%if %{enable_gpu}
%if "%{cmsos}" != "slc7_aarch64"
## INCLUDE cuda-flags
Requires: cuda cudnn
%else
%define enable_gpu 0
%endif
%endif
16 changes: 13 additions & 3 deletions tensorflow-sources.file
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BuildRequires: bazel java-env git
## INCLUDE tensorflow-requires
## INCLUDE compilation_flags

%define tag 719e00b6f9553de2662b6df2c353d6934e941103
%define tag 399b0f02cae076845ca000dffdcbaa2274303dd0
%define branch cms/v%{realversion}
%define github_user cms-externals
Source: git+https://github.com/%{github_user}/tensorflow.git?obj=%{branch}/%{tag}&export=tensorflow-%{realversion}&output=/tensorflow-%{realversion}.tgz
Expand Down Expand Up @@ -40,15 +40,25 @@ BAZEL_OPTS="$BAZEL_OPTS $(echo %{arch_build_flags} | tr ' ' '\n' | grep -v '^$'
BAZEL_OPTS="$BAZEL_OPTS --copt=-mcpu=native --copt=-mtune=native"
%endif
%endif
BAZEL_OPTS="$BAZEL_OPTS --config=%{build_type} --cxxopt=-std=c++17 %{makeprocesses}"
BAZEL_OPTS="$BAZEL_OPTS --config=%{build_type} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 %{makeprocesses}"
BAZEL_OPTS="$BAZEL_OPTS --config=noaws --config=nogcp --config=nohdfs --config=nonccl"

%if %{enable_gpu}
BAZEL_OPTS="$BAZEL_OPTS --config=cuda"
export GCC_HOST_COMPILER_PREFIX=${GCC_ROOT}/bin
export GCC_HOST_COMPILER_PATH=$(which gcc)
export TF_CUDA_COMPUTE_CAPABILITIES=$(echo "compute_%{cuda_arch}" | sed 's|\s\s*|,compute_|g')
export TF_CUDA_VERSION="$(echo ${CUDA_VERSION} | cut -f1,2 -d.)"
export TF_CUDA_PATHS="${CUDA_ROOT},${CUDNN_ROOT}"
export TF_CUDA_CLANG=0
export cuda=Y
%endif
export TF_NEED_CUDA=%{enable_gpu}
export TF_NEED_JEMALLOC=0
export TF_NEED_HDFS=0
export TF_NEED_GCP=0
export TF_ENABLE_XLA=0
export TF_NEED_OPENCL=0
export TF_NEED_CUDA=0
export TF_NEED_VERBS=0
export TF_NEED_MKL=0
export TF_NEED_MPI=0
Expand Down