I have a class
class Graph{
...
int* encoding;
...
}
And I created an instance.
Graph* q_gpu;
cudaMalloc((void**) &q_gpu, sizeof(Graph));
Now I want to allocate memory for q_gpu->encoding
, and I tried
// main.cu
int* q_encoding_device;
cudaMalloc((void**) q_encoding_device, _someValue_);
q_gpu->encoding = q_encoding_device;
While I was debugging, "segmentation fault" appears when reaches the last statement.
someValue is really small, there shouldn't be memory limit exceeded error.
I don't understand why it fails and hope to know the correct way to solve it. Thank you!