I have a query regarding the byte alignment of structure in opencl. I read somewhere that I should be making sure that the size of the structure is same on host and device by making use of __attribute__ ((aligned (X))).

My question is that is it sufficient to do something like (on both host and device) -
struct sampleStruct
{
float value_ONE;
float value_TWO;
} __attribute__ ((aligned ());

or do I need to do the following (align all the individual elements) -
struct sampleStruct
{
float value_ONE __attribute__ ((aligned ());
float value_TWO __attribute__ ((aligned ());
};

Why I ask this is because I want to understand the case where by default float on the host is assigned 8 bytes and on the device 4 bytes? Do I need to care for this kind of scenario or OpenCl compiler will handle this?

Thanks