-
Notifications
You must be signed in to change notification settings - Fork 584
/
.bazelrc
149 lines (111 loc) · 4.73 KB
/
.bazelrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# TensorFlow Federated Bazel configuration
#
# See https://docs.bazel.build/versions/master/user-manual.html#config for
# details on the various configuration options.
# Enable verbose failures for testing only.
build --verbose_failures
# Enable logging rc options.
common --announce_rc
# Enable platform-specific configs from bazelrc files.
common --enable_platform_specific_config
# Enable logging error output.
test --test_output=errors
test --test_summary=detailed
# Execute commands as local subprocesses
build --spawn_strategy=local
# Enable build optimizations.
build --compilation_mode=opt
# Enable fast C++ protocol buffers, 10x speedup over pure Python.
# TODO: b/306021118 - Temporarily disable `use_fast_cpp_protos`.
# build --define=use_fast_cpp_protos=true
build --define=allow_oversize_protos=true
# Do not automatically create `__init__.py` in the runfiles of Python targets.
build --incompatible_default_to_explicit_init_py
# Haswell processor and later optimizations. This covers most processors deployed
# today, includin Colab CPU runtimes.
build --copt=-march=haswell
build --host_copt=-march=haswell
# Only use level three optimizations for target, not necessarily for host
# since host artifacts don't need to be fast.
build --copt=-O3
# Suppress C++ compiler warnings.
build:linux --copt=-w
build:linux --host_copt=-w
#
# Remote execution capabilities
#
# Enable authentication.
build:remote --google_default_credentials=true
# Enable remote cache.
build:remote --remote_cache=grpcs://remotebuildexecution.googleapis.com
# Project configuration.
build:remote --remote_instance_name=projects/tensorflow-federated/instances/default_instance
build:remote --project_id=tensorflow-federated
#
# Required to build TensorFlow
#
# Default build options. These are applied first and unconditionally.
build --define=grpc_no_ares=true
# See https://github.com/bazelbuild/bazel/issues/7362 for information on what
# --incompatible_remove_legacy_whole_archive flag does.
# This flag is set to true in Bazel 1.0 and newer versions. We tried to migrate
# Tensorflow to the default, however test coverage wasn't enough to catch the
# errors.
# There is ongoing work on Bazel team's side to provide support for transitive
# shared libraries. As part of migrating to transitive shared libraries, we
# hope to provide a better mechanism for control over symbol exporting, and
# then tackle this issue again.
#
# Remove this line once TF doesn't depend on Bazel wrapping all library
# archives in -whole_archive -no_whole_archive.
build --noincompatible_remove_legacy_whole_archive
# Enable XLA support by default.
build --define=with_xla_support=true
build --config=short_logs
build --config=v2
# Disable AWS/HDFS support by default
build --define=no_aws_support=true
build --define=no_hdfs_support=true
# TF now has `cc_shared_library` targets, so it needs the experimental flag
# Remove when `cc_shared_library` is enabled by default
build --experimental_cc_shared_library
build --experimental_link_static_libraries_once=false
# Default options should come above this line.
# This config refers to building CUDA op kernels with nvcc.
build:cuda --repo_env TF_NEED_CUDA=1
build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain
build:cuda --@local_config_cuda//:enable_cuda
# Default paths for TF_SYSTEM_LIBS
build:linux --define=PREFIX=/usr
build:linux --define=LIBDIR=$(PREFIX)/lib
build:linux --define=INCLUDEDIR=$(PREFIX)/include
build:linux --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include
# By default, build TF in C++ 17 mode.
build:linux --cxxopt=-std=c++17
build:linux --host_cxxopt=-std=c++17
# Do not risk cache corruption. See:
# https://github.com/bazelbuild/bazel/issues/3360
build:linux --experimental_guard_against_concurrent_changes
# Configure short or long logs
build:short_logs --output_filter=DONT_MATCH_ANYTHING
build:verbose_logs --output_filter=
# Instruction set optimizations
# Create a feature in toolchains for avx/avx2 to
# avoid having to define linux/win separately.
build:avx_linux --copt=-mavx
build:avx_linux --host_copt=-mavx
# Options to build TensorFlow 1.x or 2.x.
build:v1 --define=tf_api_version=1 --action_env=TF2_BEHAVIOR=0
build:v2 --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
# Options when using remote execution
# Flag to enable remote config
common --experimental_repo_remote_exec
# Config-specific options should come above this line.
build:cuda --action_env=TF_CUDA_VERSION="12"
build:cuda --action_env=TF_CUDNN_VERSION="8"
build:cuda --repo_env=TF_CUDA_COMPUTE_CAPABILITIES="sm_60,sm_70,sm_75,compute_80"
build:cuda --action_env=GCC_HOST_COMPILER_PATH="/dt9/usr/bin/gcc"
build --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1
# Default startup
startup --host_jvm_args=-Dbazel.DigestFunction=SHA256
build --define=build_with_onednn_v2=true