Most Android phones these days use some form of ARM chip or multiple ARM chips. Using Android Studio and the NDK, it is possible to access and run some Neon instructions, which are a set of ARM instructions aimed at optimising performance for applications such as audio/video digital signal processing. Using Android Studio, it is possible to profile code running on a connected phone or on a phone emulator. In this project, you will write some C code, run it and profile it. Then you will run equivalent code, except using Neon instructions and profile it. You will then analyse and discuss the results.
ARM Neon Experimentation with Android Studio Final Assignment 2020 Part I (b) – 10% Introduction Most Android phones these days use some form of ARM chip or multiple ARM chips. Using Android Studio and the NDK, it is possible to access and run some Neon instructions, which are a set of ARM instructions aimed at optimising performance for applications such as audio/video digital signal processing. Using Android Studio, it is possible to profile code running on a connected phone or on a phone emulator. In this project, you will write some C code, run it and profile it. Then you will run equivalent code, except using Neon instructions and profile it. You will then analyse and discuss the results. Install Android Studio 1. Install Android Studio and use default options a. Download from here: https://developer.android.com/studio Install Android NDK The NDK allows users to compile and debug native (C/C++) code to run on an Android App. 1. Follow these instructions to install the Android NDK: https://developer.android.com/studio/projects/install-ndk Download hello-neon 1. Download the hello-neon Android Studio project from GitHub a. https://github.com/android/ndk-samples Open and run hello-neon Project 1. Open Android Studio 2. Navigate to the hello-neon project 3. Follow this video for instructions on how to open the hello-neon project in Android Studio 4. When the project opens, open the helloneon.c file, as shown bellow 5. On line 112, make an edit to enter your student number, as shown below: 6. Build the project, by selecting from the toolbar Build -> Make Project, as shown below: 7. On the top of the IDE, just below the toolbar, select the Nexus 5X phone emulator. This is an emulator that simulates the hardware on a Nexus 5X. Using this, we do not need to connect an android phone. i. Bonus points for connecting up a phone and running the code on an actual phone. There is lots of online documentation on how to do this. ii. Hint: you will need to set your Android phone to “developer mode” 8. Hit “Run” to run the application You should see the simulated Nexus 5 pop up after 10-30 seconds, shown below: On the screen, you will see the length of time taken to process an FIR filter written in standard C vs the time taken for an equivalent filter written using Neon instructions. It also displays how much faster the Neon version is than the standard C version. 9. On line 61, change the #define FILTER_KERNAL_SIZE to 16 and reduce the number of filter coefficients to 16, as shown below: 10. Build and run the App with these modified parameters and record the two values: i. C version ii. Neon version 11. Change FIR_KERNEL_SIZE to 32 and coefficients to 32, build and run and record the C and Neon times again (see below). 12. Change FIR_KERNEL_SIZE to 48 and coefficients to 48, build and run and record the C and Neon times again (see below). 13. Repeat this procedure, increasing the FIR filter size by increments of 16, noting the C and Neon execution times until the filter (kernel) size reaches 512. So that will be 32 runs in total. 14. Plot a graph of C execution time (Y-axis) vs Filter Kernel Size (X-axis) 15. Plot a graph of Neon execution time vs Filter Kernel Size (X-axis) on the same graph as the C execution time above, so they can be compared. Use different colours for each, so they can be seen clearly. i. Use Microsoft Excel for this if possible. If you can’t do this, use graph paper. 16. Discuss your findings in no less than 200 words.