From 127013b10cb6d955cd1083d44d8d6053061e3a46 Mon Sep 17 00:00:00 2001 From: Karl Lessard Date: Fri, 1 Nov 2024 15:17:16 -0400 Subject: [PATCH 1/3] Add instructions on how to support GPU with TFJava 1.0.0 --- MIGRATING.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/MIGRATING.md b/MIGRATING.md index 1fc2c1d7620..44a1924a512 100644 --- a/MIGRATING.md +++ b/MIGRATING.md @@ -49,6 +49,24 @@ The Java Module (jigsaw) names has been updated to drop the leading `org.`, as f - `tensorflow-core-native` : `tensorflow.nativelib` - `tensorflow-framework` : `tensorflow.framework` (was `org.tensorflow.framework` before) +### GPU Support + +Previous versions of TF Java were building a `tensorflow-core-platform-gpu` artifact upon which application could depend +on to include any TensorFlow native library that GPU support enabled. Since TensorFlow has removed its support of GPU +on all platforms other that Linux, we removed our platform JAR in favour of simply adding a dependency on the +`linux-x86_64-gpu` native artifact. +```xml + + org.tensorflow + tensorflow-core-native + 1.0.0 + linux-x86_64-gpu + +``` +Please note that including this dependency won't work if your application also depends on `tensorflow-core-platform`. If +you need to support more platforms that Linux, you should include the other `tensorflow-core-native` dependencies +separately (see the [README](README.md) file). + ### Session Run Result In versions before 0.4.0 `Session.Runner.run` and `TensorFunction.call` returned a `List`. In newer versions From a912681c59d8c8ecee2374b155d04af6903ce9f6 Mon Sep 17 00:00:00 2001 From: Karl Lessard Date: Fri, 1 Nov 2024 16:01:23 -0400 Subject: [PATCH 2/3] Update instructions for GPU builds --- CONTRIBUTING.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c66940295a1..874bdddaf52 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,8 +15,7 @@ For dependencies, we can use anything compliant with [this list](https://opensou ## Building -To build all the artifacts locally, simply invoke the command `mvn install` at the root of this repository (or the Maven command of your choice). It is also -possible to build artifacts with support for CUDA® by adding the `-Djavacpp.platform.extension=-gpu` argument to the Maven command. +To build all the artifacts locally, simply invoke the command `mvn install` at the root of this repository (or the Maven command of your choice). ### JDK 16+ @@ -35,7 +34,7 @@ This can be done in `.mvn/jvm.config` or `MAVEN_OPTS`. ### Native Builds By default, the build will attempt to download the existing TensorFlow binaries from the web for the platform it is running on (so you need to have an active internet connection). -If such binaries are not available for your platform, you will need to build the TensorFlow runtime library from sources, by appending the `-Dnative.build` argument to your Maven +If such binaries are not available for your platform, you will need to build the TensorFlow runtime library from sources, by appending the `-Pnative-build` argument to your Maven command. This requires a valid environment for building TensorFlow, including the [bazel](https://bazel.build/) build tool and a few Python dependencies (please read [TensorFlow documentation](https://www.tensorflow.org/install/source) for more details). Note that building from sources can take multiple hours on a regular laptop. From 908e1673e096a5d451c68c0dcc519a27936e4cb6 Mon Sep 17 00:00:00 2001 From: Karl Lessard Date: Fri, 1 Nov 2024 16:02:22 -0400 Subject: [PATCH 3/3] Add Linux arm64 to platform doc --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5b748e220f..e48ba72e656 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Only one dependency can be added per platform, meaning that you cannot add nativ In some cases, it might be preferable to add a single dependency that includes transitively all the artifacts required to run TensorFlow Java on any [supported platforms](README.md#individual-dependencies) -- `tensorflow-core-platform`: Includes `tensorflow-core-api`, plus native artifacts for `linux-x86_64`, `macosx-arm64`, `macosx-x86_64` and `windows-x86_64` +- `tensorflow-core-platform`: Includes `tensorflow-core-api`, plus native artifacts for `linux-x86_64`, `linux-x86_64-arm64`, `macosx-arm64`, `macosx-x86_64` and `windows-x86_64` For example, to run TensorFlow Java on any CPU platform for which a binary is being distributed by this project, you can simply add this dependency to your application: