I have a struct which I have malloc’ed (and cudamalloc’ed) that looks something like this:
typedef struct
{
double *data_pointer
} struct_pointer
I tried this to transfer data:
cudaMemcpy(struct_pointer_device->data_pointer, struct_pointer_host->data_pointer, sizeof(double)*domain_size,cudaMemcpyHostToDevice);
But it fails with an unhandled exception, but no cuda errors. The following code however works as expected:
cudaMemcpy(data_pointer_device, data_pointer_host, sizeof(double)*domain_size,cudaMemcpyHostToDevice);
Could anyone explain to me why the first example compiles but does not work?