Skip to content

Commit d1ff47f

Browse files
andylou2tfx-copybara
authored andcommitted
Update tensorflow version to 2.2.0
PiperOrigin-RevId: 311369800
1 parent 6697973 commit d1ff47f

File tree

9 files changed

+119
-58
lines changed

9 files changed

+119
-58
lines changed

.bazelrc

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# This file is based on tensorflow's (v2.2.0) .bazelrc found here:
16+
# https://github.com/tensorflow/tensorflow/blob/v2.2.0/.bazelrc
17+
#
18+
# We need to provide this file because we need to be as close as possible to
19+
# Tensorflow's building environment.
20+
21+
# Sets the default Apple platform to macOS.
22+
build --apple_platform_type=macos
23+
24+
# Enable using platform specific build settings
25+
build --enable_platform_specific_config
26+
27+
# Flag to enable remote config
28+
common --experimental_repo_remote_exec
29+
30+
# Suppress C++ compiler warnings, otherwise build logs become 10s of MBs.
31+
build:linux --copt=-w
32+
build:macos --copt=-w
33+
34+
# By default, build TF in C++ 14 mode.
35+
build:linux --cxxopt=-std=c++14
36+
build:linux --host_cxxopt=-std=c++14
37+
build:macos --cxxopt=-std=c++14
38+
build:macos --host_cxxopt=-std=c++14
39+
40+
# Suppress all warning messages.
41+
build:short_logs --output_filter=DONT_MATCH_ANYTHING
42+
43+
44+

WORKSPACE

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ http_archive(
5858

5959
# LINT.IfChange(snappy_archive_version)
6060
http_archive(
61-
name = "snappy",
61+
name = "s2t_snappy",
6262
build_file = "//third_party:snappy.BUILD",
6363
sha256 = "16b677f07832a612b0836178db7f374e414f94657c138e6993cbfc5dcc58651f",
6464
strip_prefix = "snappy-1.1.8",
@@ -83,48 +83,22 @@ http_archive(
8383
# https://github.com/protocolbuffers/protobuf/tree/v3.8.0
8484
PROTOBUF_COMMIT="09745575a923640154bcf307fba8aedff47f240a"
8585

86-
# Needed by tf_py_wrap_cc rule from Tensorflow.
87-
# When upgrading tensorflow version, also check tensorflow/WORKSPACE for the
88-
# version of this -- keep in sync.
89-
# NOTE: tensorflow-serving uses:
90-
# = "2c62d8cd4ab1e65c08647eb4afe38f51591f43f7f0885e7769832fa137633dcb",
91-
92-
git_repository(
93-
name = "com_google_protobuf",
94-
commit = PROTOBUF_COMMIT,
95-
remote = "https://github.com/google/protobuf.git",
96-
shallow_since = "1558721209 -0700",
97-
)
98-
99-
86+
# This is needed by the version of tensorflow metadata we depend on.
87+
# TODO(andylou): remove this once com_github_tensorflow_metadata is updated.
10088
git_repository(
10189
name = "protobuf_archive",
10290
commit = PROTOBUF_COMMIT,
10391
remote = "https://github.com/google/protobuf.git",
10492
shallow_since = "1558721209 -0700",
10593
)
10694

107-
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
108-
109-
protobuf_deps()
110-
111-
112-
113-
# Fetch tf.Metadata repo from GitHub.
114-
git_repository(
115-
name = "com_github_tensorflow_metadata",
116-
commit = "8452a799153412972a4fbf00b9a019db23ef60f9",
117-
remote = "https://github.com/tensorflow/metadata.git",
118-
)
119-
120-
12195
#####################################################################################
12296

123-
_TENSORFLOW_GIT_COMMIT = "e5bf8de410005de06a7ff5393fafdf832ef1d4ad" # 2.1.0
97+
_TENSORFLOW_GIT_COMMIT = "2b96f3662bd776e277f86997659e61046b56c315" # 2.2.0
12498

12599
http_archive(
126100
name = "org_tensorflow",
127-
sha256 = "1f4b09e6bff7f847bb1034699076055e50e87534d76008af8295ed71195b2b36",
101+
sha256 = "b3d7829fac84e3a26264d84057367730b6b85b495a0fce15929568f4b55dc144",
128102
urls = [
129103
"https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT,
130104
"https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT,
@@ -135,7 +109,6 @@ http_archive(
135109
# START: Upstream TensorFlow dependencies
136110
# TensorFlow build depends on these dependencies.
137111
# Needs to be in-sync with TensorFlow sources.
138-
139112
http_archive(
140113
name = "io_bazel_rules_closure",
141114
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
@@ -145,23 +118,17 @@ http_archive(
145118
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13
146119
],
147120
)
148-
149-
http_archive(
150-
name = "bazel_skylib",
151-
sha256 = "1dde365491125a3db70731e25658dfdd3bc5dbdfd11b840b3e987ecf043c7ca0",
152-
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel-skylib.0.9.0.tar.gz"],
153-
) # https://github.com/bazelbuild/bazel-skylib/releases
154-
155121
# END: Upstream TensorFlow dependencies
156122

157-
158123
# Please add all new TensorFlow struct2tensor dependencies in workspace.bzl.
159124
load("//struct2tensor:workspace.bzl", "struct2tensor_workspace")
160-
161125
struct2tensor_workspace()
162126

127+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
128+
protobuf_deps()
129+
163130
# Specify the minimum required bazel version.
164131
load("@org_tensorflow//tensorflow:version_check.bzl", "check_bazel_version_at_least")
165132

166-
check_bazel_version_at_least("0.24.1")
133+
check_bazel_version_at_least("2.0.0")
167134

configure.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ else
5353
fi
5454
fi
5555

56-
57-
# Remove .bazelrc if it already exist
58-
rm -f .bazelrc
59-
6056
ensure_tensorflow
6157
TF_CFLAGS=( $(${PYTHON_BIN_PATH} -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') )
6258
TF_LFLAGS="$(${PYTHON_BIN_PATH} -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))')"

struct2tensor/BUILD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ s2t_pytype_library(
6464
":path",
6565
"//struct2tensor/ops:struct2tensor_ops",
6666
"//struct2tensor/proto:query_metadata_py_pb2",
67-
"@protobuf_archive//:protobuf_python",
67+
"@com_google_protobuf//:protobuf_python",
6868
],
6969
)
7070

@@ -110,7 +110,7 @@ s2t_pytype_library(
110110
":path",
111111
":prensor",
112112
"//struct2tensor/ops:struct2tensor_ops",
113-
"@protobuf_archive//:protobuf_python",
113+
"@com_google_protobuf//:protobuf_python",
114114
],
115115
)
116116

@@ -168,6 +168,6 @@ s2t_pytype_library(
168168
deps = [
169169
":expression",
170170
"//struct2tensor/test:test_py_pb2",
171-
"@protobuf_archive//:protobuf_python",
171+
"@com_google_protobuf//:protobuf_python",
172172
],
173173
)

struct2tensor/kernels/BUILD

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ cc_library(
5353
"@com_google_absl//absl/base:core_headers",
5454
"@com_google_absl//absl/flags:flag",
5555
"@com_google_absl//absl/memory",
56+
"@com_google_protobuf//:cc_wkt_protos",
57+
"@com_google_protobuf//:protobuf",
58+
"@com_google_protobuf//:protobuf_lite",
5659
"@org_tensorflow//tensorflow/core:framework",
5760
"@org_tensorflow//tensorflow/core:framework_lite",
5861
"@org_tensorflow//tensorflow/core:lib",
5962
"@org_tensorflow//tensorflow/core/util/proto:descriptors",
60-
"@protobuf_archive//:cc_wkt_protos",
61-
"@protobuf_archive//:protobuf",
62-
"@protobuf_archive//:protobuf_lite",
6363
],
6464
alwayslink = 1,
6565
)
@@ -91,10 +91,10 @@ cc_library(
9191
"@com_google_absl//absl/container:flat_hash_map",
9292
"@com_google_absl//absl/strings",
9393
"@com_google_absl//absl/types:span",
94+
"@com_google_protobuf//:cc_wkt_protos",
95+
"@com_google_protobuf//:protobuf",
9496
"@org_tensorflow//tensorflow/core:framework",
9597
"@org_tensorflow//tensorflow/core:lib",
96-
"@protobuf_archive//:cc_wkt_protos",
97-
"@protobuf_archive//:protobuf",
9898
],
9999
alwayslink = 1,
100100
)
@@ -163,9 +163,9 @@ cc_library(
163163
"@com_google_absl//absl/base:core_headers",
164164
"@com_google_absl//absl/base:endian",
165165
"@com_google_absl//absl/strings",
166+
"@com_google_protobuf//:protobuf",
166167
"@org_tensorflow//tensorflow/core:framework",
167168
"@org_tensorflow//tensorflow/core:framework_lite",
168169
"@org_tensorflow//tensorflow/core:lib",
169-
"@protobuf_archive//:protobuf",
170170
],
171171
)

struct2tensor/ops/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ s2t_pytype_library(
5858
":gen_equi_join_indices_py",
5959
":gen_run_length_before_py",
6060
"//struct2tensor:path",
61-
"@protobuf_archive//:protobuf_python",
61+
"@com_google_protobuf//:protobuf_python",
6262
],
6363
)
6464

@@ -67,7 +67,7 @@ s2t_pytype_library(
6767
srcs = ["file_descriptor_set.py"],
6868
deps = [
6969
"//struct2tensor:path",
70-
"@protobuf_archive//:protobuf_python",
70+
"@com_google_protobuf//:protobuf_python",
7171
],
7272
)
7373

struct2tensor/workspace.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ def struct2tensor_workspace():
3232
name = "com_github_tensorflow_metadata",
3333
commit = "8452a799153412972a4fbf00b9a019db23ef60f9",
3434
remote = "https://github.com/tensorflow/metadata.git",
35+
shallow_since = "1550110183 -0800",
3536
)

third_party/arrow.BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ cc_library(
141141
deps = [
142142
":arrow_format",
143143
":xxhash",
144-
"@snappy",
144+
"@s2t_snappy//:snappy",
145145
"@struct2tensor//third_party:parquet_types_h",
146146
"@thrift",
147147
],

third_party/snappy.BUILD

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,59 @@ cc_library(
4040
includes = ["."],
4141
)
4242

43+
genrule(
44+
name = "config_h",
45+
outs = ["config.h"],
46+
cmd = "\n".join([
47+
"cat <<'EOF' >$@",
48+
"#define HAVE_STDDEF_H 1",
49+
"#define HAVE_STDINT_H 1",
50+
"",
51+
"#ifdef __has_builtin",
52+
"# if !defined(HAVE_BUILTIN_EXPECT) && __has_builtin(__builtin_expect)",
53+
"# define HAVE_BUILTIN_EXPECT 1",
54+
"# endif",
55+
"# if !defined(HAVE_BUILTIN_CTZ) && __has_builtin(__builtin_ctzll)",
56+
"# define HAVE_BUILTIN_CTZ 1",
57+
"# endif",
58+
"#elif defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)",
59+
"# ifndef HAVE_BUILTIN_EXPECT",
60+
"# define HAVE_BUILTIN_EXPECT 1",
61+
"# endif",
62+
"# ifndef HAVE_BUILTIN_CTZ",
63+
"# define HAVE_BUILTIN_CTZ 1",
64+
"# endif",
65+
"#endif",
66+
"",
67+
"#ifdef __has_include",
68+
"# if !defined(HAVE_BYTESWAP_H) && __has_include(<byteswap.h>)",
69+
"# define HAVE_BYTESWAP_H 1",
70+
"# endif",
71+
"# if !defined(HAVE_UNISTD_H) && __has_include(<unistd.h>)",
72+
"# define HAVE_UNISTD_H 1",
73+
"# endif",
74+
"# if !defined(HAVE_SYS_ENDIAN_H) && __has_include(<sys/endian.h>)",
75+
"# define HAVE_SYS_ENDIAN_H 1",
76+
"# endif",
77+
"# if !defined(HAVE_SYS_MMAN_H) && __has_include(<sys/mman.h>)",
78+
"# define HAVE_SYS_MMAN_H 1",
79+
"# endif",
80+
"# if !defined(HAVE_SYS_UIO_H) && __has_include(<sys/uio.h>)",
81+
"# define HAVE_SYS_UIO_H 1",
82+
"# endif",
83+
"#endif",
84+
"",
85+
"#ifndef SNAPPY_IS_BIG_ENDIAN",
86+
"# ifdef __s390x__",
87+
"# define SNAPPY_IS_BIG_ENDIAN 1",
88+
"# elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__",
89+
"# define SNAPPY_IS_BIG_ENDIAN 1",
90+
"# endif",
91+
"#endif",
92+
"EOF",
93+
]),
94+
)
95+
4396
# LINT.IfChange(snappy_gen_version)
4497
genrule(
4598
name = "snappy_stubs_public_h",

0 commit comments

Comments
 (0)