saint_shark
saint_shark

Reputation: 17

How to get the size of "_cl_devide_id" struct in openCL?

cl_device_id is defined as "typedef struct _cl_device_id *cl_device_id". In the openCL method clGetDeviceIDs, "devices" parameter is of the type "cl_device_id *" and returns a pointer to the list of devices available. I'm trying to pass the whole struct using memcpy to another variable. For which I need to know the size of the "_cl_device_id" struct.

Upvotes: 0

Views: 216

Answers (1)

mogu
mogu

Reputation: 1119

_cl_device_id is internal to the platform (like all _cl_something structs). Furthermore, an OpenCL program can have multiple platforms loaded, and for each platform the struct sizes can (and likely will) be different.

All cl_objects in general are opaque pointers, and (in general) copying around hidden internal structs of a C library is a pretty extreme approach, almost guaranteed to screw things up (unless you're working on implementing a debugger or such).

But anyway leaving motivation aside, the answer is: you can't tell, since you don't know until the program actually runs and loads the OpenCL implementation(s).

Upvotes: 1

Related Questions