I've create a abstract class "Shape",and its child class "Sphere"(implement all the functions). Then I create a "Shape* my_sphere" point to "Sphere"(as follows):
Shape* my_sphere;
cudaMallocManaged(&my_sphere,sizeof(Sphere));
Shape* my_sphere_host = new Shphere;
cudaMemcpy(my_sphere,my_sphere_host,sizeof(Sphere),cudaMemcpyHostToDevice);
However when I use the "my_sphere" in a __global__
or __device__
function, cuda returned with the error code 700
__global__ testFunction(Shape* shape){
shape->getPosition();
}
could anybody help me?I'll appreciate it so much.