title: Cuda Unknown Error(ErrNo: 30) on cudaMalloc()
body: <p>I have searched for the reason but no luck. It fails on such a simple program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main() {
    int* n;
    cout &lt;&lt; cudaMallocManaged(&amp;n, 4 * sizeof(int)) &lt;&lt; endl;
    return 0;
  }
  </code></pre>
  
  <p>The return code is 30, unknown error. <code>cudaMalloc</code> also fails with same code.</p>
  
  <p>This is my hardware:</p>
  
  <pre><code>$ lspci | grep NV
  01:00.0 3D controller: NVIDIA Corporation GF117M [GeForce 610M/710M/820M / GT 620M/625M/630M/720M] (rev a1)
  
  $ nvidia-smi
  Sat Mar  7 14:02:04 2015       
  +------------------------------------------------------+                       
  | NVIDIA-SMI 331.113    Driver Version: 331.113        |                       
  |-------------------------------+----------------------+----------------------+
  | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
  | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
  |===============================+======================+======================|
  |   0  NVS 5200M           Off  | 0000:01:00.0     N/A |                  N/A |
  | N/A   53C  N/A     N/A /  N/A |    279MiB /  1023MiB |     N/A      Default |
  +-------------------------------+----------------------+----------------------+
  
  +-----------------------------------------------------------------------------+
  | Compute processes:                                               GPU Memory |
  |  GPU       PID  Process name                                     Usage      |
  |=============================================================================|
  |    0            Not Supported                                               |
  +-----------------------------------------------------------------------------+
  </code></pre>
  
  <p>I am using Ubuntu 14.10, with CUDA 6.0 from official repository(hopefully, if Ubuntu does not mess it up).</p>
  
  <p>It is a Lenovo T430s labtop, the card is on Optimus so that might cause some problem. I have tested on another machine and the same code works.</p>
  
  <p><strong>Update 1</strong></p>
  
  <p>OK, <code>nvidia_uvm</code> is not loaded...</p>
  
  <pre><code>$ lsmod |grep nv
  
  nvidia              10744914  65 
  nvram                  14362  1 thinkpad_acpi
  drm                   310919  6 i915,drm_kms_helper,nvidia
  
  $ sudo modprobe nvidia_uvm
  modprobe: ERROR: ../libkmod/libkmod-module.c:816 kmod_module_insert_module() could not find module by name='nvidia_331_updates_uvm'
  modprobe: ERROR: could not insert 'nvidia_331_updates_uvm': Function not implemented
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <p>OK, I reinstalled nvidia-331-updates-uvm and the module was loaded.</p>
  
  <pre><code>$ lsmod | grep nv
  nvidia_uvm             34855  0 
  nvidia              10744914  66 nvidia_uvm
  nvram                  14362  1 thinkpad_acpi
  drm                   310919  6 i915,drm_kms_helper,nvidia
  </code></pre>
  
  <p>However, the code still returns error 30.</p>
  
  <p><strong>Update 3</strong></p>
  
  <p>After some more testing (mainly tried running as root), now I get error 71: operation not supported. However, if I am just using <code>cudaMalloc</code> it succeeded. I will also check whether my device support unified memory addressing.</p>
  
  <p><strong>Update 4</strong></p>
  
  <p>OK, my card only supports SM 2.1, so it does not support Unified Memory.</p>