Skip to content

Commit

Permalink
Merge pull request #7617 from cms-sw/tf-gpu-260
Browse files Browse the repository at this point in the history
[TF] Added build with GPU support but default is to build without GPU
  • Loading branch information
smuzaffar authored Feb 23, 2022
2 parents e09d7fc + a907ab6 commit d2d1a65
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
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

0 comments on commit d2d1a65

Please sign in to comment.