MNN icon indicating copy to clipboard operation
MNN copied to clipboard

How to limit mali gpu usage?

Open HaoLiuHust opened this issue 7 years ago • 13 comments

I want to use MNN on mali gpu, however, MNN will make the usage of gpu 100%, the UI will performance poor when use it, is there a way to limit the usage to ensure the UI works well?

HaoLiuHust avatar Dec 03 '19 02:12 HaoLiuHust

could you please tell me how to get the usage of mali gpu, thanks

kl456123 avatar Dec 03 '19 02:12 kl456123

could you please tell me how to get the usage of mali gpu, thanks

  1. modify CMakeLists.txt in MNN directory, open option(MNN_OPENCL "Enable OpenCL" ON)
  2. recompile MNN source code combining your options.
cmake .. -DMNN_BUILD_DEMO=ON -DMNN_BUILD_CONVERTER=true -DOpenCL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu/ && make -j6

However, many models are not running on gpu with partial op dimension are not supported on opencl, error info is reshape not support dimensions == 3 The Creator Don't support type 73, 257. While, you can use mobilenet, etc, demo_zoo provided by MNN. Reference link is https://www.yuque.com/mnn/en/demo_zoo In addition, few face detection demos are provided to learn MNN framework. UltraFace: https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB/issues/95 BlazeFace: https://github.com/xindongzhang/MNN-APPLICATIONS/issues/15 LFFD: https://github.com/SyGoing/LFFD-MNN

HangJie720 avatar Dec 03 '19 06:12 HangJie720

could you please tell me how to get the usage of mali gpu, thanks

  1. modify CMakeLists.txt in MNN directory, open option(MNN_OPENCL "Enable OpenCL" ON)
  2. recompile MNN source code combining your options.
cmake .. -DMNN_BUILD_DEMO=ON -DMNN_BUILD_CONVERTER=true -DOpenCL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu/ && make -j6

However, many models are not running on gpu with partial op dimension are not supported on opencl, error info is reshape not support dimensions == 3 The Creator Don't support type 73, 257. While, you can use mobilenet, etc, demo_zoo provided by MNN. Reference link is https://www.yuque.com/mnn/en/demo_zoo In addition, few face detection demos are provided to learn MNN framework. UltraFace: Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB#95 BlazeFace: xindongzhang/MNN-APPLICATIONS#15 LFFD: https://github.com/SyGoing/LFFD-MNN

What are you talking about ??

kl456123 avatar Dec 03 '19 07:12 kl456123

could you please tell me how to get the usage of mali gpu, thanks

  1. modify CMakeLists.txt in MNN directory, open option(MNN_OPENCL "Enable OpenCL" ON)
  2. recompile MNN source code combining your options.
cmake .. -DMNN_BUILD_DEMO=ON -DMNN_BUILD_CONVERTER=true -DOpenCL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu/ && make -j6

However, many models are not running on gpu with partial op dimension are not supported on opencl, error info is reshape not support dimensions == 3 The Creator Don't support type 73, 257. While, you can use mobilenet, etc, demo_zoo provided by MNN. Reference link is https://www.yuque.com/mnn/en/demo_zoo In addition, few face detection demos are provided to learn MNN framework. UltraFace: Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB#95 BlazeFace: xindongzhang/MNN-APPLICATIONS#15 LFFD: https://github.com/SyGoing/LFFD-MNN

What are you talking about ??

I just want to show you how to compile MNN supported on ARM Mali GPU, and some demos are provided for application. If you can ,please ignore it.

HangJie720 avatar Dec 03 '19 08:12 HangJie720

solved by limit the CommandQueue size

HaoLiuHust avatar Dec 03 '19 08:12 HaoLiuHust

I will propose a PR after I change the code more appropriate if needed

HaoLiuHust avatar Dec 03 '19 08:12 HaoLiuHust

cat /sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/load try this @kl456123 , ff9a0000 may be replaced by your gpu number

HaoLiuHust avatar Dec 03 '19 08:12 HaoLiuHust

I will propose a PR after I change the code more appropriate if needed

Hi @HaoLiuHust Did you eventually have it proposed or not? If negative, could you please give a hint for how you solve this by limiting the CommandQueue size? Thanks.

jules-ai avatar Sep 27 '20 02:09 jules-ai

I will propose a PR after I change the code more appropriate if needed

Hi @HaoLiuHust Did you eventually have it proposed or not? If negative, could you please give a hint for how you solve this by limiting the CommandQueue size? Thanks.

No, did not propose a PR yet. You can refer to Mace. they have implement a CommandQueue when use GPU

HaoLiuHust avatar Sep 28 '20 01:09 HaoLiuHust

I will propose a PR after I change the code more appropriate if needed

Hi @HaoLiuHust Did you eventually have it proposed or not? If negative, could you please give a hint for how you solve this by limiting the CommandQueue size? Thanks.

https://github.com/HaoLiuHust/MNN/commit/8050a23dc7600b3f6bfdd42edab4423243f056c4 https://github.com/HaoLiuHust/MNN/commit/18b5837a05ff12f7e6abffd38729d76fdf76b8bf

you can refer to my commits

HaoLiuHust avatar Sep 28 '20 01:09 HaoLiuHust

I will propose a PR after I change the code more appropriate if needed

Hi @HaoLiuHust Did you eventually have it proposed or not? If negative, could you please give a hint for how you solve this by limiting the CommandQueue size? Thanks.

HaoLiuHust@8050a23 HaoLiuHust@18b5837

you can refer to my commits

Thanks Hao, your idea inspired me a lot. (Apart from few syntex errors). It works very well on my rk3288 board.

jules-ai avatar Oct 12 '20 04:10 jules-ai

I will propose a PR after I change the code more appropriate if needed

Hi @HaoLiuHust Did you eventually have it proposed or not? If negative, could you please give a hint for how you solve this by limiting the CommandQueue size? Thanks.

HaoLiuHust@8050a23 HaoLiuHust@18b5837 you can refer to my commits

Thanks Hao, your idea inspired me a lot. (Apart from few syntex errors). It works very well on my rk3288 board.

glad to hear that

HaoLiuHust avatar Oct 12 '20 06:10 HaoLiuHust

DOpenCL_INCLUDE_DIR=

你好,麻烦问一下,我编译加这一句好像不起作用。不加编译通过(cmake -DCMAKE_TOOLCHAIN_FILE=../project/cross-compile/arm.toolchain.cmake -DARM_NAME=hisi3559a100 -DMNN_OPENCL=ON ..),在arm 上运行报错,Failed creating base context during opening of kernel driver. Kernel module may not have been loaded Build program failed ! programName.c_str()=s buffer_to_image in buildKernel, 305 ERROR CODE : -44

dan520520520 avatar Dec 03 '20 02:12 dan520520520