From 8bf94d0dfc09f513fa2c63b861bbaa93ffffc82a Mon Sep 17 00:00:00 2001 From: MRXLT Date: Thu, 2 Apr 2020 15:43:06 +0800 Subject: [PATCH] add mem_optim for gpu server --- python/paddle_serving_server_gpu/__init__.py | 2 ++ python/paddle_serving_server_gpu/serve.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/python/paddle_serving_server_gpu/__init__.py b/python/paddle_serving_server_gpu/__init__.py index 2fd35c6d..3dd330b1 100644 --- a/python/paddle_serving_server_gpu/__init__.py +++ b/python/paddle_serving_server_gpu/__init__.py @@ -43,6 +43,8 @@ def serve_args(): parser.add_argument("--gpu_ids", type=str, default="", help="gpu ids") parser.add_argument( "--name", type=str, default="None", help="Default service name") + parser.add_argument( + "--mem_optim", type=bool, default=False, help="Memory optimize") return parser.parse_args() diff --git a/python/paddle_serving_server_gpu/serve.py b/python/paddle_serving_server_gpu/serve.py index d09efbfc..cb82e02c 100644 --- a/python/paddle_serving_server_gpu/serve.py +++ b/python/paddle_serving_server_gpu/serve.py @@ -33,6 +33,7 @@ def start_gpu_card_model(index, gpuid, args): # pylint: disable=doc-string-miss port = args.port + index thread_num = args.thread model = args.model + mem_optim = args.mem_optim workdir = "{}_{}".format(args.workdir, gpuid) if model == "": @@ -53,6 +54,7 @@ def start_gpu_card_model(index, gpuid, args): # pylint: disable=doc-string-miss server = serving.Server() server.set_op_sequence(op_seq_maker.get_op_sequence()) server.set_num_threads(thread_num) + server.set_memory_optimize(mem_optim) server.load_model_config(model) server.prepare_server(workdir=workdir, port=port, device=device) -- GitLab