Skip to content

Commit 8aa5cfc

Browse files
committed
---
yaml --- r: 311159 b: refs/heads/tensorflow-merge c: 65daf24 h: refs/heads/master i: 311157: 68d52cb 311155: b44f877 311151: 6f6eded
1 parent 37ccd29 commit 8aa5cfc

File tree

2 files changed

+60
-90
lines changed

2 files changed

+60
-90
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ refs/heads/chase-my-tail: 8bb91443a9e81bbfac92a2621a0af887a1da8dbf
13791379
refs/heads/consider-outer-alternatives: 708bac749ec60a22a79e2eefbe734f9488a7370d
13801380
refs/heads/revert-25740-oops-i-linked-it-again: fdd41aeb682fc488572bdc1cf71b2ff6997ba576
13811381
refs/heads/swift-5.1-branch-06-12-2019: e63b7b2d3b93c48232d386099d0ec525d21d8f8d
1382-
refs/heads/tensorflow-merge: 52acebd76156f0d15623a20edc9d4c91486f2dd4
1382+
refs/heads/tensorflow-merge: 65daf246b17042c3b398dac52bccf77495813ee7
13831383
refs/heads/update-checkout-sha-info: 5832743c5c2a842976c42a508a4c6dcceefb0aef
13841384
refs/tags/swift-5.1-DEVELOPMENT-SNAPSHOT-2019-06-12-a: 228f0448d9bb909aacbba4afcb7c600a405d15da
13851385
refs/tags/swift-5.1-DEVELOPMENT-SNAPSHOT-2019-06-14-a: 922861a77b5fc2bf46bc917da70ceb15eef76836

branches/tensorflow-merge/README.md

Lines changed: 59 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<img src="https://swift.org/assets/images/swift.svg" alt="Swift logo" height="70" >
1+
# Swift for TensorFlow
22

3-
# Swift Programming Language
3+
Welcome to Swift for TensorFlow!
44

55

66
| | **Architecture** | **Master** | **Package** |
@@ -20,84 +20,55 @@
2020
|**[Ubuntu 16.04 (TensorFlow)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow)|
2121
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le)|
2222

23-
**Welcome to Swift!**
23+
This repository covers the compiler and standard libraries. Please visit the [documentation repository](https://github.com/tensorflow/swift) for more information about the project, including a project overview, technical details, and guidelines for contributing. To use Swift for TensorFlow out of the box, follow the [installation instructions](https://github.com/tensorflow/swift/blob/master/Installation.md). To build from source, follow the instructions below.
2424

25-
Swift is a high-performance system programming language. It has a clean
26-
and modern syntax, offers seamless access to existing C and Objective-C code
27-
and frameworks, and is memory safe by default.
25+
**Note:** Swift for TensorFlow is an early stage research project. It has been released to enable open source development and is not yet ready for general use by machine learning developers.
2826

29-
Although inspired by Objective-C and many other languages, Swift is not itself a
30-
C-derived language. As a complete and independent language, Swift packages core
31-
features like flow control, data structures, and functions, with high-level
32-
constructs like objects, protocols, closures, and generics. Swift embraces
33-
modules, eliminating the need for headers and the code duplication they entail.
27+
## Building Swift for TensorFlow
3428

35-
To learn more about the programming language, visit [swift.org](https://swift.org/documentation/).
29+
These instructions give the most direct path to a working development environment for Swift for TensorFlow.
3630

37-
## Contributing to Swift
38-
39-
Contributions to Swift are welcomed and encouraged! Please see the
40-
[Contributing to Swift guide](https://swift.org/contributing/).
41-
42-
To be a truly great community, [Swift.org](https://swift.org/) needs to welcome
43-
developers from all walks of life, with different backgrounds, and with a wide
44-
range of experience. A diverse and friendly community will have more great
45-
ideas, more unique perspectives, and produce more great code. We will work
46-
diligently to make the Swift community welcoming to everyone.
47-
48-
To give clarity of what is expected of our members, Swift has adopted the
49-
code of conduct defined by the Contributor Covenant. This document is used
50-
across many open source communities, and we think it articulates our values
51-
well. For more, see the [Code of Conduct](https://swift.org/community/#code-of-conduct).
52-
53-
## Getting Started
54-
55-
These instructions give the most direct path to a working Swift development
56-
environment. To build from source you will need about 2 GB of disk space for the
57-
source code and up to 70 GB of disk space for the build artifacts with full
58-
debugging. Depending on your machine, a clean build can take a few minutes to
59-
several hours. Naturally, incremental builds are much faster.
31+
**Note:** Building from source is necessary only if you want to modify the source code or build with a custom version of TensorFlow.
6032

33+
To build from source you will need 2 GB of disk space for the source code and over 20 GB of disk space for the build artifacts. A clean build can take multiple hours, but incremental builds will finish much faster.
6134

6235
### System Requirements
6336

64-
macOS, Ubuntu Linux LTS, and the latest Ubuntu Linux release are the current
37+
macOS, Ubuntu Linux LTS 14.04, and Ubuntu Linux LTS 16.04 are the current
6538
supported host development operating systems.
6639

6740
#### macOS
6841

6942
To build for macOS, you need [Xcode 10 beta](https://developer.apple.com/xcode/downloads/).
7043
The required version of Xcode changes frequently, and is often a beta release.
71-
Check this document or the host information on <https://ci.swift.org> for the
72-
current required version.
44+
Check this document for the current required version.
7345

74-
You will also need [CMake](https://cmake.org) and [Ninja](https://ninja-build.org),
75-
which can be installed via a package manager:
46+
You will also need [CMake](https://cmake.org), [Ninja](https://ninja-build.org), and [Bazel](https://www.bazel.build), which can be installed via a package manager.
7647

7748
**[Homebrew](https://brew.sh/)**
7849

7950
brew install cmake ninja
51+
brew cask install caskroom/versions/java8 (required for Bazel)
52+
brew install bazel (required for TensorFlow support)
8053

81-
**[MacPorts](https://macports.org)**
82-
83-
sudo port install cmake ninja
84-
85-
Instructions for installing CMake and Ninja directly can be found [below](#build-dependencies).
54+
Instructions for installing CMake, Ninja, and Bazel directly can be found [below](#build-dependencies).
8655

8756
#### Linux
8857

8958
For Ubuntu, you'll need the following development dependencies:
9059

9160
sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev systemtap-sdt-dev tzdata rsync
9261

62+
Additionally, [Bazel](https://www.bazel.build) is required to build with TensorFlow support. Ubuntu installation instructions are [here](https://docs.bazel.build/versions/master/install-ubuntu.html).
63+
9364
**Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
9465
with version 2 shipped with Ubuntu.
9566

96-
Build instructions for Ubuntu 14.04 LTS can be found [here](docs/Ubuntu14.md).
67+
Additional build instructions for Ubuntu 14.04 LTS can be found [here](docs/Ubuntu14.md). These are necessary for building Swift for TensorFlow correctly.
9768

9869
### Getting Sources for Swift and Related Projects
9970

100-
First create a directory for all of the Swift sources:
71+
First, create a directory for all of the Swift sources:
10172

10273
mkdir swift-source
10374
cd swift-source
@@ -107,17 +78,19 @@ repositories next to the Swift source directory. This means that if one clones
10778
Swift and has other unrelated repositories, update-checkout may not clone those
10879
repositories and will update them instead.
10980

81+
**TensorFlow Support:** To build with TensorFlow support, the `update-checkout-config-tensorflow.json` configuration file must be specified when cloning sources. The configuration file pins specific versions of every Swift companion directory and is updated with every upstream merge from the Apple Swift repositories.
82+
11083
**Via HTTPS** For those checking out sources as read-only, HTTPS works best:
11184

112-
git clone https://github.com/apple/swift.git
113-
./swift/utils/update-checkout --clone
85+
git clone https://github.com/google/swift.git -b tensorflow
86+
./swift/utils/update-checkout --clone --config swift/utils/update-checkout-config-tensorflow.json
11487

11588
**Via SSH** For those who plan on regularly making direct commits,
11689
cloning over SSH may provide a better experience (which requires
11790
[uploading SSH keys to GitHub](https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/)):
11891

119-
git clone [email protected]:apple/swift.git
120-
./swift/utils/update-checkout --clone-with-ssh
92+
git clone [email protected]:google/swift.git -b tensorflow
93+
./swift/utils/update-checkout --clone-with-ssh --config swift/utils/update-checkout-config-tensorflow.json
12194

12295
### Building Swift
12396

@@ -131,27 +104,52 @@ more environments.
131104

132105
To build using Ninja, run:
133106

134-
utils/build-script --release-debuginfo
107+
utils/build-script --enable-tensorflow --release-debuginfo
135108

136109
When developing Swift, it helps to build what you're working on in a debug
137110
configuration while building the rest of the project with optimizations. Below
138111
are some examples of using debug variants:
139112

140-
utils/build-script --release-debuginfo --debug-swift # Swift frontend built in debug
141-
utils/build-script --release-debuginfo --debug-swift-stdlib # Standard library built in debug
142-
utils/build-script --release-debuginfo --debug-swift --force-optimized-typechecker # Swift frontend sans type checker built in debug
113+
utils/build-script --enable-tensorflow --release-debuginfo --debug-swift # Swift frontend built in debug
114+
utils/build-script --enable-tensorflow --release-debuginfo --debug-swift-stdlib # Standard library built in debug
115+
utils/build-script --enable-tensorflow --release-debuginfo --debug-swift --force-optimized-typechecker # Swift frontend sans type checker built in debug
143116

144117
Limiting the amount of debug code in the compiler has a very large impact on
145118
Swift compile times, and in turn the test execution time. If you want to build
146119
the entire project in debug, you can run:
147120

148-
utils/build-script --debug
121+
utils/build-script --enable-tensorflow --debug
149122

150123
For documentation of all available arguments, as well as additional usage
151124
information, see the inline help:
152125

153126
utils/build-script -h
154127

128+
### TensorFlow Support
129+
130+
To enable TensorFlow support, specify the `--enable-tensorflow` flag:
131+
132+
utils/build-script --enable-tensorflow
133+
134+
By default, TensorFlow will be automatically cloned from GitHub and built from source using Bazel. If you want to build with custom TensorFlow headers and shared libraries, please specify the `tensorflow-host-include-dir` and `tensorflow-host-lib-dir` arguments:
135+
136+
utils/build-script --enable-tensorflow --tensorflow-host-include-dir=<path_to_tensorflow_headers> --tensorflow-host-lib-dir=<path_to_tensorflow_libraries>
137+
138+
Below is more information about the arguments:
139+
140+
* `enable-tensorflow`: If true, enables TensorFlow support for Swift.
141+
* Default value: `False`.
142+
* `build-tensorflow`: If true, automatically clone and build TensorFlow from source.
143+
* Default value: If `enable-tensorflow` is `True` and `tensorflow-host-lib-dir` and `tensorflow-host-include-dir` are not specified, then `True`. Otherwise, `False`.
144+
* `host-bazel`: The absolute path to Bazel, used to build TensorFlow.
145+
* By default, the path is auto detected.
146+
* `tensorflow-bazel-options`: Comma separated options passed to Bazel when building TensorFlow, e.g. `--copt=-mavx,--copt=-msse4.2`.
147+
* Default: None.
148+
* `tensorflow-host-include-dir`: A directory containing custom TensorFlow headers.
149+
* Default value: None.
150+
* `tensorflow-host-lib-dir`: A directory containing custom TensorFlow shared libraries (`libtensorflow.so` and `libtensorflow_framework.so`).
151+
* Default value: None.
152+
155153
#### Xcode
156154

157155
To build using Xcode, specify the `--xcode` argument on any of the above commands.
@@ -216,39 +214,6 @@ recompiling the entire project by passing the `--reconfigure` option.
216214
Make sure all repositories are up to date with the `update-checkout` command
217215
described above.
218216

219-
## Testing Swift
220-
221-
See [docs/Testing.md](docs/Testing.md), in particular the section on [lit.py](docs/Testing.md#using-litpy).
222-
223-
## Learning More
224-
225-
Be sure to look through the [docs](https://github.com/apple/swift/tree/master/docs)
226-
directory for more information about the compiler. In particular, the documents
227-
titled [Debugging the Swift Compiler](docs/DebuggingTheCompiler.rst) and
228-
[Continuous Integration for Swift](docs/ContinuousIntegration.md) are very
229-
helpful to understand before submitting your first PR.
230-
231-
### Building Documentation
232-
233-
To read the compiler documentation, start by installing the
234-
[Sphinx](http://sphinx-doc.org) documentation generator tool by running the
235-
command:
236-
237-
easy_install -U Sphinx
238-
239-
Once complete, you can build the Swift documentation by changing directory into
240-
[docs](https://github.com/apple/swift/tree/master/docs) and typing `make`. This
241-
compiles the `.rst` files in the [docs](https://github.com/apple/swift/tree/master/docs)
242-
directory into HTML in the `docs/_build/html` directory.
243-
244-
Many of the docs are out of date, but you can see some historical design
245-
documents in the `docs` directory.
246-
247-
Another source of documentation is the standard library itself, located in
248-
`stdlib`. Much of the language is actually implemented in the library
249-
(including `Int`), and the standard library gives some examples of what can be
250-
expressed today.
251-
252217
## Build Dependencies
253218

254219
### CMake
@@ -286,3 +251,8 @@ next to the other projects and it will be bootstrapped automatically:
286251
git clone [email protected]:ninja-build/ninja.git && cd ninja
287252
git checkout release
288253
cat README
254+
255+
### Bazel
256+
[Bazel](https://bazel.build) is the build tool used to build TensorFlow. Installing Bazel is necessary for building Swift with TensorFlow support.
257+
258+
The Bazel website has detailed installation instructions for [macOS](https://docs.bazel.build/versions/master/install-os-x.html) and [Ubuntu](https://docs.bazel.build/versions/master/install-ubuntu.html).

0 commit comments

Comments
 (0)