提交 42d73d72 编写于 作者: M MRXLT

add cuda check for gpu server

上级 55862ae0
...@@ -115,6 +115,7 @@ class Server(object): ...@@ -115,6 +115,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
...@@ -141,6 +142,13 @@ class Server(object): ...@@ -141,6 +142,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.
先完成此消息的编辑!
想要评论请 注册