C++ AMP FFT Test Application

In previous posts we have introduced the Fast Fourier Transform (FFT) on the GPU and shared a C++ AMP FTT Library. This post further demonstrates how to use multi-dimensional transformations, and inverse transformations.

Please follow these instructions to build and execute the test application.

  1. Download the latest version of the C++ AMP FFT Library sources from CodePlex which contains the sources and project files for the library as well as the test application.
  2. Open the Visual C++ solution in Visual Studio 2012, and build it.
  3. Make sure that the amp_fft_sample project is set as the Startup Project and launch the program using Ctrl + F5. The number of dimensions (1, 2 or 3) to be used in the test can be specified as a command line argument when launching the program (Project Properties > Debugging > Command Arguments). If the number of dimensions are not specified on the command line, a default value of 1 is used which can be changed by modifying the variable number_of_dims in the function main() in driver.cpp.
  4. After amp_fft_sample executes, the data is written out in textual delimited form into a file named data.txt.
  5. From the same directory, launch the spreadsheet amp_fft.xlsm (the spreadsheet is copied to the output directory using a build rule). You may need to instruct Excel to allow macro execution and you may also need to manually click on the "Update Data" button at the top of the page to populate the charts, after enabling macro execution.
  6. The spreadsheet will now present charts depicting the input data, transformed data and inverse transformed data.

The test is a command line program that receives a single parameter, which tells it what rank of transformation to test. That can be either “1” for 1d, “2” for 2d or “3” for 3d. In any case, the program generates an input vector with 10,000 float elements, according to an arbitrary (but visually appealing when rendered in Excel!) mathematical formula that you can change as you see fit. The sample code for performing the FFT transformations is contained in the function fft_sample() in the file driver.cpp. After the input vector is generated, a 1d, 2d or 3d array is populated using it, and is transformed. The transformed array is then inverse-transformed. The final result would be nearly identical to the original input.

Here is a snapshot of the Excel charts after applying a 1d transform:

 

And here are results of the 2d transformation for the same input data:

 This concludes our discussion of FFTs for the time being. Please free to ask questions and provide feedback on our C++ AMP support forum.

 

Part I: Fast Fourier Transforms (FFT)on The GPU

Part II: C++ AMP FFT Library

Part III: C++ AMP FFT Test Application