I’m attempting to use a struct I’ve written in one of my function kernel calls, but for some reason it seems the data isn’t getting into the devices memory. The struct is very simple:
typedef struct {
float A,B,C,D;
} Epipolar;
I’m declaring a variable in device memory to hold the data, allocating it, then memcopying the data into the device variable, but it seems that the data isn’t actually there:
Epipolar * pLine_d;
cudaMalloc( ( void**) &pLine_d, sizeof(Epipolar));
cudaMemcpy(pLine_d,image->pLine, sizeof(image->pLine), cudaMemcpyHostToDevice);
//kernel call with pLine_d as argument
image->pLine is a pointer to an Epipolar that serves as my source data. However, it seems its getting copied incorrectly (or not at all) as my output comes out as gibberish. I’m guessing I’m simply doing something wrong, anyone have any idea what? Thanks very much for your time.
Thanks for the help. Just to make sure I understand, image->pLine is a pointer acting as an array of Epipolars. Should the memcpy size be number of elements in image->pLine * sizeof(Epipolar) in this case?