Reputation: 607
I am trying to print out the type of local memory:
cl_int err;
cl_device_local_mem_type type;
err = clGetDeviceInfo(
deviceId,
CL_DEVICE_LOCAL_MEM_TYPE,
sizeof(cl_device_local_mem_type),
&type,
0 );
printf ("Memory type is %s=". type);
This is not working. Also if I use &type, even then it is working.
Do I need to do some type casting ? Please help me resolve this.
Upvotes: 0
Views: 523
Reputation: 9925
The cl_device_local_mem_type
type is just an unsigned integer, so you should be printing it with %u
, not %s
.
cl_int err;
cl_device_local_mem_type type;
err = clGetDeviceInfo(
deviceId,
CL_DEVICE_LOCAL_MEM_TYPE,
sizeof(cl_device_local_mem_type),
&type,
0 );
printf ("Memory type is %u=", type);
You'll get either 1
or 2
back, which you can check in the cl.h
header:
#define CL_LOCAL 0x1
#define CL_GLOBAL 0x2
Upvotes: 2