1 Reply Latest reply on Apr 6, 2015 7:51 AM by jtrudeau

    Setting strides and distances in clfft Batch computation

    renebraun

      Dear all,

       

      does any one have experience with the batch computation of an DFFT using clfft.h?

      I have the simple case of 3 arrays with 1024 elements, stored in a row, I want to transform.

      I have set the length to 1024, the strides to 1 and the input and output distances to 1024.

      The result is correct for the first array, but for the second and third, both output arrays for the real and the imaginary part contain the imaginary of the fft.

      Can anyone help? Here is the code:

       

       

        /* Size of FFT. */

        size_t N = 1024;

       

        /* FFT library realted declarations. */

        clfftPlanHandle planHandle;

        clfftDim dim = CLFFT_1D;

        size_t clLengths[1] = {N};

       

        props[1] = (cl_context_properties) platform;

        ctx = OCL->context;//clCreateContext(props, 1, &device, NULL, NULL, &err);

        queue = OCL->command_queue;//clCreateCommandQueue(ctx, device, 0, &err);

       

        /* Setup clFFT. */

        clfftSetupData fftSetup;

        err = clfftInitSetupData(&fftSetup);

        err = clfftSetup(&fftSetup);

       

        /* Create a default plan for a complex FFT. */

          err1 = clfftCreateDefaultPlan(&planHandle, ctx, dim, clLengths);

          cl_float scale = 1.0;

       

          size_t clInStrides[1];

          clInStrides[0]=1;

       

          size_t clOutStrides[1];

          clOutStrides[0]=1;

       

          size_t iDist=N;

          size_t oDist=N;

       

          size_t batchSize=3;

       

          clfftDirection dir = CLFFT_FORWARD;

       

          err = clfftSetPlanPrecision(planHandle, CLFFT_SINGLE);

          err = clfftSetLayout(planHandle, CLFFT_COMPLEX_PLANAR, CLFFT_COMPLEX_PLANAR);

          err = clfftSetResultLocation(planHandle, CLFFT_OUTOFPLACE );

          err1 = (clfftSetPlanBatchSize(planHandle, batchSize));

          err1 = (clfftSetPlanInStride(planHandle, dim, clInStrides));

          err1 = (clfftSetPlanOutStride(planHandle, dim, clOutStrides));

          err1 = (clfftGetPlanDistance(planHandle, &iDist, &oDist));

          err1 = (clfftSetPlanDistance(planHandle, iDist, oDist));

       

       

      Many thanks in advance

      Rene