/带有继承关系的内存分配遇到了问题,父类,子类
sphere *world_device;
cudaMalloc( (void**)&world_device,sizeof(sphere) * SPHERENUM );
sphere world_host[ SPHERENUM ] =
{
sphere(0,0,-1, 0.5, new lambertian(0.8, 0.1, 0.2 )),
sphere(0,-100.5,-1, 100, new lambertian( 0.8, 0.8, 0.0 )),
sphere( 1,0,0.3, 1, new metal( 0.8, 0.6, 0.2, 0.0 )),
sphere( -1,1,-1, 1, new dielectric(0.9)),
sphere( 1,0,-2 , -0.45, new dielectric(1.5))
};
cudaMemcpy( world_device, world_host,
sizeof(sphere) * SPHERENUM,
cudaMemcpyHostToDevice );//
这样是可以的。记录一下
c++和cuda混合编程记录二
最新推荐文章于 2024-07-14 20:55:48 发布