Skip to content

Commit fb3f393

Browse files
authored
Add instructions on how to include GPU support with TFJava 1.0.0
1 parent d625dbb commit fb3f393

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

Diff for: CONTRIBUTING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ For dependencies, we can use anything compliant with [this list](https://opensou
1515

1616
## Building
1717

18-
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
19-
possible to build artifacts with support for CUDA® by adding the `-Djavacpp.platform.extension=-gpu` argument to the Maven command.
18+
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).
2019

2120
### JDK 16+
2221

@@ -35,7 +34,7 @@ This can be done in `.mvn/jvm.config` or `MAVEN_OPTS`.
3534
### Native Builds
3635

3736
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).
38-
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
37+
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
3938
command. This requires a valid environment for building TensorFlow, including the [bazel](https://bazel.build/) build tool and a few Python dependencies
4039
(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.
4140

Diff for: MIGRATING.md

+18
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ The Java Module (jigsaw) names has been updated to drop the leading `org.`, as f
4949
- `tensorflow-core-native` : `tensorflow.nativelib`
5050
- `tensorflow-framework` : `tensorflow.framework` (was `org.tensorflow.framework` before)
5151

52+
### GPU Support
53+
54+
Previous versions of TF Java were building a `tensorflow-core-platform-gpu` artifact upon which application could depend
55+
on to include any TensorFlow native library that GPU support enabled. Since TensorFlow has removed its support of GPU
56+
on all platforms other that Linux, we removed our platform JAR in favour of simply adding a dependency on the
57+
`linux-x86_64-gpu` native artifact.
58+
```xml
59+
<dependency>
60+
<group>org.tensorflow</group>
61+
<artifact>tensorflow-core-native</artifact>
62+
<version>1.0.0</version>
63+
<classifier>linux-x86_64-gpu</classifier>
64+
</dependency>
65+
```
66+
Please note that including this dependency won't work if your application also depends on `tensorflow-core-platform`. If
67+
you need to support more platforms that Linux, you should include the other `tensorflow-core-native` dependencies
68+
separately (see the [README](README.md) file).
69+
5270
### Session Run Result
5371

5472
In versions before 0.4.0 `Session.Runner.run` and `TensorFunction.call` returned a `List<Tensor>`. In newer versions

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Only one dependency can be added per platform, meaning that you cannot add nativ
115115
In some cases, it might be preferable to add a single dependency that includes transitively all the artifacts
116116
required to run TensorFlow Java on any [supported platforms](README.md#individual-dependencies)
117117

118-
- `tensorflow-core-platform`: Includes `tensorflow-core-api`, plus native artifacts for `linux-x86_64`, `macosx-arm64`, `macosx-x86_64` and `windows-x86_64`
118+
- `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`
119119

120120
For example, to run TensorFlow Java on any CPU platform for which a binary is being distributed by this project, you can
121121
simply add this dependency to your application:

0 commit comments

Comments
 (0)