2.4K Star 8.1K Fork 4.3K

GVPMindSpore / mindspore

 / 详情

MindSporeLite: 推理时,MindSpore个一个线程CPU占用率100%

DONE
Bug-Report
Opened this issue  
2022-05-07 17:37

Describe the current behavior / 问题描述 (Mandatory / 必填)

使用mindspore-lite 1.7.0的CPU版本,执行mnist推理时,查看CPU占用率100%。

Environment / 环境信息 (Mandatory / 必填)

  • Hardware Environment(Ascend/GPU/CPU) / 硬件环境:
    树莓派4B

  • Software Environment / 软件环境 (Mandatory / 必填):
    mindspore: 1.7.0
    Python: 3.9.2
    debian bullseye

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

  1. 使用mnist指导,训练输出mnist模型
  2. 使用mindspore-lite加载模型并执行推理,
  3. 查看推理进程CPU占用率100%。

Describe the expected behavior / 预期结果 (Mandatory / 必填)

无推理时,CPU占用率0%。

Related log / screenshot / 日志 / 截图 (Mandatory / 必填)

top -H看到的情况:

如下线程占用100%

19308 root 20 0 3187452 39340 0 R 99.9 1.0 98:59.94 ActorThread_1

Threads: 73 total, 1 running, 72 sleeping, 0 stopped, 0 zombie
%Cpu(s): 6.7 us, 19.1 sy, 0.0 ni, 74.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 3794.5 total, 1392.5 free, 338.6 used, 2063.4 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 3313.8 avail Mem

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND

19308 root 20 0 3187452 39340 0 R 99.9 1.0 98:59.94 ActorThread_1
18609 root 20 0 3187452 39340 0 S 0.0 1.0 0:00.28 modelbox
18610 root 20 0 3187452 39340 0 S 0.0 1.0 0:00.20 modelbox
18611 root 20 0 3187452 39340 0 S 0.0 1.0 0:00.00 Control-Daemon

GDB打印对应线程的调用栈:
warning: Target and debugger are in different PID namespaces; thread lists and other data are likely unreliable. Connect to gdbserver inside the container.
0x0000007fb9723308 in sched_yield () from target:/lib/aarch64-linux-gnu/libc.so.6
(gdb) bt
#0 0x0000007fb9723308 in sched_yield () from target:/lib/aarch64-linux-gnu/libc.so.6
#1 0x0000007faa676a14 in mindspore::ActorWorker::RunWithSpin() () from target:/usr/local/mindspore-lite/runtime/lib/libmindspore-lite.so
#2 0x0000007fb9972cac in ?? () from target:/usr/lib/aarch64-linux-gnu/libstdc++.so.6
#3 0x0000007fb9e8a628 in start_thread () from target:/lib/aarch64-linux-gnu/libpthread.so.0
#4 0x0000007fb973a01c in ?? () from target:/lib/aarch64-linux-gnu/libc.so.6
(gdb) quit
A debugging session is active.

可以看到CPU一直在函数mindspore::ActorWorker::RunWithSpin()中spin。

Comments (7)

pymumu createdBug-Report

Please assign maintainer to check this issue.
请为此issue分配处理人。
@fangwenyi @chengxiaoli

Please add labels (comp or sig), also you can visit https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md to find more.
为了让代码尽快被审核,请您为Pull Request打上 组件(comp)或兴趣组(sig) 标签,打上标签的PR可直接推送给责任人进行审核。
更多的标签可以查看https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md
以组件相关代码提交为例,如果你提交的是data组件代码,你可以这样评论:
//comp/data
当然你也可以邀请data SIG组来审核代码,可以这样写:
//sig/data
另外你还可以给这个PR标记类型,例如是bugfix或者是特性需求:
//kind/bug or //kind/feature
恭喜你,你已经学会了使用命令来打标签,接下来就在下面的评论里打上标签吧!

pymumu changed description
pymumu changed description
fangwenyi changed issue state from TODO to ACCEPTED
fangwenyi set related project to MindSpore Issue Assistant
fangwenyi added
 
mindspore-assistant
label

你好,问题收到了,已经安排人员专门处理您的这个问题,请随时关注码云上信息

fangwenyi set assignee to zhaodezan

你这个树莓派什么系统,把线程数变小什么情况呢

怎么变小线程数?

看调用栈是在RunWithSpin中spin。

context里可以设置

@pymumu 你好,问题解决了吗?如果没解决的话,可以找zhaodezan支撑下
同时由于长时间没有反馈,此ISSUE先关闭,如有问题,可以反馈下具体信息,并将ISSUE状态修改为WIP,我们这边会进一步跟踪,谢谢

fangwenyi changed issue state from ACCEPTED to VALIDATION
fangwenyi changed issue state from VALIDATION to DONE

Sign in to comment

Status
Assignees
Projects
Milestones
Pull Requests
Successfully merging a pull request will close this issue.
Branches
Planed to start   -   Planed to end
-
Top level
Priority
Duration (hours)
参与者(4)
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore

Search

53164aa7 5694891 3bd8fe86 5694891