[eigen] Struct padding with the nvcc compiler.

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

I'm using Eigen in a Cuda program, and want to use a Struct containing multiple Eigen members. The problem I am having is that the nvcc compiler apparently doesn't understand how the struct is supposed to be padded. As far as I have understood, Eigen pads the struct such that every Eigen member starts on a 16 byte boundary. My c++ compiler (g++-4.9) does this correctly, but it seems nvcc doesn't pad correctly.

The symptoms i observe are that sizeof() and offsetof() return different values when run the .cpp file compared to when run in the .cu file. In the .cpp file i get padding to 16 byte boundaries, while in the .cu file I get no padding at all.

The problem is independent of whether I am using the EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro or not.

I am using an Eigen 3.3 dev snapshot taken May 30th.

For now I am padding my structs manually to ensure correct behavior, but I am curious if this is a known issue or something that will be fixed.

Best,
Jon E. A. Lund


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/