4 Replies Latest reply on Feb 15, 2013 1:14 PM by amcelroy

    AMD FFT, 2 Plans, 1 context




      I'm trying to do 2 sequential, out of place transforms.  The first is a Real to Complex Hermitian Planar, the other from Complex Hermitian Planar back to Real.


      The general flow of the program is:

      1.) Create a Plan

      2.) FFT

      3.) Destroy the plan (Destroy Plan and Teardown)

      4.) Create a second Plan

      6.) FFT

      7.) Destroy second plan and teardown


      Steps 1 through 3 execute perfectly for 1D and 2D transforms.

      The issue is that in step 4, at the 2nd plan creation the call to the clAmdFftCreateDefaultPlan function:

                status = clAmdFftInitSetupData( setupData.get( )); //CL_SUCCESS

                status = clAmdFftSetup( setupData.get( ) ); //CL_SUCCESS

         status = clAmdFftCreateDefaultPlan( &plHandle, d->GetContext(), dim, clLengths ); //CL_NOTIMPLEMENTED. 


      Is this an issue where only one plan can be associated with 1 context until the DLL is unloaded or am I totally messing something up?




        • Re: AMD FFT, 2 Plans, 1 context

          Hi Austin,


          The library setup and teardown functions are needed only once per program. Hence, you can call clAmdFftInitSetupData and

          clAmdFftSetup once at the beginning of the program and call clAmdFftTeardown once at the end of the program.


          The plan creation (clAmdFftCreateDefaultPlan) and destruction(clAmdFftDestroyPlan) have to be called once per plan. But the number of plans can be as much as you need. And ofcourse you can reuse plan handle variable.


          With this, can you change your code and let us know if you still run into problems?

            • Re: AMD FFT, 2 Plans, 1 context

              Hey bragadeesh,


              Thanks for the suggestion.  The basic function flow is now:

              1.) clAmdFftInitSetupData

              2.)  clAmdFftSetup

              3.) Create Plan 1

              4.) Run Plan 1

              5.) Create Plan 2

              6.) Run Plan 2 - Still has the error of CL_NOTIMPLEMENTEDupon calling clAmdFftCreateDefaultPlan

              7.) Delete Plan 1

              8.) Delete Plan 2

              9.) Teardown FFT


              Plan 1 still performs flawlessly, but I'm still getting the CL_NOTIMPLEMENTED error on the 2nd plan creation.


              Are you able to run this type of program on your machine?


              Thanks for your time and effort, this is a great FFT algorithm and I'm really grateful that y'all have put out a comprehensive set of useful code!


                • Re: AMD FFT, 2 Plans, 1 context

                  Sure, Thanks for using our library.


                  When you are creating plan2, what are the parameters you are using, especially length? Looking at the error code, it says that particular feature is not implemented. If you can specify the dimension and lengths you are calling with, I can tell you if that is valid.


                  Since you are computing Real to Hermitian and back, I assume you are also calling all the appropriate accessor functions, like clAmdFftSetLayout to properly setup buffer layouts etc. Have you gone through the documentation manual? If not, please read through section 1.5 to see how to properly call the APIs to do real transforms.

                    • Re: AMD FFT, 2 Plans, 1 context

                      Hey bragadeesh,


                      Solved my problem: the input FFT was a 2D 64 by 64 Real to Hermitian Planar.  Therefore the output results were 2 arrays of 33 by 64, one for real, one for complex.  When doing the inverse from Hermitian Planar back to Real, I was telling the second FFT plan that the size of the FFT was 33, when it should have been 64.


                      Figure 1.10 had the information needed, in case others have a similar problem, so you post about re-reading the documentation was the correct answer and has been marked.


                      On question though, it says that the AMD FFT library can handle powers of 2, 3, and 5.  33 is a power of 3, but when clAmdFftCreateDefaultPlan was created with a size of 33, if gave the CL_NOTIMPLEMENTED, shouldn't this have been a valid width?


                      Thanks for your help on this issue!