TensorFlow version update

Are they any plans to upgrade TF to a newer version in TensorFlow Java?

Yes, we have a branch with 2.15 in it, but we’re having some difficulty with the Windows builds so we can’t release it yet.

Thanks @craigacp. Can you provide a link to the branch with 2.15?
Also, Intel now builds and releases the TF Windows bits. If the issues are TF related, we can take a look it.

The branch is bazelcism as we’re working on using the TF binaries from either the Python wheels or C API builds so we can avoid building TF ourselves. We fixed all the issues with macOS and Linux, however the Windows builds have a number of issues. When trying to build 2.15 on Windows in Github Actions (and locally on my desktop) we hit path length issues, even after setting all the bazel paths to point at “C:\tmp”, you can see an example of that here - Fixes for Windows build. · tensorflow/java@4417c0e · GitHub. When trying to use the tensorflow-intel wheels we hit an issue where Windows builds use pyd files not dlls and we can’t load those from Java. When trying to use the C API builds for Windows we hit symbol not exported issues - Missing symbols in official Windows TensorFlow native builds · Issue #62579 · tensorflow/tensorflow · GitHub.

We raised the latter two issues with SIG-BUILD, but not had any response from people who control those builds. The first issue we narrowed down this weekend so we’ve not reported it yet.

Hi @craigacp,
To resolve long path issues while building with Bazel, set --output_user_root=c:\
e.g. bazel --output_user_root=c:\ build --config=opt --repo_env=TF_PYTHON_VERSION=3.10 --define=no_tensorflow_py_deps=true //tensorflow/tools/pip_package:build_pip_package

Apart from this, also consider looking into the system settings to ensure the long path is enabled.

Thanks @craigacp for the info. The Intel team is working on the issues you reported. Pls update the github issues if you have more info.

Bazel is refusing to respect that argument, it either writes things to C:\tmp (after exporting various tmpdir params) or to c:\Users<username>\AppData\Local\Temp. I have long paths set, however MSVC doesn’t support them. Our buildscript is here - https://github.com/tensorflow/java/blob/bazelcism/tensorflow-core/tensorflow-core-native/scripts/bazel_build.sh, and I tried numerous places to add that argument. The one which seemed to do something (in that the bazel install was written to root) was adding it to the top of our tensorflow.bazelrc.

Hi @craigacp, could you please share the steps to build the TensorFlow Java package, or if you have any logs, please share them? We are unable to reproduce the error on our end.

Running mvn clean install -Dnative.build -B -U -e -Djavacpp.platform=windows-x86_64 -Djavacpp.platform.extension="" will build it for Windows. You can see how we configure it in the CI here - https://github.com/tensorflow/java/blob/bazelcism/.github/workflows/build.yml#L157.

Hi @craigacp to fix the long path issue, we can control the path by making the change below in bazel_common.sh.
export BAZEL_VC=“C:\Program Files\Microsoft Visual Studio\2022\Community\VC”
if [[ -d $BAZEL_VC ]]; then
export BUILD_FLAGS=“–output_user_root=$(cygpath -w $TMP) build”
export PYTHON_BIN_PATH=$(which python.exe)
export BUILD_FLAGS=“build”
export PYTHON_BIN_PATH=$(which python3)

Please let me know if it is still an issue of the long path. There is a linking error with target //tensorflow:tensorflow_cc