diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index abe93a1ce74fa846774425827b9a3ebbdc670450..6f0ece74eeccc40eaf9676738e15e7b52b9da9ce 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -116,6 +116,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 @@ -142,6 +143,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