The text report filters lines containing google (grep -v -i google) to
avoid leaking internal hostnames, depot paths, or build configurations
when users upload diagnostic logs. The new --json path wrote raw env
vars (TPU_NAME, XLA_FLAGS, paths) and TF device/version strings straight
to tf_env.json without that filter.
Add a recursive redact() helper that replaces any string value containing
google (case-insensitive) with [redacted] and apply it to the report
before writing, so tf_env.json matches the redaction safety of tf_env.txt.
Addresses review feedback from @sgarciagoogle.
- Quote the LD_LIBRARY_PATH/DYLD_LIBRARY_PATH echoes in the env section.
- Prefer `command -v` over `which` for Python and c++ detection.
- Add an EXIT/INT/TERM trap so the temporary loaded-libs file is removed
even when the script is interrupted.
- Add section banners to make the long collection block easier to scan.
2026-06-24 06:50:08 -07:00
Roy Kimandgemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Add ROCm/AMD GPU and Apple Silicon/Metal detection, surface hermetic
CUDA/ROCm and XLA/TPU build environment variables, report TensorFlow's
visible devices, and warn on conflicting TensorFlow installs. Add
--json, --verbose, --output, and --help flags and make missing-tool
handling robust across Linux and macOS. The default text report
(tf_env.txt) remains backward compatible.
Replace older %-style string formatting with modern Python 3.6+ f-strings for all
environment info output in tf_env_collect.sh.
This change improves code consistency and readability by unifying the formatting
style across all Python code blocks within the script. F-strings are currently
the recommended standard in Python due to their clarity and performance.
No functionality is changed; the output remains identical. This stylistic update
supports easier ongoing maintenance and makes the codebase more inviting to new
contributors familiar with contemporary Python best practices.
Following the guidelines of clear, imperative, and descriptive commit messages,
this change documents *what* is updated and *why* the update is made, ensuring
future reviewers understand the motivation.
Reference: https://cbea.ms/git-commit/
Bazel-0.18.0 adds a try-import option that will non-fatally try and
import a file. Use this for the configure options so that .bazelrc does
not need to change. ./configure rewriting .bazelrc makes using the git
repo annoying because the file is changed.
The allowed bazel range is now 0.18.0-0.20.0 inclusive. The env var
TF_IGNORE_MAX_BAZEL_VERSION can be set to skip the max bazel version
check.
Also optionally import a /.bazelrc.user file that is gitignored so
user-specific options can go in there.
Fixes: https://github.com/tensorflow/tensorflow/issues/22762
Fixes: https://github.com/tensorflow/tensorflow/pull/22906
Signed-off-by: Jason Zaman <jason@perfinion.com>
This reverts commit a74a3217f7.
Bazel-0.18.0 is changing where it searches for .bazelrc files.
Originally it was removing /tools/bazel.rc and only using /.bazelrc.
This causes issues for gitignoring /.bazelrc and 0.18.0 has temporarily
added tools/bazel.rc back to the list until 0.19. The long term solution
is to use try-import but that statement is new in 0.18 and we are not
going to bump TF's minimum right away. When 0.19 is out things will need
to be changed back and the minimum bumped to 0.18.
Fixes: https://github.com/tensorflow/tensorflow/issues/22762
Fixes: https://github.com/tensorflow/tensorflow/pull/22906
Signed-off-by: Jason Zaman <jason@perfinion.com>
Some use-cases want to build packages in a different path than /usr. For
example to have a set of packages independent from other system
binaries. This change allows building with bazel build
--define=PREFIX=/some/other/path to search that path instead. The
default of /usr is set in bazelrc so that building with no options will
work as before and setting PREFIX on the commandline or later in the
bazelrc will override that setting if desired. PREFIX is not used by the
bundled build so should not affect that at all.
This also adds a few other standard Make variables that can be
overridden independently if needed.
Signed-off-by: Jason Zaman <jason@perfinion.com>
The commit contains following components to support TensorFlow on ROCm platform
- bazel build system
- continuous integration logic
Authors:
- Jack Chung: jack.chung@amd.com
- Jeffrey Poznanovic: Jeffrey.Poznanovic@amd.com
- Peng Sun: Peng.Sun@amd.com
This improves build times when using the downloaded clang toolchain.
Additionally, remove '-B/usr/bin' flags from the cuda CROSSTOOL when using
the downloaded toolchain.
It was forcing 'clang' to first search for the linker in '/usr/bin',
preventing downloaded LLD from being selected.
PiperOrigin-RevId: 211430374
After this change, to build TensorFlow with GPU support on Windows, you just need to follow the same procedure as Linux.
Also re-enable remote cache since the bug in b/111106393 has been fixed by the new wrapper script.
The clean-up of the wrapper scripts also made the build around 5 mins faster than using Bazel's msvc wrapper script.
PiperOrigin-RevId: 204105368
Don't use --distinct_host_configuration=false by default, because it would break cross compiling, like android build and Raspberry Pi build.
Instead, we add it for builds that we know they have the same host and target platforms.
PiperOrigin-RevId: 199194260
When building TensorFlow, the host and target platforms are usually the same. So we don't have to distinct them by default. This helps avoid building the same targets twice.
If we need to do cross compilation, add --config=cross-compile to distinct them.
PiperOrigin-RevId: 196673728
Previously we only allowed to download clang when doing GPU builds.
The added skylark files use bazel's autoconf scripts, which were only added in
0.10.0. To provide nice error message for older versions of bazel
(i.e. 'version is less than 0.10' vs 'can't load @bazel_tools/cpp/...'), we
move the bazel version check into WORKSPACE file from workspace.bzl.
PiperOrigin-RevId: 190050798
Bazel silently uses the wrong build settings for --config=android_arm64 (--cpu=arm64-v8a is not enough), and actually still uses armeabi-v7a in at least some cases. --fat_apk_cpu fixes this.
See #15581 for more.
PiperOrigin-RevId: 181525260
Moving --config=android_arm --config=mkl and --config=monolithic
build configs into tools/bazel.rc. These options are just always
written the same way to .bazelrc when configure.py is run. This
should trim down the scope of configure.py and make it easier to
build TF without running configure.py prior.
PiperOrigin-RevId: 180973131
--copts are passed to both c++ and c (so is redundent with --cxxopts).
Configs passed to "bazel build" are inherited by "bazel run" and "bazel test".
Also removed some unused configs.
PiperOrigin-RevId: 175326697