提交 2f4d7754 编写于 作者: M MRXLT

fix check cuda

上级 4d25f387
...@@ -235,15 +235,11 @@ class Server(object): ...@@ -235,15 +235,11 @@ class Server(object):
self.bin_path = os.environ["SERVING_BIN"] self.bin_path = os.environ["SERVING_BIN"]
def check_cuda(self): def check_cuda(self):
cuda_flag = False if os.system("ls /dev/ | grep nvidia > /dev/null") == 0:
r = os.popen("ldd {} | grep cudart".format(self.bin_path)) pass
r = r.read().split("=") else:
if len(r) >= 2 and "cudart" in r[1] and os.system(
"ls /dev/ | grep nvidia > /dev/null") == 0:
cuda_flag = True
if not cuda_flag:
raise SystemExit( raise SystemExit(
"CUDA not found, please check your environment or use cpu version by \"pip install paddle_serving_server\"" "GPU 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):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册