Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9c7aa7

Browse files
buchgrtensorflower-gardener
authored andcommitted
Roll out remote config for Python 3.7 on Windows RBE
PiperOrigin-RevId: 296949118 Change-Id: I9881ad0c76cc1095955e643096143ecc206fccf6
1 parent 50e990e commit e9c7aa7

8 files changed

Lines changed: 58 additions & 16 deletions

File tree

.bazelrc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,7 @@ build:rbe_win --define=override_eigen_strong_inline=true
406406
build:rbe_win --jobs=500
407407

408408
build:rbe_win_py37 --config=rbe
409-
build:rbe_win_py37 --repo_env=PYTHON_BIN_PATH=C:\\Python37\\python.exe
410-
build:rbe_win_py37 --repo_env=PYTHON_LIB_PATH=C:\\Python37\\lib\\site-packages
411-
build:rbe_win_py37 --repo_env=TF_PYTHON_CONFIG_REPO=@org_tensorflow//third_party/toolchains/preconfig/win_1803/py37
409+
build:rbe_win_py37 --repo_env=TF_PYTHON_CONFIG_REPO="@windows_py37_config_python"
412410
build:rbe_win_py37 --python_path=C:\\Python37\\python.exe
413411

414412
build:rbe_win_py38 --config=rbe

third_party/remote_config/BUILD.tpl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ platform(
22
name = "platform",
33
constraint_values = [
44
"@bazel_tools//platforms:x86_64",
5-
"@bazel_tools//platforms:linux",
5+
"@bazel_tools//platforms:%{platform}",
66
],
7-
exec_properties = {
8-
"container-image": "%{container_image}",
9-
"Pool": "default",
10-
},
7+
exec_properties = %{exec_properties},
118
)

third_party/remote_config/common.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def which(repository_ctx, program_name):
2424
if is_windows(repository_ctx):
2525
if not program_name.endswith(".exe"):
2626
program_name = program_name + ".exe"
27-
result = execute(repository_ctx, ["where.exe", program_name])
27+
result = execute(repository_ctx, ["C:\\Windows\\System32\\where.exe", program_name])
2828
else:
2929
result = execute(repository_ctx, ["which", program_name])
3030
return result.stdout.rstrip()
@@ -90,7 +90,7 @@ def read_dir(repository_ctx, src_dir):
9090
src_dir = src_dir.replace("/", "\\")
9191
find_result = execute(
9292
repository_ctx,
93-
["cmd.exe", "/c", "dir", src_dir, "/b", "/s", "/a-d"],
93+
["C:\\Windows\\System32\\cmd.exe", "/c", "dir", src_dir, "/b", "/s", "/a-d"],
9494
empty_stdout_fine = True,
9595
)
9696

@@ -121,7 +121,7 @@ def get_environ(repository_ctx, name, default_value = None):
121121
if is_windows(repository_ctx):
122122
result = execute(
123123
repository_ctx,
124-
["cmd.exe", "/c", "echo", "%" + name + "%"],
124+
["C:\\Windows\\System32\\cmd.exe", "/c", "echo", "%" + name + "%"],
125125
empty_stdout_fine = True,
126126
)
127127
else:
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
"""Repository rule to create a platform for a docker image to be used with RBE."""
22

33
def _remote_platform_configure_impl(repository_ctx):
4+
platform = repository_ctx.attr.platform
5+
exec_properties = repository_ctx.attr.platform_exec_properties
6+
7+
serialized_exec_properties = "{"
8+
for k, v in exec_properties.items():
9+
serialized_exec_properties += "\"%s\" : \"%s\"," % (k, v)
10+
serialized_exec_properties += "}"
11+
412
repository_ctx.template(
513
"BUILD",
614
Label("@org_tensorflow//third_party/remote_config:BUILD.tpl"),
715
{
8-
"%{container_image}": repository_ctx.attr.container_image,
16+
"%{platform}": platform,
17+
"%{exec_properties}": serialized_exec_properties,
918
},
1019
)
1120

1221
remote_platform_configure = repository_rule(
1322
implementation = _remote_platform_configure_impl,
1423
attrs = {
15-
"container_image": attr.string(mandatory = True),
24+
"platform_exec_properties": attr.string_dict(mandatory = True),
25+
"platform": attr.string(default = "linux", values = ["linux", "windows"]),
1626
},
1727
)

third_party/toolchains/preconfig/generate/containers.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ container_digests = {
1010
"cuda10.0-cudnn7-ubuntu16.04-manylinux2010": "sha256:5812d9d0ef0a3276fc5faaf4cd01f3d6e03d635893a6e2d2e04f6f01d626c432",
1111
"cuda10.1-cudnn7-ubuntu16.04-manylinux2010": "sha256:23db3de806535c9d26170567ba55cf653e503057345a0e9c129124c08ea118a3",
1212
"rocm-ubuntu16.04": "sha256:e645447dd6127325f3e97b8bf23424f637a8579d963b34fcc6772cf7cfaa0ebe",
13+
"windows-1803": "sha256:f109576c7c0c8a1783ff22b666e8923b52dbbe7933f69a1c7a7275202c304a12",
1314
}

third_party/toolchains/remote_config/configs.bzl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Configurations of RBE builds used with remote config."""
22

3-
load("//third_party/toolchains/remote_config:rbe_config.bzl", "tensorflow_rbe_config")
3+
load("//third_party/toolchains/remote_config:rbe_config.bzl", "tensorflow_rbe_config", "tensorflow_rbe_win_config")
44

55
def initialize_rbe_configs():
66
tensorflow_rbe_config(
@@ -29,3 +29,8 @@ def initialize_rbe_configs():
2929
python_version = "3",
3030
rocm_version = "2.5", # Any version will do.
3131
)
32+
33+
tensorflow_rbe_win_config(
34+
name = "windows_py37",
35+
python_bin_path = "C:/Python37/python.exe",
36+
)

third_party/toolchains/remote_config/containers.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@ containers = {
2323
"repository": "tensorflow-testing/nosla-rocm-ubuntu16.04",
2424
"digest": container_digests["rocm-ubuntu16.04"],
2525
},
26+
"windows-1803": {
27+
"registry": "gcr.io",
28+
"repository": "tensorflow-testing/tf-win-rbe",
29+
"digest": container_digests["windows-1803"],
30+
},
2631
}

third_party/toolchains/remote_config/rbe_config.bzl

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def _tensorflow_rbe_config(name, compiler, python_version, os, rocm_version = No
6161

6262
remote_platform_configure(
6363
name = "%s_config_platform" % name,
64-
container_image = container_image,
64+
platform = "linux",
65+
platform_exec_properties = exec_properties,
6566
)
6667

6768
remote_python_configure(
@@ -104,7 +105,8 @@ def _tensorflow_rbe_config(name, compiler, python_version, os, rocm_version = No
104105

105106
remote_platform_configure(
106107
name = "%s_config_platform" % name,
107-
container_image = container_image,
108+
platform = "linux",
109+
platform_exec_properties = exec_properties,
108110
)
109111

110112
remote_python_configure(
@@ -133,4 +135,28 @@ def _tensorflow_rbe_config(name, compiler, python_version, os, rocm_version = No
133135
else:
134136
fail("Neither cuda_version, rocm_version nor python_version specified.")
135137

138+
def _tensorflow_rbe_win_config(name, python_bin_path, container_name = "windows-1803"):
139+
container_image = _container_image_uri(container_name)
140+
exec_properties = {
141+
"container-image": container_image,
142+
"OSFamily": "Windows",
143+
}
144+
145+
env = {
146+
"PYTHON_BIN_PATH": python_bin_path,
147+
}
148+
149+
remote_platform_configure(
150+
name = "%s_config_platform" % name,
151+
platform = "windows",
152+
platform_exec_properties = exec_properties,
153+
)
154+
155+
remote_python_configure(
156+
name = "%s_config_python" % name,
157+
environ = env,
158+
exec_properties = exec_properties,
159+
)
160+
136161
tensorflow_rbe_config = _tensorflow_rbe_config
162+
tensorflow_rbe_win_config = _tensorflow_rbe_win_config

0 commit comments

Comments
 (0)