I found that alignment for char1
is 1, for char2
is 2, for char3
is 1 and for char4
is 4.
Why is the alignment size for char3 is 1 instead of 3?
I also need some help to understand the concept of "Alignment Requirements".
Please refer to this CUDA Programming Guide (Table B-1 of Section B.3.1 in Appendix B)
Many thanks,
Yik
Think about what would happen if you had an array of char3
- an alignment of > 1 would mean a non-contiguous array.
For char4
however you do not have any such padding problems, and you probably want to ensure that a char4
can be treated as if it were a 32 bit int, so a 4 byte alignment is helpful.