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
56c4eeb3
Commit
56c4eeb3
authored
Jan 24, 2018
by
Tianqi Chen
Committed by
GitHub
Jan 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix rpc tutorial (#818)
parent
8902ae7b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
tutorials/deployment/cross_compilation_and_rpc.py
+20
-20
No files found.
tutorials/deployment/cross_compilation_and_rpc.py
View file @
56c4eeb3
...
...
@@ -23,11 +23,11 @@ for example.
# local machine, we need build runtime on remote device.
#
# .. note::
#
# All instructions in both this section and next section should be
# executed on the target device, e.g. Raspberry Pi. And we assume it
# has Linux running.
#
#
# All instructions in both this section and next section should be
# executed on the target device, e.g. Raspberry Pi. And we assume it
# has Linux running.
#
# To get started, clone tvm repo from github. It is important to clone
# the submodules along, with --recursive option (Assuming you are in
# your home directory):
...
...
@@ -102,6 +102,12 @@ for example.
# same machine, for demonstration. This line can be omitted if we
# started an remote server.
#
from
__future__
import
absolute_import
,
print_function
import
tvm
import
numpy
as
np
from
tvm.contrib
import
rpc
,
util
server
=
rpc
.
Server
(
host
=
'0.0.0.0'
,
port
=
9090
,
use_popen
=
True
)
######################################################################
...
...
@@ -110,16 +116,10 @@ server = rpc.Server(host='0.0.0.0', port=9090, use_popen=True)
#
# .. note::
#
# Now we back to the local machine, which has a full TVM installed.
# Now we back to the local machine, which has a full TVM installed.
#
# Here we will declare a simple kernel with TVM on the local machine:
from
__future__
import
absolute_import
,
print_function
import
tvm
import
numpy
as
np
from
tvm.contrib
import
rpc
,
util
n
=
tvm
.
convert
(
1024
)
A
=
tvm
.
placeholder
((
n
,),
name
=
'A'
)
B
=
tvm
.
compute
(
A
.
shape
,
lambda
*
i
:
A
(
*
i
)
+
1.0
,
name
=
'B'
)
...
...
@@ -148,7 +148,7 @@ f.save(path)
# Pi. Here we use :code:`'llvm'` directly to make the tutorial runable.
#
# Usually, you can query the target by execute :code:`gcc -v` on your
# device, and look for the line starting with :code:`Target:`
# device, and look for the line starting with :code:`Target:`
# (Though it may be still a loose configuration.)
#
# Besides :code:`-target`, you can also set other compilation options
...
...
@@ -185,14 +185,14 @@ f.save(path)
# ------------------------------
# Here we will show you how to run the kernel on the remote device:
#
# .. note::
# In order to have this tutorial runs locally to build the nice HTML, we
# start a RPC server on the local machine. You can ignore it if you already
# .. note::
# In order to have this tutorial runs locally to build the nice HTML, we
# start a RPC server on the local machine. You can ignore it if you already
# started the server on the target device. And then change host IP properly.
# Can be ignored if you already started the RPC server
server
=
rpc
.
Server
(
host
=
'0.0.0.0'
,
port
=
9090
,
use_popen
=
True
)
host
=
'0.0.0.0'
# Change to your target device IP
# Can be ignored if you already started the RPC server
server
=
rpc
.
Server
(
host
=
'0.0.0.0'
,
port
=
9090
,
use_popen
=
True
)
host
=
'0.0.0.0'
# Change to your target device IP
port
=
9090
# connect the remote device
remote
=
rpc
.
connect
(
host
,
port
)
...
...
@@ -237,7 +237,7 @@ print('%g secs/op' % cost)
# Firefly-RK3399. The target_host should be 'llvm -target=aarch64-linux-gnu'.
# But here we set 'llvm' to enable this tutorial to run locally.
#
# Also we need to build the runtime with the flag `USE_OPENCL=1`.
# Also we need to build the runtime with the flag `USE_OPENCL=1`.
# build kernel (different from cpu, we need bind axis for OpenCL)
s
=
tvm
.
create_schedule
(
B
.
op
)
...
...
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