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
7b6427e3
Commit
7b6427e3
authored
Jul 17, 2017
by
Tianqi Chen
Committed by
GitHub
Jul 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RPC] Allow RPCServer to run without decorator (#257)
parent
f12e781c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
9 deletions
+22
-9
python/tvm/_ffi/base.py
+2
-2
python/tvm/exec/rpc_server.py
+13
-6
python/tvm/tag.py
+7
-1
No files found.
python/tvm/_ffi/base.py
View file @
7b6427e3
...
@@ -35,12 +35,12 @@ def _load_lib():
...
@@ -35,12 +35,12 @@ def _load_lib():
lib
=
ctypes
.
CDLL
(
lib_path
[
0
],
ctypes
.
RTLD_GLOBAL
)
lib
=
ctypes
.
CDLL
(
lib_path
[
0
],
ctypes
.
RTLD_GLOBAL
)
# DMatrix functions
# DMatrix functions
lib
.
TVMGetLastError
.
restype
=
ctypes
.
c_char_p
lib
.
TVMGetLastError
.
restype
=
ctypes
.
c_char_p
return
lib
return
lib
,
os
.
path
.
basename
(
lib_path
[
0
])
# version number
# version number
__version__
=
libinfo
.
__version__
__version__
=
libinfo
.
__version__
# library instance of nnvm
# library instance of nnvm
_LIB
=
_load_lib
()
_LIB
,
_LIB_NAME
=
_load_lib
()
# The FFI mode of TVM
# The FFI mode of TVM
_FFI_MODE
=
os
.
environ
.
get
(
"TVM_FFI"
,
"auto"
)
_FFI_MODE
=
os
.
environ
.
get
(
"TVM_FFI"
,
"auto"
)
...
...
python/tvm/exec/rpc_server.py
View file @
7b6427e3
...
@@ -19,18 +19,25 @@ def main():
...
@@ -19,18 +19,25 @@ def main():
help
=
'The end search port of the PRC'
)
help
=
'The end search port of the PRC'
)
parser
.
add_argument
(
'--with-executor'
,
type
=
bool
,
default
=
False
,
parser
.
add_argument
(
'--with-executor'
,
type
=
bool
,
default
=
False
,
help
=
"Whether to load executor runtime"
)
help
=
"Whether to load executor runtime"
)
parser
.
add_argument
(
'--load-libary'
,
type
=
str
,
default
=
""
,
help
=
"Additional libary to load"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
logging
.
basicConfig
(
level
=
logging
.
INFO
)
logging
.
basicConfig
(
level
=
logging
.
INFO
)
load_libary
=
args
.
load_libary
.
split
(
":"
)
curr_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
__file__
)))
apps_path
=
os
.
path
.
join
(
curr_path
,
"../../../apps/graph_executor/lib/"
)
libs
=
[]
if
args
.
with_executor
:
if
args
.
with_executor
:
curr_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
__file__
)))
load_libary
+=
[
"libtvm_graph_exec.so"
]
apps_path
=
os
.
path
.
join
(
curr_path
,
"../../../apps/graph_executor/lib/"
)
if
load_libary
:
lib_path
=
find_lib_path
(
'libtvm_graph_exec.so'
,
apps_path
)
for
file_name
in
args
.
load_libary
.
split
(
":"
):
lib
=
ctypes
.
CDLL
(
lib_path
[
0
])
file_name
=
find_lib_path
(
file_name
,
apps_path
)[
0
]
libs
.
append
(
ctypes
.
CDLL
(
file_name
,
ctypes
.
RTLD_GLOBAL
))
logging
.
info
(
"Load additional libary
%
s"
,
file_name
)
server
=
rpc
.
Server
(
args
.
host
,
args
.
port
,
args
.
port_end
)
server
=
rpc
.
Server
(
args
.
host
,
args
.
port
,
args
.
port_end
)
server
.
libs
.
append
(
lib
)
server
.
libs
+=
libs
server
.
proc
.
join
()
server
.
proc
.
join
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
python/tvm/tag.py
View file @
7b6427e3
"""Tag class for TVM operators."""
"""Tag class for TVM operators."""
from
decorator
import
decorate
from
._ffi.base
import
_LIB_NAME
try
:
from
decorator
import
decorate
except
ImportError
as
err_msg
:
# Allow decorator to be missing in runtime
if
_LIB_NAME
!=
"libtvm_runtime.so"
:
raise
err_msg
class
TagScope
(
object
):
class
TagScope
(
object
):
"""Tag scope object to set tag for operators, working as context
"""Tag scope object to set tag for operators, working as context
...
...
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