Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

C6EZRun Pi Estimation Example

From Texas Instruments Wiki
Jump to: navigation, search

END OF LIFE

C6Run is still available for download, but is no longer being actively developed or maintained. Please consider other alternatives such as, Codec Engine IUNIVERSAL support, OpenCL or RCM.

^ Up to main C6EZRun Main Page ^

This article is part of a collection of articles describing the C6EZRun Software Development Project. Select the link above to return to the main project page.

Introduction

This example uses an iterative method to estimate the value of pi. The usage here shows off the C6Run project, which is an ease-of-use tool for ARM developers to leverage the DSP on TI's DSP+ARM embedded processors. The performance is compared between the ARM and DSP cores on the TI OMAP-L138 embedded processor using both the C6RunLib and C6RunApp tools.

Pi Estimation

This Wikipedia article gives a good overview of the many methods used to approximate the value of pi. The method used for this demo is the Leibniz formula for π, a slowly converging series that provides a lot of room for optimization.

Procedures

To build the C6Run-enhanced pi estimation demo, you can follow the steps given below:

  • Make sure the C6Run tool has been configured and the back-end libraries have been built. Within an SDK4 environment, this can be done by
[host] $ make c6run
from the top level of the SDK4 install directory
  • Source the needed C6Run variables by executing the following:
[host] $ source <C6RUN_INSTALL_DIR>/environment.sh
  • Create a directory for storing the executable binaries:
[host] $ mkdir ${HOME}/targetfs/home/root/omapl138/pi 
  • Download the source code here and extract the files by typing
[host] $tar -zxvf Pi_source.tar.gz
  • Navigate to the C6RunApp directory
[host] $ cd <pi_source_download_directory>/C6RunApp/ 
and build the project with
[host] $ make all 
  • Copy the generated binaries into the created directory:
[host] $ cp pi_arm ${HOME}/targetfs/home/root/omapl138/pi
[host] $ cp pi_dsp_c6run_app ${HOME}/targetfs/home/root/omapl138/pi 
  • Now navigate to the C6RunLib directory and build the project:
[host] $ cd ../C6RunLib/ 
[host] $ make all
  • Copy the generated binaries into the created directory:
[host] $ cp pi_arm ${HOME}/targetfs/home/root/omapl138/pi
[host] $ cp pi_dsp_c6run_lib ${HOME}/targetfs/home/root/omapl138/pi 
Note: the pi_arm application generated by the C6RunApp tool is identical to that from the C6RunLib tool
  • On the target board, navigate to the created directory containing all of the binaries:
[target] $ cd /home/root/omapl138/pi/ 
  • In order to run the C6Run applications, we'll need to unload and reload the necessary kernel modules needed by the application. If other applications haven't previous loaded any of the modules(CMEM, DSPLink, potentially LPM as well), unloading the modules will not be necessary (but it won't hurt either).
[target] $ cd /usr/share/ti/c6run-apps/
[target] $ ./unloadmodules.sh
[target] $ ./loadmodules.sh
  • Run the applications to observe the performance differences:
[target] $ ./pi_arm 
[target] $ ./pi_dsp_c6run_app
[target] $ ./pi_dsp_c6run_lib


Results

The following are screen shots of the execution. The execution time in the DSP decreased by about a factor of 4, and there is a slight performance improvement in using C6RunLib over C6RunApp in this case:

Using the ARM:
Pi arm.png

Using the DSP with C6RunApp:
Pi dsp c6run app.png

Using the DSP with C6RunLib:
Pi dsp c6run lib.png

^ Up to main C6EZRun Main Page ^

This article is part of a collection of articles describing the C6EZRun Software Development Project. Select the link above to return to the main project page.