Commit 7b6427e3 by Tianqi Chen Committed by GitHub

[RPC] Allow RPCServer to run without decorator (#257)

parent f12e781c
......@@ -35,12 +35,12 @@ def _load_lib():
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
# DMatrix functions
lib.TVMGetLastError.restype = ctypes.c_char_p
return lib
return lib, os.path.basename(lib_path[0])
# version number
__version__ = libinfo.__version__
# library instance of nnvm
_LIB = _load_lib()
_LIB, _LIB_NAME = _load_lib()
# The FFI mode of TVM
_FFI_MODE = os.environ.get("TVM_FFI", "auto")
......
......@@ -19,18 +19,25 @@ def main():
help='The end search port of the PRC')
parser.add_argument('--with-executor', type=bool, default=False,
help="Whether to load executor runtime")
parser.add_argument('--load-libary', type=str, default="",
help="Additional libary to load")
args = parser.parse_args()
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:
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
apps_path = os.path.join(curr_path, "../../../apps/graph_executor/lib/")
lib_path = find_lib_path('libtvm_graph_exec.so', apps_path)
lib = ctypes.CDLL(lib_path[0])
load_libary += ["libtvm_graph_exec.so"]
if load_libary:
for file_name in args.load_libary.split(":"):
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.libs.append(lib)
server.libs += libs
server.proc.join()
if __name__ == "__main__":
......
"""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):
"""Tag scope object to set tag for operators, working as context
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment