microsoft / microsoft/onnxruntime
[Performance] running on xavier gpu but cpu usage high
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
### Describe the issue
running on xavier gpu using cuda provider but cpu usage high.
By using command top, I can see it used gpu successfully(8~9 fps). But it also used 150% of one core cpu. I want to know why and how to solve. If i use cpulimit to control it under 50%, the inference time become slower(3 fps).
Can iobinding help? Was it because of some of the ops were not supported on cuda and it has to calculate and copy data on cpu?
The onnx model can be generated and inferenced successfully with opset16 without other custom plugin or something.
I searched issues and found that most related issues care about memory, not cpu usage.
### To reproduce
my code is like: (could also use some code advices)
this->env = Ort::Env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING, "lane");
Ort::SessionOptions session_options;
OrtSessionOptionsAppendExecutionProvider_CUDA(session_options, 0);
session_options.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_ALL);
Ort::AllocatorWithDefaultOptions allocator;
this->session = new Ort::Session(this->env, model_path.c_str(), session_options);
auto input_tensors = Ort::Value::CreateTensor(memory_info, (float*)Transed_t.data, this->width * this->height * 3,
this->input_rgb_dims.data(), this->input_rgb_dims.size());
std::vector output_tensors;
output_tensors = this->session->Run(Ort::RunOptions{nullptr},
input_node_names.data(),
&input_tensors, // input tensors
1, // 1
output_node_names.data(),
output_node_names.size()); // 5
### Urgency
very urgency
### Platform
Linux
### OS Version
4.9.201
### ONNX Runtime Installation
Built from Source
### ONNX Runtime Version or Commit ID
1.12
### ONNX Runtime API
C++
### Architecture
ARM64
### Execution Provider
CUDA
### Execution Provider Library Version
cuda 10.2 (jetpack 4.5)
### Model File
_No response_
### Is this a quantized model?
No
Contributor guide
Research direction
The issue provides no repository file, model, or test to start from. Reproduce the supplied C++ Ort::Session and Run setup on the stated Xavier ARM64/Linux environment, then investigate execution-provider behavior and operator support. Done means identifying the cause of the CPU usage and documenting or verifying a resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- machine-learning, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100