GPU Computing

cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-channel FFT

Hello,

I'm trying to run the Multi-channel FFT example with replacing the Complex Single (CSG) type by a Double (DBL) type but it doesn't work and I don't understand why.

Please could you help me ?

To use the Double type in the Multi-channel FFT example, I follow these steps :

1. For the creation of the FFT plan, I change the FFT type from "CUFFT_C2C" to "CUFFT_D2Z".

2. For the memory allocation, I change the type from "CSG" to "DBL".

3. For the output and input channel data, I change the type of the array from "CSG" to "DBL".

In my mind, these modifications should be sufficent but it doesn't work.

Then I disconnect the input batch of the VI that creates the FFT plan and it works but only for one signal (that is expected).

My configuration is :

Windows XP, 2002 version, SP3

            Intel Core 2 Quad, Q9550 @ 2.83GHz

            3.25 Go RAM

NVIDIA GeForce GTX 460

NVIDIA CUDA 5.0

LabVIEW 2012, Version 12.0f3 (32-bit)

LabVIEW GPU Analysis Toolkit 2012 (32-bit)

What is the problem ?

Thanks for your help,

Eric

0 Kudos
Message 1 of 7
(8,716 Views)

It sounds like you want to do a real FFT. If that's the case, then your output has to be CDB and not DBL so it won't be an inplace operation. An easier transition would be to update the example for CDB data and use CUFFT_Z2Z.

Once that works, then you could remove the inplaceness by allocating a new DBL buffer for the input leaving the CDB buffer for output. Wire both of these to the CUFFT_D2Z (DBL to signal in CDB to spectrum in). Wire spectrum out to Upload Data VI and give it a CDB destination array and you'll get the results.

Some Inplaceness Details

CUFFT library offers ways to do this inplace using only DBL or CDB data but you have to 'pack' the data accordingly for batch processing. I do expose this interface in the FFT VI but you have to select the correct instance and follow NVIDIA's rules for preparing the data (found in their online documentation of CUFFT).

For the inplace operation using CDB data, pack DBL data into the real and imaginary components of the CDB array leaving space between each signal before downloading the entire CDB array.

For inplaceness with DBL, you have to do the same signal spacing up front with a DBL array that's twice the size (to hold the CDB data) and then convert the DBL array to a CDB array after uploading. The latter may be done using the Type Cast operator but I don't think LV gaurantees this won't make an additional copy.

0 Kudos
Message 2 of 7
(6,805 Views)

Thanks for your answer, now it works fine and i can perform a real FFT.

The implaceness was a bit confusing for me, especially concerning the FFT type "DBL->DBL".

May be more information in the function help could help other users.

Thanks a lot,

Eric

0 Kudos
Message 3 of 7
(6,805 Views)

Sorry for the confusion. The online help only documents each instance. It's not possible to map each instance to a unique C API in NVIDIA's library.

The in-place transform for a real FFT ends up being a complicated use case because an understanding of NVIDIA's function and the C API including parameter types is needed. We typically don't subject LV users to information on external languages such as C.

It would be possible to create a KB on the topic if you think that you could have successfully solved your issue from documentation alone.

0 Kudos
Message 4 of 7
(6,805 Views)

MathGuy,

Yes, I think adding information about the real FFT using GPU is interesting.

The KB is a good idea and it could help users that are looking for advanced information.

I suggest to add also a LV example that could be more useful in a first approach.

This example could be also interesting to demonstrate how perform a 2D FFT, e.g. on an image.

Thanks for your help,

Eric

0 Kudos
Message 5 of 7
(6,805 Views)

The existing can be converted to do a 2D FFT. Wire the batch input to the column input of the Initialize Library VI and leave the batch input unwired (defaults to 1). This results in a 2D FFT computation.

Introducing image data requires changes to the LV arrays and corresponding dimensional inputs. VIs such as Download Data and Upload Data will automatically select their 2D instances and work as expected. As the FFT does not offer integer formats, pixels will have to be stored in floating-point format for processing.

0 Kudos
Message 6 of 7
(6,805 Views)

Thanks for your advices that are very useful for me to better understand and use the GPU Analysis Toolkit.

0 Kudos
Message 7 of 7
(6,805 Views)