diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index 3dd330b18921c81cf17601ff7e52d860f0322f95..ab4e29c5b97ba02835ae253b949f93baacd72ecb 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