Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GPU programming on Android devices

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?

like image 525
Salva Avatar asked Mar 19 '15 10:03

Salva


People also ask

How do I change my GPU settings on Android?

On your device, go to Settings and tap Developer Options. In the Monitoring section, select Profile GPU Rendering or Profile HWUI rendering, depending on the version of Android running on the device. In the Profile GPU Rendering dialog, choose On screen as bars to overlay the graphs on the screen of your device.

Does Android use GPU?

Beginning in Android 3.0 (API level 11), the Android 2D rendering pipeline supports hardware acceleration, meaning that all drawing operations that are performed on a View 's canvas use the GPU. Because of the increased resources required to enable hardware acceleration, your app will consume more RAM.

What does GPU do in Android?

In a smartphone, the GPU (graphics processing unit) is a central part of the system hardware. It differs from the CPU by handling the visual rendering elements of a phone's display, whereas the CPU is the brain of the device, handling all the heavy computation and logic behind the screen.

Can I use GPU for programming?

GPU Programming is a method of running highly parallel general-purpose computations on GPU accelerators. While the past GPUs were designed exclusively for computer graphics, today they are being used extensively for general-purpose computing (GPGPU computing) as well.


2 Answers

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.

like image 120
Robert Wang Avatar answered Sep 19 '22 23:09

Robert Wang


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

like image 38
Mitch Dart Avatar answered Sep 22 '22 23:09

Mitch Dart