I’m having trouble with an alignment mismatch in my code. This is with the CUDA 1.1 beta on an Intel Mac. All files are being compiled from scratch on the problem machine. This doesn’t occur on our RHEL 5 machine.
Our project consists of .c files (compiled with g++ since they use C++ comments, variable decl rulets, etc), .cu files containing host and GPU code and .cu files containing GPU device kernels.
This is the problem struct:
typedef struct
{
char aname[5]; /* atom name */
double xyz[3]; /* original xyz coordinates */
double XYZ[3]; /* transformed xyz coordinates */
double q; /* atom charge */
double r; /* atom radius */
int s; /* ACE solvation type */
double access; /* accessibility */
double accessgrad[3];
double abc[3];
int one_two_bonds[ MAX_12_BONDS ];
} atom_t;
Unless I’m adding incorrectly, on the intel mac, the size of this struct should be 145 bytes.
The problem I’m seeing is that the g++ generated object code is padding this struct to 148 while the nvcc generated object code is padding this struct to 152. This obviously causes array mismatches and breaks everything.
Does anyone know what might cause this size mismatch? nvcc should just be calling g++ for the host portion, and I’m not using any crazy cross-compilation flags.
Is there a flag that will force/standardize the padding?
David