Forum Discussion
Altera_Forum
Honored Contributor
8 years agoLet's start with memory allocation. This is how I allocate memory for structures:
d_orders_size = sizeof(SimpleOrder) * orders->size(); d_orders = (SimpleOrder*)_aligned_malloc(d_orders_size, 64); for (int i = 0; i < orders->size(); i++) { d_orders[i] = orders->at(i); } This is the definition of the structure: struct SimpleOrder { cl_double a; cl_int b; enum anEnum c; cl_int d; cl_int e; cl_int padding[10]; }; So it's size of 64 bytes. Is there any problem with these two parts? The rest of the OpenCL code is the same as the C version so I don't see why there should be any problem since it's a one work item kernel.