GPU programming on Android devices

15,551

Solution 1

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 OpenCV 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.

Solution 2

A simple way of getting access to the GPU in android is by using OpenGL ES. The android SDK exposes all the OpenGL ES into java https://www.khronos.org/opengles/sdk/docs/man/

OpenGL ES allows you to write shaders in GLSL (Open GL Shading Language) and compile it on the GPU at runtime. https://www.opengl.org/documentation/glsl/

This GLSL code runs directly on the GPU.

For more information on OpenGL ES in Android it can be found in the Android Docs http://developer.android.com/guide/topics/graphics/opengl.html

This is a very native approach. Using libraries is completely dependent on exactly what you want to achieve with the GPU

Solution 3

Android uses OpenGL ES (Open Graphics Libary for Embedded Systems)

There are diffrent versions of OpenGL ES. I recommend to use 2.0, but you can also use 1.0 or higher versions.

Most phones support 2.0, you have more options and its faster than 1.0

Learning OpenGL is difficult and might take a while. Here is a good tutorial to get an overview: http://blog.db-in.com/all-about-opengl-es-2-x-part-1/

Apple Smartphones also use OpenGL ES so if you learn it for android you can also use it for iphones.

And yes, all android devices use OpenGL.

Share:
15,551
Salva
Author by

Salva

Updated on June 20, 2022

Comments

  • Salva
    Salva about 2 years

    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?