Hi
I am a CUDA newbie and I have encountered some errors when I want to use the unified memory feature in CUDA 6.0
Firstly, it seems cudaMallocManaged doesn’t work. For example(piece of my code in main function):
int N = 1000;
int *a;
cudaMallocManaged(&a, N*sizeof(int));
for(int i = 0; i < N; i++){
a[i] = i;
}
printf("%d",a[0]);
If the cudaMallocManaged call is gone, then this will print 0, but if the call is there, it prints nothing.
Also,
#include <stdio.h>
__device__ __managed__ int ret[1000];
__global__ void AplusB(int a, int b) {
if(threadIdx.x<1000)
ret[threadIdx.x] = a + b + threadIdx.x;
}
int main() {
AplusB<<< 1, 1000 >>>(10, 100);
cudaDeviceSynchronize();
for(int i=0; i<1000; i++) {
printf("%d: A+B = %d\n", i, ret[i]);
}
return 0;
}
will return an error:
error: managed variables are not yet supported for this configuration (compilation mode (32/64 bit) and/or target operating system)
I think all these problems are due to this error: compilation mode (32/64 bit) because I noticed that the unified memory feature is for 64 bit system only. I am using Macbook Pro with GT 750M installed. Could anyone tell me how to resolve this problem?(Possibly change the setting to 64 bits only). Thank you!