From 3e543bd055998fa55b037f7b77d8ae4fb424a4dc Mon Sep 17 00:00:00 2001
From: eqy <eqy@cs.washington.edu>
Date: Mon, 5 Mar 2018 13:00:22 -0800
Subject: [PATCH] prevent starting of RPC server w/o RPC support (#962)

* prevent starting of RPC server w/o RPC support

* fix indent
---
 python/tvm/contrib/rpc.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/python/tvm/contrib/rpc.py b/python/tvm/contrib/rpc.py
index 831481509..56f9fb1b4 100644
--- a/python/tvm/contrib/rpc.py
+++ b/python/tvm/contrib/rpc.py
@@ -182,6 +182,11 @@ class Server(object):
                  use_popen=False,
                  exclusive=False,
                  key=""):
+        try:
+            if _ServerLoop is None:
+                raise RuntimeError("Please compile with USE_RPC=1")
+        except NameError:
+            raise RuntimeError("Please compile with USE_RPC=1")
         self.host = host
         self.port = port
         self.libs = []
-- 
GitLab