提交 423c563a 编写于 作者: M MRXLT

fix bug for set gpu_id in rpc mode

上级 165ee728
...@@ -23,14 +23,14 @@ from multiprocessing import Pool, Process ...@@ -23,14 +23,14 @@ from multiprocessing import Pool, Process
from paddle_serving_server_gpu import serve_args from paddle_serving_server_gpu import serve_args
def start_gpu_card_model(gpuid, args): # pylint: disable=doc-string-missing def start_gpu_card_model(index, gpuid, args): # pylint: disable=doc-string-missing
gpuid = int(gpuid) gpuid = int(gpuid)
device = "gpu" device = "gpu"
port = args.port port = args.port
if gpuid == -1: if gpuid == -1:
device = "cpu" device = "cpu"
elif gpuid >= 0: elif gpuid >= 0:
port = args.port + gpuid port = args.port + index
thread_num = args.thread thread_num = args.thread
model = args.model model = args.model
workdir = "{}_{}".format(args.workdir, gpuid) workdir = "{}_{}".format(args.workdir, gpuid)
...@@ -78,6 +78,7 @@ def start_multi_card(args): # pylint: disable=doc-string-missing ...@@ -78,6 +78,7 @@ def start_multi_card(args): # pylint: disable=doc-string-missing
p = Process( p = Process(
target=start_gpu_card_model, args=( target=start_gpu_card_model, args=(
i, i,
gpu_id,
args, )) args, ))
gpu_processes.append(p) gpu_processes.append(p)
for p in gpu_processes: for p in gpu_processes:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册