Dear all,
currently I am working on a Monte Carlo code for particle transport simulations using OpenCL and I am facing a problem with the size of some arguments given to the OpenCL kernel. For example, to store some data from the simulated geometry I use the following struct.
typedef struct ALIGNED(ALIGNMENT) region_data_t { // reg = 0, front of geometry, reg = MXREG+1, back of geometry cl_float rhof[MXREG + 2]; cl_float pcut[MXREG + 2]; cl_float ecut[MXREG + 2]; cl_int med[MXREG + 2]; cl_int flags[MXREG + 2]; } region_data_t;
I use the same definition on the host and on the device (I have some definitions to change the cl_* types to the "normal" ones). The fact is that MXREG, the maximum number of regions allowed in the problem could be quite large, and therefore I generally reach the stack limit of my OS. I can handle that giving the "ulimit -s hard" command, but it is clear that it is not the ideal case.
So the question is, how would you handle this kind of struct?. I could just dynamically allocate all the arrays and pass them separately to the kernel, but it would be nice to maintain the structs use inside my code. I have a couple more of such structs and the number of arguments could rapidly increase. Thanks for your help!.