Performance problem with 2D array of structs

Hi there,

I try to use a cuda 2D array of some struct :

struct var{
float rho;

};
var d_vars;

cudaMallocPitch((void **)&d_vars, &pitch, M
sizeof(var), N);

It works BUT I noticed a loss of performance of a ratio of about 2 or 3 (compared to
a splitted set of arrays of float)
Is anybody experienced the same performance issue ? Is there any solution to improve performance ?

Thanks in advance,
florian

Hi,
Without seeing any code snippet, it’s hard to tell… Nonetheless, it can simply be a problem of AoS vs. SoA and some uncoalesced memory accesses due to the strides the AoS introduces… Just a thought…