How to monitor CPU and GPU frequency and utilization?

@Yujie_Zhang the 4.9 kernel image has no driver for the GPU to support running desktop gl applications. It’s Mali fbdev driver which has different graphic acceleration capabilities.

For desktop graphics acceleration we suggest waiting and migrating to the new 5.15 kernel image, it has all the drivers for smoother desktop, with same capabilities as 4.9 kernel.

Regards.

@Electr1 I did not use desktop gl applications. I actually used the OpenCL library to invoke GPU for inference and wanted to measure the power of the board.

Yes on Ubuntu OpenCL driver is mapped to the NPU compute unit.

Platform Name: Vivante OpenCL Platform
Device Name: Vivante OpenCL Device VIPNano-QI.7120.0000

We are looking into this to map it to the GPU properly.

So, you mean that I actually used NPU for acceleration instead of GPU? But the acceleration code used in ARM-CL is for GPU, right?

The output of the command “clinfo” is attached.

  Platform Name                                   ARM Platform
Number of devices                                 1
  Device Name                                     Mali-G52
  Device Vendor                                   ARM
  Device Vendor ID                                0x72120000
  Device Version                                  OpenCL 2.0 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
  Driver Version                                  2.0
  Device OpenCL C Version                         OpenCL C 2.0 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               2
  Max clock frequency                             750MHz
  Device Partition                                (core)
    Max number of sub-devices                     0
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             384x384x384
  Max work group size                             384
  Preferred work group size multiple              8

@Electr1 Hello, if I want to check the GPU utilization from the file /sys/bus/platform/devices/ffe40000.gpu/devfreq/ffe40000.gpu/, do you know where I could get the mainline linux OS images?

You can check here: dl.khadas.com - Index of /.images/vim3/

Images will have 6.x as the kernel version tag for mainline.

Hello @Yujie_Zhang
I was able to reproduce your issue, latest 5.15 kernel has introduced the changes to fix this issue and
it’s observable to see usage of GPU.

khadas@Khadas:~$ clpeak --compute-sp

Platform: ARM Platform
  Device: Mali-G52 r0p0
    Driver version  : 3.0 (Linux ARM64)
    Compute units   : 2
    Clock frequency : 5 MHz

    Single-precision compute (GFLOPS)
      float   : 76.56
      float2  : 76.45
      float4  : ^C
cat: /sys/class/mpgpu/mpgpucmd: Input/output error
mpgpucmd: 
scale_mode: 1
util_cl: 100  0
util_gl: 0
utilization: 99
cur_freq: 800
domain_stat: 3
gpu_err: 0
max_freq: 4
min_freq: 0

Regards.

@Yujie_Zhang can you follow this guide ?

https://docs.khadas.com/products/sbc/vim3/applications/opencl?s[]=opencl#check-opencl-capabilities-and-details

@Electr1 Thanks for your reply. I will try the guide provided. By the way, do you know where to find the linux 5.15 OS images. I can only see the linux 4.9 and 6.1 ubuntu OS images in the download website.

Please check here:

@Electr1 Thanks very much!

Hello, @Electr1, could you tell me, is there percents of utilization in this file? Max value I can see in this file is 20.

@Ivan_Zhukov what test/program did you run to achieve 20 percentage of utilisation?

@Electr1 It was several you-tube 4k videos launched simultaneously, but this value wasn’t constant, it was like several peaks, the average value is about 5-10.

@Ivan_Zhukov mpgpu attribute mainly focus on usage of the GPU compute resources. your task is more oriented to usage of Mixed CPU and GPU graphics/shaders rather than compute, hence you are seeing lower utilization.

@Electr1 Got it, thank you for explanations.
May be this is the question for the separated topic, but I’m trying to increase knns-yolov7 demo’s fps and because of that I decided to check, which one unit is used for computations: CPU or GPU. And everything says that CPU is used. Is there some ways to involve GPU in this? Cause I have only 5 fps, it’s not very high.

@Ivan_Zhukov the extra time is incurred because of post-processing needed to be done on the outputs of YOLO,

you can see it was discussed in another topic:

@Electr1 Thank you!
Topic creator in provided topic says that his inference with yolov8n takes about 0.06 sec and leftovers about 0.25 sec, but I have the opposite situation: my inference time with VIM3 and yolov7 takes about 0.2 sec, and leftovers take about 0.05 sec. What do you think, is it ok for this VIM/yolo configuration?

Hello
I’m the Author of the topic
Are you sure that you measuring time correctly?
Also, do you use the exact code from ksnn repo or you’ve modified it?

Hello, I think yes, I print time before and after calls and calculate difference (as it organized in repo). I didn’t modify code except time tracing.