Designing the Block Diagram to Compute on a GPU Device (GPU Analysis Toolkit)

LabVIEW 2012 GPU Analysis Toolkit Help

Edition Date: June 2012

Part Number: 373575A-01

»View Product Info
Download Help (Windows Only)

The following illustrations show the common steps for communicating with a GPU device from the block diagram. This workflow applies to offloading either FFT or BLAS operations in a LabVIEW application. To create an application that integrates a GPU, use the GPU Analysis VIs.

The GPU Analysis Toolkit provides an example of an application that offloads FFT operations with both a large data set and a large number of parallel tasks. The following illustrations are taken from the block diagram of the Multi-channel FFT VI in the Multi-channel FFT LabVIEW project, and you can refer to this example in the labview\examples\lvgpu directory to see where these illustrations fit into the entire application design.

Note  This example computes the FFTs of simulated signals from multiple simulated channels. In a real application, you might acquire the signal or spectrum input data from a DAQ device or read it from a log file.

I. Initializing GPU Resources

The Initialize Device VI creates the special execution environment, or context, necessary for LabVIEW to communicate with the GPU.

The Initialize Library VI prepares the GPU for FFT operations by selecting the FFT to compute. The initialization process reserves resources on the GPU device to improve performance. The FFT type includes information on the FFT size, the number of FFTs to perform in parallel on the GPU, and the data type of the input signals or spectrums. You can select from the following types:

  • CUFFT_C2C: (Inverse) Complex FFT – CSG
  • CUFFT_R2C: Real FFT – SGL
  • CUFFT_C2R: Inverse Real FFT – SGL
  • CUFFT_Z2Z: (Inverse) Complex FFT – CDB
  • CUFFT_D2Z: Real FFT – DBL
  • CUFFT_Z2D: Inverse Real FFT – DBL

The Allocate Memory VI acquires memory in the form of a buffer from the GPU device. The buffer stores both the channel data for downloading onto the GPU (step 4) and the results of the computations performed on the GPU for uploading to the CPU (step 6).

II. Performing FFT Computations on the GPU

Note  If you perform the following three steps in a loop, then the application needs only to initialize and release resources once.

The Download Data VI transfers the channels of data—stored in a LabVIEW array—to the buffer on the GPU device allocated in step 3. This example shows the individual channels stored in the rows of a 2D array. You also can download multiple channels stored sequentially in a 1D array.

The FFT VI computes the spectrum simultaneously for each channel downloaded.

The Upload Data VI transfers the spectral data—stored in a buffer on the GPU device—to a LabVIEW array for use elsewhere on the block diagram.

III. Releasing GPU Resources

Note  Perform the following three steps in the order described.

The Free Memory VI releases the buffer on the GPU that stores the FFT data.

The Release Library VI frees any resources on the GPU reserved since initialization for FFT computations.

The Release Device VI frees any resources on the GPU device reserved since initialization, including resources for communication with the GPU and any active processes on the GPU that began after initialization.


Not Helpful