How to tell when inference is ran by GPU or NPU on iMX8MPlus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to tell when inference is ran by GPU or NPU on iMX8MPlus

Jump to solution
3,044 Views
BrunoSenzio
Contributor III

Hello,

From the iMX Machine Learning Guide:

https://www.nxp.com/docs/en/user-guide/IMX-MACHINE-LEARNING-UG.pdf

When I am running benchmarks for TFLite models, there is an option --nnapi=true

How do I know when the inference is being done by the GPU and the NPU?

Thanks

0 Kudos
Reply
1 Solution
3,024 Views
joanxie
NXP TechSupport
NXP TechSupport

To run the inference using the GPU/NPU hardware accelerator, add the --use_nnapi=true command line argument:

For NPU: adb shell /data/local/tmp/benchmark_model --graph=/data/local/tmp/mobilenet_v2_1.0_224_quant.tflite --use_nnapi=true --nnapi_accelerator_name=vsi-npu

For GPU: adb root adb shell setprop vendor.USE_GPU_INFERENCE 1 adb shell /data/local/tmp/benchmark_model --graph=/data/local/tmp/mobilenet_v2_1.0_224_quant.tflite --use_nnapi=true

more detailed information, you can refer to the link as below,

"https://www.nxp.com/docs/en/user-guide/IMX_ANDROID_TENSORFLOWLITE_USERS_GUIDE.pdf"

View solution in original post

6 Replies
3,025 Views
joanxie
NXP TechSupport
NXP TechSupport

To run the inference using the GPU/NPU hardware accelerator, add the --use_nnapi=true command line argument:

For NPU: adb shell /data/local/tmp/benchmark_model --graph=/data/local/tmp/mobilenet_v2_1.0_224_quant.tflite --use_nnapi=true --nnapi_accelerator_name=vsi-npu

For GPU: adb root adb shell setprop vendor.USE_GPU_INFERENCE 1 adb shell /data/local/tmp/benchmark_model --graph=/data/local/tmp/mobilenet_v2_1.0_224_quant.tflite --use_nnapi=true

more detailed information, you can refer to the link as below,

"https://www.nxp.com/docs/en/user-guide/IMX_ANDROID_TENSORFLOWLITE_USERS_GUIDE.pdf"

2,054 Views
jalane
Contributor I

I would also like to know how to verify that I am running inference on the NPU vs. the GPU. 

 

I have my own scripts and have attempted to run inference on a set of models using the USE_GPU_INFERENCE environment variable.  I am using TensorFlow Lite and the VX delegate on the i.MX 8M Plus evaluation kit with the Linux v5.15.32-2.0.0 image.  The results that I am getting are so remarkably similar (warmup times within 2-3 ms of each other and inference times within 0.01 ms of each other on average) that I am skeptical that they are running on different accelerators.

 

How can I make sure that I'm actually using both devices?  Thank you.

0 Kudos
Reply
3,013 Views
BrunoSenzio
Contributor III

Thank you joanxie for clarification.

I have one more question.

I am trying to access this link:

https://community.nxp.com/community/eiq/blog/2019/07/15/eiq-sample-apps-tflite-quantization

Do you know if there is a similar link?

Thanks in advance

0 Kudos
Reply
3,006 Views
joanxie
NXP TechSupport
NXP TechSupport

I got "Page not found", I don't know what this is

 

0 Kudos
Reply
3,004 Views
BrunoSenzio
Contributor III

Hello,

It is the quantization guide for the eIQ Sample Apps from here

https://community.nxp.com/t5/eIQ-Machine-Learning-Software/eIQ-Sample-Apps-Overview/ta-p/1122925

Is there a similar link to the broken one?

 

Thanks and regards.

0 Kudos
Reply