Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
2d759439
Commit
2d759439
authored
Mar 19, 2019
by
Ruslan Baratov
Committed by
Tianqi Chen
Mar 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update iOS RPC README (#2847)
parent
bb3c8151
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
3 deletions
+37
-3
apps/ios_rpc/README.md
+29
-3
apps/ios_rpc/tests/ios_rpc_test.py
+8
-0
No files found.
apps/ios_rpc/README.md
View file @
2d759439
...
...
@@ -4,12 +4,34 @@ This folder contains iOS RPC app that allows us to launch an rpc server on a iOS
and connect to it through python script and do testing on the python side as normal TVM RPC.
You will need XCode and an iOS device to use this.
## RPC proxy
Start the RPC proxy by running in a terminal:
python -m tvm.exec.rpc_proxy
On success, you should see something like this:
INFO:root:RPCProxy: client port bind to 0.0.0.0:9090
INFO:root:RPCProxy: Websock port bind to 8888
IP-address of this machine will be used to initialize
```TVM_IOS_RPC_PROXY_HOST```
environment variable (see below).
## Building
Before start, please run
```init_proj.py```
to update XCode developer metadata. After this step, open
```
tvmrpc.xcodeproj``` by using XCode, build the App and install the App on the phone. Usually, we
**do not** use the iOS App directly.
To test an App, you can fill ``Address`` field with IP-address of RPC proxy
(see above), and press ``Connect to Proxy``.
On success, "Disconnected" will change to "Connected".
On RPC proxy side you can see the next message in a log:
INFO:root:Handler ready TCPSocketProxy:<iPhone IP address>:server:iphone
Now App can be closed by pressing the home button (or even removed from a device).
## Workflow
Due to security restriction of iOS10. We cannot upload dynamic libraries to the App and load it from sandbox.
Instead, we need to build a list of libraries, pack them into the app bundle, launch the RPC server and
...
...
@@ -22,8 +44,12 @@ script, we don't need to manually operate the iOS App, this script will build th
- ```TVM_IOS_CODESIGN``` The signature you use to codesign the app and libraries (e.g. ```iPhone Developer: Name (XXXX)```)
- ```TVM_IOS_RPC_ROOT``` The root directory of the iOS rpc project
- ```TVM_IOS_RPC_PROXY_HOST``` The RPC proxy address
- ```TVM_IOS_RPC_DESTINATION``` The Xcode target device(e.g. ```platform=iOS,name=xxxx```)
- ```TVM_IOS_RPC_PROXY_HOST``` The RPC proxy address (see above)
- ```TVM_IOS_RPC_DESTINATION``` The Xcode target device (e.g. ```platform=iOS,id=xxxx```)
See instructions of how to find UUID of the iOS device:
- https://www.innerfence.com/howto/find-iphone-unique-device-identifier-udid
## How it works
Let us explain how it works, the project look for ```rpc_config.txt``` file in the project root folder.
...
...
@@ -36,7 +62,7 @@ The ```rpc_config.txt``` file should be in the following format:
```
The build script will copy all the dynamic libraries into bundle ```
tvmrpc.app/Frameworks/tvm
```,
which you will be able to load via RPC using ```
remote.load_module
```.
It will also create an ```
tvmrpc.app/Frameworks/tvm/rpc_config.txt
``` contaiing the first line.
It will also create an ```
tvmrpc.app/Frameworks/tvm/rpc_config.txt
``` contai
n
ing the first line.
When we run the testcase, the testcase read the configuration from ```
tvmrpc.app/Frameworks/tvm/rpc_config.txt
```
and connect to the specified RPC proxy, start serving loop.
...
...
apps/ios_rpc/tests/ios_rpc_test.py
View file @
2d759439
...
...
@@ -6,6 +6,8 @@ And configure the proxy host field as commented.
import
tvm
import
os
import
re
import
sys
from
tvm
import
rpc
from
tvm.contrib
import
util
,
xcode
import
numpy
as
np
...
...
@@ -15,6 +17,12 @@ proxy_host = os.environ["TVM_IOS_RPC_PROXY_HOST"]
# Set your desination via env variable.
# Should in format "platform=iOS,id=<the test device uuid>"
destination
=
os
.
environ
[
"TVM_IOS_RPC_DESTINATION"
]
if
not
re
.
match
(
r"^platform=.*,id=.*$"
,
destination
):
print
(
"Bad format: {}"
.
format
(
destination
))
print
(
"Example of expected string: platform=iOS,id=1234567890abcabcabcabc1234567890abcabcab"
)
sys
.
exit
(
1
)
proxy_port
=
9090
key
=
"iphone"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment