title: RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file gpu_data.cpp:201. code: 30, reason: unknown error
body: <p>I am getting following error while initializing the face detector model <code>dlib.cnn_face_detection_model_v1(path)</code>.</p>
  
  <pre><code>RuntimeError: Error while calling cudaGetDevice(&amp;the_device_id) in file gpu_data.cpp:201. code: 30, reason: unknown error
  </code></pre>
  
  <p>This get away with this error by simply restarting the machine. Since, this can't be done if it occurs frequently in future, so I would like to understand the cause of this error. With little research I found this is somewhat related to driver version, but what is exactly wrong with the initialization is still a question for me.</p>
  
  <p>Below mentioned information may be useful:</p>
  
  <pre><code>&gt;&gt;&gt; nvidia-smi -a 
  
  ==============NVSMI LOG==============
  
  Timestamp                           : Tue Feb 18 15:15:45 2020
  Driver Version                      : 410.129
  CUDA Version                        : 10.0
  
  Attached GPUs                       : 1
  GPU 00000000:01:00.0
      Product Name                    : GeForce GTX 1070 with Max-Q Design
      Product Brand                   : GeForce
      Display Mode                    : Enabled
      Display Active                  : Enabled
      Persistence Mode                : Enabled
      Accounting Mode                 : Disabled
      Accounting Mode Buffer Size     : 4000
  
  </code></pre>
  
  <pre><code>&gt;&gt;&gt; nvidia-smi
  
  Tue Feb 18 15:21:48 2020       
  +-----------------------------------------------------------------------------+
  | NVIDIA-SMI 410.129      Driver Version: 410.129      CUDA Version: 10.0     |
  |-------------------------------+----------------------+----------------------+
  | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
  | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
  |===============================+======================+======================|
  |   0  GeForce GTX 107...  On   | 00000000:01:00.0  On |                  N/A |
  | N/A   48C    P0    31W /  N/A |    483MiB /  8117MiB |      0%      Default |
  +-------------------------------+----------------------+----------------------+
  
  +-----------------------------------------------------------------------------+
  | Processes:                                                       GPU Memory |
  |  GPU       PID   Type   Process name                             Usage      |
  |=============================================================================|
  |    0      3465      G   /usr/lib/xorg/Xorg                            18MiB |
  |    0      3597      G   /usr/bin/gnome-shell                          48MiB |
  |    0      6012      G   /usr/lib/xorg/Xorg                           213MiB |
  |    0      6148      G   /usr/bin/gnome-shell                         199MiB |
  +-----------------------------------------------------------------------------+
  
  </code></pre>
  
  <p>I am looking for some explanation for this error. Solution for it is more than welcome.</p>