Matrix of struct to GPU

Hi,

i have some problems to pass a Matrix of struct like this:

typedef struct {
	Vec hp;
	Vec rad;
} LightPath;

typedef struct {
	float x, y, z;
} Vec;

I have allocated the matrix dynamically in host code, like this:

LightPath **lp;

lp = (LightPath **) malloc(DEPTH * sizeof(LightPath*));
    for(index_lp=0;index_lp<DEPTH;index_lp++) lp[index_lp]=(LightPath*)malloc(LIGHT_POINTS * sizeof(LightPath));

and then, i pass the matrix to kernel function

function_name<<<...,..>>>(some parameters,lp);

in kernel i use the matrix:

lp[index][index].hp.x = "float value";

where am i wrong? Any ideas?

In the posted code snippets, lp resides in host memory and it seems you are not moving it to device memory…