You may want to adjust application settings at runtime to deliver the best performance from device hardware. Querying the hardware configuration is the first step in making decisions which take advantage of available hardware features.
libGPUInfo is a C++ library which can be integrated into applications to easily gather information about Arm GPU hardware.
You can build an example application and run it on an Android device with an Arm GPU to read the hardware configuration information. This information identifies available features and performance levels.
The libGPUInfo library and example application is written in C++. You can build it with the Android NDK (Native Development Kit).
You can install the Android NDK on an
x86_64 Ubuntu or Debian machine using:
sudo apt update sudo apt install cmake google-android-ndk-installer -y
Retrieve the software using the
git command below and change to the repository directory:
git clone https://github.com/ARM-software/libGPUInfo.git cd libGPUInfo
Set the Android NDK environment variable to the location where the NDK is installed:
Build the application by running the script:
android_build.sh script recognizes
Debug as arguments. The default is
Release if no argument is supplied. Add
Debug as a command line argument if you want to build a debug version.
Confirm the file exists using:
If there are no build errors and the file name is printed, the application is ready to use.
To run the application on an Android device you need a computer with
adb (Android Debug Bridge) installed.
You can connect to the Android device using USB or Wi-Fi. You can use
adb to copy
arm_gpuinfo from your computer to the Android device.
If the computer you will use for
adb is not the same one you used to build the application, you can copy the
arm_gpuinfo application from the build computer to the
adbfrom Android Platform Tools
adb on Ubuntu or Debian run:
sudo apt-get install android-sdk-platform-tools -y
Android Platform Tools can be installed on
aarch64 Linux. The Android NDK requires
x86_64, but Android Platform Tools supports Arm.
Refer to the SDK Platform Tools release notes for installation information about other operating systems.
To enable debugging and other developer options visit the device settings on your Android device, find the Build Number under
About phone or
About tablet, and tap the
Build number 7 times until you see a message
You are a developer!
A new menu for
Developer options is now visible and you can enable
USB debugging and
The instructions below use USB debugging. For more information about wireless debugging refer to the
ADB developer documentation
. You will use the
adb pair command and a PIN to connect to the Android device over Wi-Fi.
Connect a USB cable between your computer with
adb installed and the Android device. A prompt saying
Allow USB Debugging? may appear on your device. If so, press
If the Android device is found it will be listed with an ID number. The output will be similar to:
List of devices attached 00000027A00013 device
If no devices are listed, there is something wrong with the connection between your computer and the Android device.
You are now ready to copy the application to the Android device and run it.
adb push to copy the file to the device and give it execute permission:
adb push ./bin/arm_gpuinfo /data/local/tmp adb shell chmod u+x /data/local/tmp/arm_gpuinfo
Run the application:
adb shell /data/local/tmp/arm_gpuinfo
The output will be similar to:
Device configuration - Manufacturer: Khadas - Model: Edge2 - Android version: 12 - Kernel version: 5.10.110 GPU configuration - Name: Mali-G610 - Architecture: Valhall - Model number: 0xa007 - Core count: 4 - L2 cache count: 4 - Total L2 cache size: 1048576 bytes - Bus width: 128 bits Per-core statistics - Engine count: 2 - FP32 FMAs: 64/cy - FP16 FMAs: 128/cy - Texels: 8/cy - Pixels: 4/cy Per-GPU statistics - FP32 FMAs: 256/cy - FP16 FMAs: 512/cy - Texels: 32/cy - Pixels: 16/cy
The configuration details will vary based on the Arm GPU and Android device you are using. The output above is from the Khadas Edge 2 single-board computer running Android 12. It includes a 4-core Mali-G610 GPU.
You have learned how to build and run a program to retrieve the hardware configuration details for Arm Mali and Immortalis GPUs.