Structure memory is different between gcc and nvcc

Hello
I am trying to use a structure in .cu file, but the data in memory is different from .cc file;
the structure code like:

         struct LidarFrame {
            // timestamp
            double timestamp = 0.0;
            // lidar to world pose
            Eigen::Affine3d lidar2world_pose = Eigen::Affine3d::Identity();

            ......
          }

in .cc,we print the address of a instanced structure content as:

std::cout<<"timestamp: "<<&(frame->timestamp)<<std::endl;
std::cout<<"lidar2world_pose: "<<&(frame->lidar2world_pose)<<std::endl;
CloudGPU_ptr_->DoConvert(frame); //this function defined in .cu;

then the result shows as:

timestamp: 0x7fa82d3d70
lidar2world_pose: 0x7fa82d3d80

But in .cu,we print the address of the same instanced structure content as:

CloudGPU::DoConvert(LidarFrame * frame)
{
std::cout<<"timestamp: "<<&(frame->timestamp)<<std::endl;
std::cout<<"lidar2world_pose: "<<&(frame->lidar2world_pose)<<std::endl;
}

then the result shows as:

timestamp: 0x7fa82d3d70
lidar2world_pose: 0x7fa82d3d78

so the data after the double “timestamp” are not true ,even illegal, in .cu
but in .cu and .cc ,we print the size of “timestamp” , the results are same:

8

By the way,the version of gcc we used is gcc8,
and we have tried to use alignas(8) ,alignas(16), __attribute__((aligned(16))), but the memory of structure in .cc and .cu Remains!

`

Hi,

In .cc, it looks at CPU buffer address but GPU buffer address is used in .cu.
In general, the memory address will be different except from the unified memory.

Does the data structure (frame->*) can be accessed by GPU?
You can find the Jetson memory type in below document in details:

Thanks.