aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/aot/tfcompile.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/compiler/aot/tfcompile.bzl')
-rw-r--r--tensorflow/compiler/aot/tfcompile.bzl59
1 files changed, 37 insertions, 22 deletions
diff --git a/tensorflow/compiler/aot/tfcompile.bzl b/tensorflow/compiler/aot/tfcompile.bzl
index 326f73b975..792b7fe14a 100644
--- a/tensorflow/compiler/aot/tfcompile.bzl
+++ b/tensorflow/compiler/aot/tfcompile.bzl
@@ -105,12 +105,18 @@ def tf_library(
freeze_file = freeze_name + ".pb"
# First run tfcompile to generate the list of out_nodes.
+ #
+ # Here and below, we set CUDA_VISIBLE_DEVICES='' to prevent the code we
+ # launch from using any GPUs which might be present. This is important
+ # because builds may run concurrently with tests, and tests need to be
+ # able to assume that they have control of the full GPU.
out_nodes_file = "out_nodes_" + freeze_name
native.genrule(
name = ("gen_" + out_nodes_file),
srcs = [config],
outs = [out_nodes_file],
- cmd = ("$(location " + tfcompile_tool + ")" +
+ cmd = ("CUDA_VISIBLE_DEVICES='' " +
+ "$(location " + tfcompile_tool + ")" +
" --config=$(location " + config + ")" +
" --dump_fetch_nodes > $@"),
tools = [tfcompile_tool],
@@ -142,9 +148,12 @@ def tf_library(
out_nodes_file,
] + freeze_saver_srcs,
outs = [freeze_file],
- cmd = ("$(location " +
- "//tensorflow/python/tools:freeze_graph)" +
- freeze_args),
+ cmd = (
+ "CUDA_VISIBLE_DEVICES='' " +
+ "$(location " +
+ "//tensorflow/python/tools:freeze_graph)" +
+ freeze_args
+ ),
tools = ["//tensorflow/python/tools:freeze_graph"],
tags = tags,
)
@@ -177,16 +186,19 @@ def tf_library(
metadata_object_file,
function_object_file,
],
- cmd = ("$(location " + tfcompile_tool + ")" +
- " --graph=$(location " + tfcompile_graph + ")" +
- " --config=$(location " + config + ")" +
- " --entry_point=" + ep +
- " --cpp_class=" + cpp_class +
- " --target_triple=" + target_llvm_triple() +
- " --out_header=$(@D)/" + header_file +
- " --out_metadata_object=$(@D)/" + metadata_object_file +
- " --out_function_object=$(@D)/" + function_object_file +
- " " + flags + " " + profiling_flag),
+ cmd = (
+ "CUDA_VISIBLE_DEVICES='' " +
+ "$(location " + tfcompile_tool + ")" +
+ " --graph=$(location " + tfcompile_graph + ")" +
+ " --config=$(location " + config + ")" +
+ " --entry_point=" + ep +
+ " --cpp_class=" + cpp_class +
+ " --target_triple=" + target_llvm_triple() +
+ " --out_header=$(@D)/" + header_file +
+ " --out_metadata_object=$(@D)/" + metadata_object_file +
+ " --out_function_object=$(@D)/" + function_object_file +
+ " " + flags + " " + profiling_flag
+ ),
tools = [tfcompile_tool],
visibility = visibility,
testonly = testonly,
@@ -216,14 +228,17 @@ def tf_library(
outs = [
session_module_pb,
],
- cmd = ("$(location " + tfcompile_tool + ")" +
- " --graph=$(location " + tfcompile_graph + ")" +
- " --config=$(location " + config + ")" +
- " --entry_point=" + ep +
- " --cpp_class=" + cpp_class +
- " --target_triple=" + target_llvm_triple() +
- " --out_session_module=$(@D)/" + session_module_pb +
- " " + flags),
+ cmd = (
+ "CUDA_VISIBLE_DEVICES='' " +
+ "$(location " + tfcompile_tool + ")" +
+ " --graph=$(location " + tfcompile_graph + ")" +
+ " --config=$(location " + config + ")" +
+ " --entry_point=" + ep +
+ " --cpp_class=" + cpp_class +
+ " --target_triple=" + target_llvm_triple() +
+ " --out_session_module=$(@D)/" + session_module_pb +
+ " " + flags
+ ),
tools = [tfcompile_tool],
visibility = visibility,
testonly = testonly,