I’m having problems using an array of structures in my code. I have searched the forum and the net but I didn’t find a satisfying solution for this problem.
This is a snippet of my code that deals with the structure
unsigned int *OF; int part_no;
overflow of, *d_of;
int i, no_part=100,size_part=25000;
of[i].OF=(unsigned int*)calloc(size_part, sizeof(unsigned int)); for(int u=0;u<size_part;u++) of[i].OF[u]=0; cudaMalloc((void**)&d_of[i].OF,size_part*sizeof(unsigned int));
So as you see I have a dynamic array of unsigned int inside my structure which might complicated things.
Every time I use this structure inside the kernel I get this warning
Warning: Cannot tell what pointer points to, assuming global memory space
And when I modified the values inside the array in the device and returned it to host it always returns junk values.
Heres my questions:
1- How to do this properly?
2- I read a post that said that array of structures shouldn’t be used and its better to use regular arrays instead. So should using array of structures be totally avoided? or is it just better performance wise?
I’m using the Tesla T10 Processor
I would appreciate any help in clarifying this matter to me