GPU programming on Android devices

Salva picture Salva · Mar 19, 2015 · Viewed 13.6k times · Source

I have no knowledge of GPU programming and I'd like an overview of this. I must develop a project of Image Processing, working on smartphones' s GPU (on Android devices), but I don't know where to start.

1)Programming Smartphone's GPU and programming other GPU (Nvidia GeForce 9 for example) are equal?

2)I heard about computation or graphic programming for GPU: what's the difference? Are them equal?

3)I already configured Eclipse to develop Android apps: what other tools do I need?

4)Smartphone's GPU programming (for Android) is device independent? Is it the same for Samsung S4, LG G3, and other Android device?

5) What library do I need? I heard about OpenCV and Tegra pack of Nvidia.

Can you help me with this? Also, can you help me with any targeted links?

Answer

Robert Wang picture Robert Wang · Oct 14, 2015

1)Programming Smartphone's GPU and programming other GPU (Nvidia GeForce 9 for example) are equal?

Not always. For example, depending on which APIs and hardware platform you use, some mobile devices allow you to develop exactly the same program as you do for the desktop GPU.

For example, if you do CUDA program on Tegra K1/X1 devices, that would be almost the same as you would do on the GeForce 9.

But, if you use OpenCL, you need to be careful. Some mobile devices only support OpenCL Embedded Profile, which means features are limited compared to the desktop GPU. Even if some mobile devices support OpenCL full profile, you still have fewer resources to deal with, therefore, the program still need to be modified to adapt to the mobile platforms.

2)I herd about computation or graphic programming for GPU: what's the difference? Are them equal?

Graphics programming focuses more on the graphics rendering. The goal is to draw something on the screen. The major APIs you would need for phone would be OpenGL ES for Android, or Metal for iOS, or DX for Windows.

The computation for GPU means that you want to finish some tasks not related to graphics rendering, instead, you need to calculate some equation or compute some values from the input numbers. For example, you may want to filter an image or process some video and so on. The major APIs for compute is OpenCL, CUDA, and Metal.

3)I already configured Eclipse to develop Android apps: what other tools I need?

You need Android NDK of course. You need OpenCL libraries, or SDK for the mobile device you have.

4)Smartphone's GPU programming (for Android) is device independent? It' s the same for Samsung S4, LG G3, and other Android device?

Of course the device capability has huge difference in what you can do. The major difference is in the chipset used in the phone. That will determine what SDK you should use and the hardware features will be quite different.

Another thing to notice is that GPU programming is typically not performance-portable due to the huge hardware difference. So a very well optimized source code on one phone might not be the best on another phone.

5)What library I need?I herd about OpenCV and Tegra pack of Nvidia.

OpenCV is computer vision library. Whether you need it or not depends on what types of algorithms you work on. If your applications heavily rely on some image processing and computer vision algorithms, you may find OepnCV useful. But definitely you can always start with your own simple libraries.

Tegra NVPack is nothing special. It is just a software/SDK bundle containing Android development SDK, NDK, IDEs and tools, along with NVidia's SDKs. You can always set up your own environment by installing separate SDKs and tools. But if you develop for NVidia platforms, the NVPack might be easier for you to start with.