Deploying the Android NN driver

If you don’t see a significant performance acceleration when Arm NN is enabled on your Android phone, you need to upgrade your Android NN driver to the latest version.

To use the latest Arm NN Android driver, you need to start the driver service. The LiveStyle app will create a delegate that automatically uses the service.

Before you begin, you will need:

  • An Android phone with root access
  • A host machine that supports adb
  • Adb on host
  • A latest pre-built Arm NN android-nn driver on host
  • The built Livestyle app on your device

Follow these steps:

  1. Transfer the driver from the host to a local folder on the phone. You must put the driver in a directory with read/write permissions. Here is an example of transferring the driver to the data/local/tmp folder of your phone:
    user@host: adb push <ArmNN android-nn driver> /data/local/tmp
  2. Log into the Android shell to start the driver service, as you can see in the following code:
    user@host: adb shell
    * daemon not running; starting now at tcp:5037
    * daemon started successfully
    
  3. Log in as root by typing su and cd into the directory containing the latest driver we just pushed, as you can see here:
    user@android: su
    root@android: cd /data/local/tmp
  4. Start the driver in the background. To make it explicit, pass the -c GpuAcc to enable GPU (OpenCL) acceleration.
    root@android: ./ -c GpuAcc &
  5. Open another shell on your host machine, and do a log cat on the most recent kernel messages, as you can see in the following code. This will verify whether the app is using our driver or not:
    user@host: adb log cat -T 10 | grep Arm NN
  6. Run the app on your phone. Choose a style and click TAKE A PICTURE. You should see output containing Arm NN driver information on log cat . The output of log cat should look something like what you can see in this code:
    <Time stamp><PID><PID>V ArmnnDriver: 
    ArmnnPreparedModel::execute(): 1 input(s), 37 operation(s), 1 output(s), 185 operand(s) … <Time stamp><PID><PID>V Arm NN Driver:
Previous Next