cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

gdebrecz
Journeyman III

Apple's FFT on AMD cards with C++ OpenCL API

Hi,

I'm trying to run Apple's clFFT on AMD cards using the OpenCL C++ API, to

create the platform, context and devices, queues. It seems that it works only

for the C API, but not for the C++.

On Nvidia Cards it works both with C and C++ API.

Here it is the C way of creating the context,

-----------------------------------------------

    cl_uint numPlatforms;

    cl_platform_id platform = NULL;

    err = clGetPlatformIDs(0, NULL, &numPlatforms);

    cout << "clGetPlatformIDS status : " << err << endl;

    if (0 < numPlatforms) {

         cl_platform_id* platforms = new cl_platform_id[numPlatforms];

         status   = clGetPlatformIDs(numPlatforms, platforms, NULL);

        cout << "clGetPlatformIDs status : " << err << endl;

        platform = platforms[0];

    }

    cl_device_id device_ids[16];

    unsigned int num_devices;

    err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 16, device_ids, &num_devices);

    cout << "clGetDeviceIDs err: " << err << endl;

    cl_context_properties ctxProps[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties) platform$

    cl_context myContext = clCreateContext(ctxProps, 1, device_ids, NULL, NULL, &err);

    cout << "clCreateContext err: " << err << endl;

-----------------------------------------------------------------

and this is the C++

------------------------------------------------------------

std::vector <cl::Platform> platforms;

    err = cl::Platform::get(&platforms);

    cl_context_properties context_properties[3] = {

          CL_CONTEXT_PLATFORM, (cl_context_properties) platforms[0](), 0 };

    cl::Context myCtx = cl::Context(CL_DEVICE_TYPE_ALL,

          context_properties, NULL, NULL, &err);

   cl_context myContext = myCtx();

------------------------------------------------------------------

after that I call clFFT in this way:

-------------------------

clFFT_Dim3 n;

    clFFT_Plan plan;

    cl_uint plan_length;

    n.x = 1024;

    n.y = 1;

    n.z = 1;

cout << "Creating plan" << endl;

plan = clFFT_CreatePlan((cl_context) myContext, n,
                            clFFT_1D, clFFT_InterleavedComplexFormat, &err);

A couple of question:

   - When I use the C++ API the plan creation hangs and the CPU is on 100% load... anybody has similar experiences ?

   - Does anybody using clFFT with C++ API ?

  

thanks,

Gergely

0 Likes
13 Replies