Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit a0a6706

Browse files
authored
documentation: extract developer documentation (#1155)
Extract the developer documentation to make it easier to modify and extend beyond the current state.
1 parent 36d7f1b commit a0a6706

File tree

2 files changed

+79
-74
lines changed

2 files changed

+79
-74
lines changed

Documentation/Development.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Swift for TensorFlow Deep Learning Library
2+
3+
## Development
4+
5+
### Requirements
6+
7+
* [Swift for TensorFlow toolchain][toolchain].
8+
* An environment that can run the Swift for TensorFlow toolchains: Ubuntu 18.04, macOS with Xcode 10, or Windows 10.
9+
* Bazel. This can be installed [manually][bazel] or with
10+
[Bazelisk][bazelisk]. You will need a version supported by TensorFlow
11+
(between `_TF_MIN_BAZEL_VERSION` and `_TF_MAX_BAZEL_VERSION` as specified in
12+
[tensorflow/configure.py][configure.py]).
13+
* Python3 with [numpy][numpy].
14+
* CMake. CMake 3.16 or newer is required to build with CMake.
15+
16+
### Building and testing
17+
18+
#### SwiftPM
19+
20+
*Note: Building with SwiftPM does not include changes to X10 modules.*
21+
22+
```shell
23+
$ swift build
24+
```
25+
26+
*Note: Testing with SwiftPM does not run X10 tests.*
27+
28+
```shell
29+
$ swift test
30+
```
31+
32+
#### CMake
33+
34+
*Note: CMake is required for building X10 modules.*
35+
36+
In-tree builds are not supported.
37+
38+
*Note: To enable CUDA support, run `export TF_NEED_CUDA=1` before the steps below.*
39+
40+
*Note: If `swiftc` is not in your `PATH`, you must specify the path to it using
41+
`-D CMAKE_Swift_COMPILER=`.*
42+
43+
This will build X10 as part of the build. Ensure that you do not have the
44+
x10 modules in the toolchain that you are using to develop here.
45+
46+
```shell
47+
cmake -B out -G Ninja -S swift-apis
48+
cmake --build out
49+
```
50+
51+
To run tests:
52+
53+
*Note: To view failure output, run `export CTEST_OUTPUT_ON_FAILURE=1` before
54+
running tests.*
55+
56+
```shell
57+
cmake --build out --target test
58+
```
59+
60+
If you are not intending to develop X10, you can reduce the build times by
61+
using the bundled X10 in the toolchain using
62+
`-D USE_BUNDLED_X10=YES -D USE_BUNDLED_CTENSORFLOW=YES`:
63+
64+
```shell
65+
cmake -B out -D USE_BUNDLED_CTENSORFLOW=YES -D USE_BUNDLED_X10=YES -G Ninja -S swift-apis
66+
cmake --build out
67+
cmake --build out --target test
68+
```
69+
70+
#### macOS
71+
72+
On macOS, passing `-D BUILD_TESTING=NO` is currently necessary to skip building
73+
tests. This avoids an error: `cannot load underlying module for 'XCTest'`.
74+
75+
```shell
76+
cmake -B out -D USE_BUNDLED_CTENSORFLOW=YES -D USE_BUNDLED_X10=YES -D BUILD_TESTING=NO -G Ninja -S swift-apis
77+
cmake --build out
78+
```

README.md

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -87,80 +87,7 @@ For more models, go to [**tensorflow/swift-models**][swift-models].
8787

8888
## Development
8989

90-
### Requirements
91-
92-
* [Swift for TensorFlow toolchain][toolchain].
93-
* An environment that can run the Swift for TensorFlow toolchains: Ubuntu 18.04, macOS with Xcode 10, or Windows 10.
94-
* Bazel. This can be installed [manually][bazel] or with
95-
[Bazelisk][bazelisk]. You will need a version supported by TensorFlow
96-
(between `_TF_MIN_BAZEL_VERSION` and `_TF_MAX_BAZEL_VERSION` as specified in
97-
[tensorflow/configure.py][configure.py]).
98-
* Python3 with [numpy][numpy].
99-
* CMake. CMake 3.16 or newer is required to build with CMake.
100-
101-
### Building and testing
102-
103-
#### SwiftPM
104-
105-
*Note: Building with SwiftPM does not include changes to X10 modules.*
106-
107-
```shell
108-
$ swift build
109-
```
110-
111-
*Note: Testing with SwiftPM does not run X10 tests.*
112-
113-
```shell
114-
$ swift test
115-
```
116-
117-
#### CMake
118-
119-
*Note: CMake is required for building X10 modules.*
120-
121-
In-tree builds are not supported.
122-
123-
*Note: To enable CUDA support, run `export TF_NEED_CUDA=1` before the steps below.*
124-
125-
*Note: If `swiftc` is not in your `PATH`, you must specify the path to it using
126-
`-D CMAKE_Swift_COMPILER=`.*
127-
128-
This will build X10 as part of the build. Ensure that you do not have the
129-
x10 modules in the toolchain that you are using to develop here.
130-
131-
```shell
132-
cmake -B out -G Ninja -S swift-apis
133-
cmake --build out
134-
```
135-
136-
To run tests:
137-
138-
*Note: To view failure output, run `export CTEST_OUTPUT_ON_FAILURE=1` before
139-
running tests.*
140-
141-
```shell
142-
cmake --build out --target test
143-
```
144-
145-
If you are not intending to develop X10, you can reduce the build times by
146-
using the bundled X10 in the toolchain using
147-
`-D USE_BUNDLED_X10=YES -D USE_BUNDLED_CTENSORFLOW=YES`:
148-
149-
```shell
150-
cmake -B out -D USE_BUNDLED_CTENSORFLOW=YES -D USE_BUNDLED_X10=YES -G Ninja -S swift-apis
151-
cmake --build out
152-
cmake --build out --target test
153-
```
154-
155-
#### macOS
156-
157-
On macOS, passing `-D BUILD_TESTING=NO` is currently necessary to skip building
158-
tests. This avoids an error: `cannot load underlying module for 'XCTest'`.
159-
160-
```shell
161-
cmake -B out -D USE_BUNDLED_CTENSORFLOW=YES -D USE_BUNDLED_X10=YES -D BUILD_TESTING=NO -G Ninja -S swift-apis
162-
cmake --build out
163-
```
90+
Documentation covering development can be found in the [Developer Guide](Documentation/Development.md).
16491

16592
## Bugs
16693

0 commit comments

Comments
 (0)