提交 4331d99e 编写于 作者: M MRXLT

add cuda check for gpu server

上级 78a7a868
...@@ -116,6 +116,7 @@ class Server(object): ...@@ -116,6 +116,7 @@ class Server(object):
self.reload_interval_s = 10 self.reload_interval_s = 10
self.module_path = os.path.dirname(paddle_serving_server.__file__) self.module_path = os.path.dirname(paddle_serving_server.__file__)
self.cur_path = os.getcwd() self.cur_path = os.getcwd()
self.check_cuda
self.use_local_bin = False self.use_local_bin = False
self.gpuid = 0 self.gpuid = 0
...@@ -142,6 +143,13 @@ class Server(object): ...@@ -142,6 +143,13 @@ class Server(object):
self.use_local_bin = True self.use_local_bin = True
self.bin_path = os.environ["SERVING_BIN"] self.bin_path = os.environ["SERVING_BIN"]
def check_cuda(self):
r = os.system("whereis cuda")
if r != 0:
raise SystemExit(
"CUDA not found, please check your environment or use cpu version by \"pip install paddle_serving_server\""
)
def set_gpuid(self, gpuid=0): def set_gpuid(self, gpuid=0):
self.gpuid = gpuid self.gpuid = gpuid
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册