This project is read-only.

sizeof

Jul 17, 2012 at 8:02 PM

Is there some function in Cudafy lib to calculate size of user defined struct? .NET sizeof is inappropriate since it

a) needs to run in unsafe mode

b) results may vary depending on padding and/or system architecure (32/64b)

I need to know how many bytes will struct occupy on device, not host.

Aug 24, 2012 at 8:40 AM

There is nothing built-in to do this.  You have to ensure that the struct on both CPU and GPU are same layout since the arrays are copied across without modification.  You can use Marshall.SizeOf for some cases.