From 42d73d727f0d704e3ce2dc363214b0de9d56c8ec Mon Sep 17 00:00:00 2001 From: MRXLT Date: Sat, 4 Apr 2020 08:51:37 +0000 Subject: [PATCH] add cuda check for gpu server --- python/paddle_serving_server_gpu/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index 3dd330b1..ab4e29c5 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -115,6 +115,7 @@ class Server(object): self.reload_interval_s = 10 self.module_path = os.path.dirname(paddle_serving_server.__file__) self.cur_path = os.getcwd() + self.check_cuda self.use_local_bin = False self.gpuid = 0 @@ -141,6 +142,13 @@ class Server(object): self.use_local_bin = True 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): self.gpuid = gpuid -- GitLab