Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
56c4eeb3
Commit
56c4eeb3
authored
7 years ago
by
Tianqi Chen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix rpc tutorial (#818)
parent
8902ae7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tutorials/deployment/cross_compilation_and_rpc.py
+20
-20
20 additions, 20 deletions
tutorials/deployment/cross_compilation_and_rpc.py
with
20 additions
and
20 deletions
tutorials/deployment/cross_compilation_and_rpc.py
+
20
−
20
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment