cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

c0nfig
Journeyman III

Bug when querying CL_DEVICE_MAX_CONSTANT_ARGS ?

Hi.

I hope this is the right place to post it.

I'm not sure if I'm doing something wrong or maybe it is a bug.

I use OpenCL 1.2 AMD-APP (923.1) on radeon 6970.

This simple program prints the number of devices found before and after  querying CL_DEVICE_MAX_CONSTANT_ARGS.

The first print 2 as expected (CPU and GPU), however the second print is 0...

It is  happen if I'm using another clGetDeviceInfo before as shown in the code.

#include <CL/cl.h>

#include <iostream>

using namespace std;

int main()

{

    cl_uint numplatforms=0;

    size_t returned_size=0;

    cl_uint devicesnum=0;

//getting platforms

    clGetPlatformIDs(0,NULL,&numplatforms);

    cl_platform_id platforms[numplatforms];

    clGetPlatformIDs(numplatforms,platforms,NULL);

//getting devices

    clGetDeviceIDs(platforms[0], CL_DEVICE_TYPE_ALL, NULL, NULL, &devicesnum);

    cl_device_id device_ids[devicesnum];

    clGetDeviceIDs(platforms[0], CL_DEVICE_TYPE_ALL, devicesnum, device_ids, NULL);

//querying devices

    cl_ulong local_mem=0;

    cl_uint max_const_args=0;

    clGetDeviceInfo(device_ids[0], CL_DEVICE_LOCAL_MEM_SIZE , sizeof(cl_ulong), &local_mem, &returned_size);

    cout<<"devices num "<<devicesnum<<endl;

    clGetDeviceInfo(device_ids[0], CL_DEVICE_MAX_CONSTANT_ARGS  , sizeof(cl_ulong), &max_const_args, &returned_size);

    cout<<"devices num "<<devicesnum<<endl;

}

0 Likes
1 Solution
nou
Exemplar

you pass wrong sizeof() in second call. cl_ulong is 8 bytes and cl_uint 4 bytes.

View solution in original post

0 Likes
2 Replies
nou
Exemplar

you pass wrong sizeof() in second call. cl_ulong is 8 bytes and cl_uint 4 bytes.

0 Likes
c0nfig
Journeyman III

Absolutely , Thanks!

0 Likes