Skip to content

Commit 33f0fcb

Browse files
authored
Merge pull request #12 from zachgrayio/feature/fix-compiler-flag
be sure to include -O to compiler
2 parents 7e07623 + a1bddfe commit 33f0fcb

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ENV CONFIG=debug
1919
# user can pass in LIVE=true
2020
ENV LIVE=false
2121

22-
RUN swift build --configuration ${CONFIG}
22+
RUN swift build -Xswiftc -O --configuration ${CONFIG}
2323

2424
RUN cp ./.build/${CONFIG}/libSTSLibrary.so /usr/lib/libSTSLibrary.so
2525
RUN cp ./.build/${CONFIG}/STSLibrary.swiftmodule /usr/lib/STSLibrary.swiftmodule

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ NOTE: if you don't include the `-b|--build` flag to `app run` then the previousl
182182

183183
# Usage
184184

185+
### Writing TensorFlow Code
186+
187+
Something to keep in mind when writing your TensorFlow code, as to avoid issues with send/receive (from the [official FAQ](https://github.com/tensorflow/swift/blob/master/FAQ.md#why-do-i-get-error-internal-error-generating-tensorflow-graph-graphgen-cannot-lower-a-sendreceive-to-the-host-yet)):
188+
189+
>We recommend separating functions that do tensor computation from host code in your programs. Those functions should be marked as `@inline(never)` (and have `public` access, to be safe). Within those functions, tensor computation should not be interrupted by host code. This ensures that the arguments and results of the extracted tensor program will be values on the host, as expected.
190+
185191
### SwiftPM Project Settings
186192

187193
By default the following names are used:
@@ -247,7 +253,7 @@ If you wish to run `swift build` and `swift run` on your project outside of the
247253

248254
```bash
249255
export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}"
250-
swift run
256+
swift run -Xswiftc -O
251257
```
252258

253259
# License

entrypoint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CONFIG=$1
44
LIVE=$2
55

66
build() {
7-
swift build --configuration ${CONFIG}
7+
swift build -Xswiftc -O --configuration ${CONFIG}
88
}
99

1010
install_application() {

sts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ case ${STS_COMMAND} in
9898
if [ "$STS_LIVE_ENABLED" = true ] ; then
9999
echo -e "[STS][test][${STS_COMMAND_ARG}] ignoring unsupported flag: ${TXT_YELLOW}-l|--live${TXT_NC}"
100100
fi
101-
RUN_COMMAND="docker run --rm -it ${STS_LIVE_FLAG} ${STS_VOLUME_FLAG} --entrypoint "/usr/bin/swift" ${STS_NAME} test"
101+
RUN_COMMAND="docker run --rm -it ${STS_LIVE_FLAG} ${STS_VOLUME_FLAG} --entrypoint "/usr/bin/swift" ${STS_NAME} test -Xswiftc -O"
102102
;;
103103
xcode)
104104
if [ "$STS_LIVE_ENABLED" = true ] ; then

0 commit comments

Comments
 (0)