×

签到

分享到微信

打开微信,使用扫一扫进入页面后,点击右上角菜单,

点击“发送给朋友”或“分享到朋友圈”完成分享

cndevGetProcessUtilization接口返回BUG 已完结 haozhou.wong2025-02-06 12:08:58 回复 11 查看 技术答疑 使用求助 经验交流
cndevGetProcessUtilization接口返回BUG
分享到:

我使用samples里面提供的devicequery代码来获取每个进程的利用率

当系统中只有一个进程时候,cndevGetProcessUtilization接口返回的mem_util是正确的,如下所示

image.png

当我有启动一个相同进程的时候,cndevGetProcessUtilization接口返回的mem_util异常,表现为其中一个进程的mem_util始终为0

image.png

代码如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

51




#include 
#include 
 
int main() {
  // init libcndev
  cndevRet_t ret = cndevInit(0);
  // you can compare cndevRet manually, or just use cndevCheckErrors
  if (CNDEV_SUCCESS != ret) {
    printf("cndev init failed: %s.\n", cndevGetErrorString(ret));
    // should exit now
    exit(0);
  }
 
  cndevDevice_t devHandle;
  ret = cndevGetDeviceHandleByIndex(0, &devHandle);
  cndevCheckErrors(ret);
 
  while (1) {
    // get card[x]'s process utilization
    // in most cases, the number of processes running on a card will not exceed 10
<div class="line number21 index20 alt2" style="border-radius: 0px !important; background: none !important; border: 0px !important; inset: auto !important; float: none !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; vertical-al

版权所有 © 2025 寒武纪 Cambricon.com 备案/许可证号:京ICP备17003415号-1
关闭