Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support set xpu id #1436

Merged
merged 2 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions paddle_inference/paddle/include/paddle_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class PaddleInferenceEngine : public EngineCore {
if (engine_conf.has_use_xpu() && engine_conf.use_xpu()) {
// 2 MB l3 cache
config.EnableXpu(2 * 1024 * 1024);
config.SetXpuDeviceId(gpu_id);
}

if (engine_conf.has_enable_memory_optimization() &&
Expand Down
1 change: 1 addition & 0 deletions python/paddle_serving_app/local_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def load_model_config(self,
if use_xpu:
# 2MB l3 cache
config.enable_xpu(8 * 1024 * 1024)
config.set_xpu_device_id(gpu_id)
# set cpu low precision
if not use_gpu and not use_lite:
if precision_type == paddle_infer.PrecisionType.Int8:
Expand Down
4 changes: 4 additions & 0 deletions python/pipeline/local_service_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ def _prepare_one_server(self, workdir, port, gpuid, thread_num, mem_optim,
server.set_gpuid(gpuid)
# TODO: support arm or arm + xpu later
server.set_device(self._device_name)
if self._use_xpu:
server.set_xpu()
if self._use_lite:
server.set_lite()

server.set_op_sequence(op_seq_maker.get_op_sequence())
server.set_num_threads(thread_num)
Expand Down