First of all, in my opinion, any time you’re having trouble with a CUDA code, you should be using proper CUDA error checking. (not sure what that is? just google “proper CUDA error checking”, take the first hit, and read it and apply it to your code). If you had been doing proper CUDA error checking, there wouldn’t be any mystery here, the cudaMallocManaged call would return “operation not supported” on your C2075.
Beyond that, you should also run your codes with cuda-memcheck
To learn how to program without the managed memory model, just study a CUDA sample code like vectorAdd
it’s not as simple as just replacing cudaMallocManaged with cudaMemcpy. cudaMallocManaged is replaced with host allocations, device allocations, and cudaMemcpy operations.
to check if your GPU supports managed memory, you can simply query its compute capability (managed memory, in some form, is supported on devices of compute capability 3.0 and higher). In addition, the call to cudaGetDeviceProperties reports a number of device properties associated with managed memory:
refer to such properties as:
To learn how to program with cudaGetDeviceProperties, study the deviceQuery CUDA sample code.