typedefs (cl_int etc) for mulitple platforms

Hi,

Consider multiple platforms on the same system, e.g. Intel OpenCL SDK for targeting an Intel CPU, and Nvidia SDK for targeting an Nvidia GPU. Both platforms / devices shall be targeted in the same application.

#including cl.h gives me access to typedefs such as cl_int, cl_double etc.
Obviously however I can only #include cl.h of a single platform. But I don’t see any guarantee that say cl_int of the Intel SDK map to the same host application type as cl_int of the Nvidia SDK.
My question is: Am I correct that in general there can be little done about that? Is there any technical way to get the guarantee that host code types match to all device code types correctly (without storing the host data individually for each platform of course)?
If there is no such solution (which I do suppose…), or if it is very expensive, is there some more or less straightforward way to make at least a compiletime / runtime check that host application types are identical for all platforms and host data can be distributed to any platform-device?

thanks!

Is there any technical way to get the guarantee that host code types match to all device code types correctly (without storing the host data individually for each platform of course)?

Type cl_int on the host is guaranteed to match type “int” on the device. This is true for other types as well with the notable exception of bool and size_t. See section 6.1.1. in the OpenCL 1.2. specification for details.