#define __CL_ENABLE_EXCEPTIONS #include "cl.hpp" #include #include #include #include typedef struct { int some; int offset; } Param; using namespace cl; using namespace std; int main(int argc, char* argv[]) { Context(CL_DEVICE_TYPE_DEFAULT); static const unsigned elements = 1000; vector data(elements, 5); Buffer a(begin(data), end(data), true, false); Buffer b(begin(data), end(data), true, false); Buffer c(CL_MEM_READ_WRITE, elements * sizeof(float)); Program addProg(R"d( typedef struct { int some; int offset; } Param; kernel void add( global const float * restrict const a, global const float * restrict const b, global float * restrict const c, Param info) { unsigned idx = get_global_id(0); c[idx] = sizeof(Param); } )d", true); Param info; auto add = make_kernel(addProg, "add"); add(EnqueueArgs(elements), a, b, c, info); vector result(elements); cl::copy(c, begin(result), end(result)); printf("Sizeof Param: %d\n", sizeof(Param)); std::copy(begin(result), end(result), ostream_iterator(cout, ", ")); return 0; }