Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    NPU算法模型推理时如何查看内存占用

    V Series
    3
    3
    1491
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      ddrddr LV 5 last edited by

      如题,V851s内存大小有点受限

      1 Reply Last reply Reply Quote Share 0
      • q1215200171
        budbool LV 9 last edited by

        查询进程所占内存的方法如下:

        //VmSize:    表示进程当前虚拟内存大小
        //VmHWM:     表示进程所占用物理内存的峰值
        //VmRSS:     表示进程当前占用物理内存的大小(与procrank中的RSS)
        static const char *GREP_KEY = "-E \"VmSize|VmRSS|VmHWM\"";
        void print_mem(const char *prefix, const char *grep)
        {
            int pid = getpid();
            char command[256];
            sprintf(command, "cat /proc/%d/status | grep %s", pid, grep);
            printf("==== %s \n", prefix);
            system(command);
            printf("\n");
        }
        

        在应用中添内存使用查询接口,使用示例如下:

        print_mem("before vip_run_network", GREP_KEY);
        status = vip_run_network(batchs[i].network);
        if (status != VIP_SUCCESS) {
            printf("fail to run network, status=%d, batchCount=%d\n", status, i);
            ret = -1;
            goto exit;
        }
        print_mem("after vip_run_network", GREP_KEY);
        
        Y 1 Reply Last reply Reply Quote Share 0
        • Y
          yzr1992 LV 3 @q1215200171 last edited by yzr1992

          @q1215200171 请问一下我们在100ASK-V853-Pro上查看内存,发现运行网络前后的内存占用情况是一模一样的,请问一下这个情况正常吗?8b0f56d5-0ac8-49e0-9739-8db5b65f756e-image.png

          1 Reply Last reply Reply Quote Share 0
          • 1 / 1
          • First post
            Last post

          Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

          行为准则 | 用户协议 | 隐私权政策