Structs containing pointers Warning: Cannot tell what pointer points to, assuming global memory sp

Hi,

I have a struct containing a couple of pointers like so:

[codebox]struct CUDANetwork {

int size;

int num_groups;

float * phi;

Event * pulse_queues;

int * pulse_queues_sizes;

int * calculated_groups;

};[/codebox]

Now when I try to access one of the pointer the compiler gives me the following warning:

[indent]Warning: Cannot tell what pointer points to, assuming global memory space[/indent]

How can I fix this warning? I read in a thread some time ago that there might be a bug in NVCC when dealing with pointers in structs. Is that correct? I am using the SDK version 2.3.

Thanks,

Frederik

I got that a few times too w/o using structs. Is it possible you are trying to use the cpu to access the device memory space directly? Ya can’t do that from what I can tell w/o a cudaMemcpy.

No they are definitely device global memory pointers, so the compiler is guessing correctly. What I did was combine a bunch of “loose” pointers into a struct to make it more readable.

I don’t think there is anything you can do to get rid of the warning (short of disabling warnings), but it isn’t harmful either. The compiler seems to emit it for any global scope pointers which aren’t otherwise given an explicit memory type (like constant for example).