I get access to CUDA 6 RC as register developer and I want try to use new feature of CUDA 6: Unified Memory. So, I created simple example when I try use this feature: Here is me example:
#include <stdio.h>
#include <cuda_runtime.h>
int
main(void)
{
int numElements = 5000;
size_t size = numElements * sizeof(float);
float *a;
cudaMallocManaged(&a, numElements);
for (int i = 0; i < numElements; ++i)
{
a[i] = rand()/(float)RAND_MAX;
}
return 0;
}
I tried run it example, but I got segmentation fault error:
Segmentation fault: 11
Question - what I doing wrong?