Skip to content

Commit 8b484dd

Browse files
committed
Add CONTRIBUTING.md
Signed-off-by: Ryan Nett <[email protected]>
1 parent 82f9128 commit 8b484dd

File tree

2 files changed

+57
-19
lines changed

2 files changed

+57
-19
lines changed

CONTRIBUTING.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Building and contributing to TensorFlow Java
2+
3+
## Building
4+
5+
To build all the artifacts, simply invoke the command `mvn install` at the root of this repository (or
6+
the Maven command of your choice). It is also possible to build artifacts with support for MKL enabled with
7+
`mvn install -Djavacpp.platform.extension=-mkl` or CUDA with `mvn install -Djavacpp.platform.extension=-gpu`
8+
or both with `mvn install -Djavacpp.platform.extension=-mkl-gpu`.
9+
10+
When building this project for the first time in a given workspace, the script will attempt to download
11+
the [TensorFlow runtime library sources](https://github.com/tensorflow/tensorflow) and build of all the native code
12+
for your platform. This requires a valid environment for building TensorFlow, including the [bazel](https://bazel.build/)
13+
build tool and a few Python dependencies (please read [TensorFlow documentation](https://www.tensorflow.org/install/source)
14+
for more details).
15+
16+
This step can take multiple hours on a regular laptop. It is possible though to skip completely the native build if you are
17+
working on a version that already has pre-compiled native artifacts for your platform [available on Sonatype OSS Nexus repository](#Snapshots).
18+
You just need to activate the `dev` profile in your Maven command to use those artifacts instead of building them from scratch
19+
(e.g. `mvn install -Pdev`).
20+
21+
Note that modifying any source files under `tensorflow-core` may impact the low-level TensorFlow bindings, in which case a
22+
complete build could be required to reflect the changes.
23+
24+
25+
## Running Tests
26+
27+
`ndarray` can be tested using the maven `test` target. `tensorflow-core` and `tensorflow-framework`, however,
28+
should be tested using the `integration-test` target, due to the need to include native binaries.
29+
It will **not** be ran when using the `test` target of parent projects, but will be ran by `install` or `integration-test`.
30+
31+
## Contributing
32+
33+
### Formatting
34+
35+
Java sources should be formatted according to the [Google style guide](https://google.github.io/styleguide/javaguide.html).
36+
It can be included in [IntelliJ](https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml) and
37+
[Eclipse](https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml).
38+
[Google's C++ style guide](https://google.github.io/styleguide/cppguide.html) should also be used for C++ code.
39+
40+
### Working with Bazel generation
41+
42+
`tensorflow-core-api` uses C++ code generation that is built with Bazel. To get it to build, you will likely need to clone the
43+
`tensorflow` project, run its configuration script (`./configure`), and copy the resulting `.tf_configure.bazelrc` to `tensorflow-core-api`.
44+
45+
To run the code generation, use the `//:java_op_generator` target. The resulting binary has good help text (viewable in
46+
[op_gen_main.cc](tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_gen_main.cc#L31-L48)).
47+
Generally, it should be called with arguments that are something like `bazel-out/k8-opt/bin/external/org_tensorflow/tensorflow/libtensorflow_cc.so
48+
--output_dir=src/gen/java --api_dirs=bazel-tensorflow-core-api/external/org_tensorflow/tensorflow/core/api_def/base_api,src/bazel/api_def`
49+
(from `tensorflow-core-api`).

README.md

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,17 @@ The following describes the layout of the repository and its different artifacts
3434
* Intended audience: any developer who needs a Java n-dimensional array implementation, whether or not they
3535
use it with TensorFlow
3636

37-
## Building Sources
3837

39-
To build all the artifacts, simply invoke the command `mvn install` at the root of this repository (or
40-
the Maven command of your choice). It is also possible to build artifacts with support for MKL enabled with
41-
`mvn install -Djavacpp.platform.extension=-mkl` or CUDA with `mvn install -Djavacpp.platform.extension=-gpu`
42-
or both with `mvn install -Djavacpp.platform.extension=-mkl-gpu`.
38+
## Communication
4339

44-
When building this project for the first time in a given workspace, the script will attempt to download
45-
the [TensorFlow runtime library sources](https://github.com/tensorflow/tensorflow) and build of all the native code
46-
for your platform. This requires a valid environment for building TensorFlow, including the [bazel](https://bazel.build/)
47-
build tool and a few Python dependencies (please read [TensorFlow documentation](https://www.tensorflow.org/install/source)
48-
for more details).
40+
This repository is maintained by TensorFlow JVM Special Interest Group (SIG). You can easily join the group
41+
by subscribing to the [[email protected]](https://groups.google.com/a/tensorflow.org/forum/#!forum/jvm)
42+
mailing list, or you can simply send pull requests and raise issues to this repository.
43+
There is also a [sig-jvm Gitter channel](https://gitter.im/tensorflow/sig-jvm).
4944

50-
This step can take multiple hours on a regular laptop. It is possible though to skip completely the native build if you are
51-
working on a version that already has pre-compiled native artifacts for your platform [available on Sonatype OSS Nexus repository](#Snapshots).
52-
You just need to activate the `dev` profile in your Maven command to use those artifacts instead of building them from scratch
53-
(e.g. `mvn install -Pdev`).
45+
## Building Sources
5446

55-
Note that modifying any source files under `tensorflow-core` may impact the low-level TensorFlow bindings, in which case a
56-
complete build could be required to reflect the changes.
47+
See [CONTRIBUTING.md](CONTRIBUTING.md#building).
5748

5849
## Using Maven Artifacts
5950

@@ -162,6 +153,4 @@ This table shows the mapping between different version of TensorFlow for Java an
162153

163154
## How to Contribute?
164155

165-
This repository is maintained by TensorFlow JVM Special Interest Group (SIG). You can easily join the group
166-
by subscribing to the [[email protected]](https://groups.google.com/a/tensorflow.org/forum/#!forum/jvm)
167-
mailing list, or you can simply send pull requests and raise issues to this repository.
156+
Contributions are welcome, guidelines are located in [CONTRIBUTING.md](CONTRIBUTING.md).

0 commit comments

Comments
 (0)