2 questions about memory

  1. If the device has different endianness than the host, what does cudaMemCopy do exactly? It can’t copy the data in such a way that the mapping byte address->byte of data and word address->word of data are both preserved, so which one is preserved?

  2. Are type sizes the same througout the program (in host and device), or might a variable of a certain type (i.e. long, int, short) have a different size when it is on the host and the device? (I asked this question in the General Discussion and didn’t get a response, so I figured I’d try it here since this forum seems more popular).


Are there supported platforms that have a different endianness?

I’m not sure, if there aren’t then the question of course isn’t that important.

I don’t think there are drivers for Geforce cards for platforms that are not x86-based, so it’s a non-issue.

On your second question: I think you can find some posts on this subject on the forum. Maybe searching by google is working better than the site-search. And maybe there is also something mentioned in the Programming Guide.

I don’t know the answer to this question, but someone has thought about this in the tool chain. All of the PTX files generated by nvcc contain comments like this:

//  Target:ptx, ISA:sm_10, Endian:little, Pointer Size:64

indicating the endianness and pointer size of the architecture on which the PTX was generated. Perhaps both little and big endian can be handled by the GPU, as long as nvcc knows the host endianness and can generate the appropriate byte-swapping instructions?

(This practically moot since CUDA only works on x86 architectures…)