Hi there,
I am trying to handle structs in a CUDA code. But I have problem allocating memory, and copying them ( I am not sure which part of my code is incorrect). I get this run-time error: “copying of minl to device failed”
here is part of the code that deals with this thing:
struct threeD
{
float x, y, z;
};
constant struct threeD *maxd,*mind;
threeD *maxl,*minl;
// allocate memory
if (cudaSuccess != cudaMalloc((void **)&maxl, sizeof(threeD) * blocks)) fprintf(stderr, “could not allocate maxd\n”); CudaTest(“couldn’t allocate maxd”);
if (cudaSuccess != cudaMalloc((void **)&minl, sizeof(threeD) * blocks)) fprintf(stderr, “could not allocate mind\n”); CudaTest(“couldn’t allocate mind”);
if (cudaSuccess != cudaMemcpyToSymbol(maxd, &maxl, sizeof(threeD))) fprintf(stderr, “copying of maxl to device failed\n”); CudaTest(“maxl copy to device failed”);
if (cudaSuccess != cudaMemcpyToSymbol(mind, &minl, sizeof(threeD))) fprintf(stderr, “copying of minl to device failed\n”); CudaTest(“minl copy to device failed”);
I appreciate your help in advance.