c - Using constant memory with struct array in CUDA -
i try pass struct array constant memory, have same problems. first of all, struct is:
#define point_size 1024 struct point { short x; short y; point (short xx, short yy){ x = xx; y = yy; } point (){ x = 0; y = 0; } }; when use following declaration, compile error: can't generate code non empty constructors or destructors on device
__constant__ point points_once[point_size]; the weird side of when use follwing declaration, it's gone. but, not valid me.
__constant__ point *points_once[point_size]; how can solve problem. thank help. use latest driver , visual studio 2010 compute_30 , sm_30 configuration.
this question duplicate of this one. please review answer there explanation of why happening.
as work-around, either use defined constants direct assignment (i.e. not in constructor) discussed in other answer, or omit constructor initialization, , use separate host based routine initialize __constant__ region values desire using cudamemcpytosymbol.
since array of pointers not allocate structure storage, constructor not called in second example, , there no issue, not see error message.
Comments
Post a Comment