title: What does "persistence mode" actually do which reduces CUDA startup time?
body: <p>Starting up the CUDA runtime takes a certain amount of time to harmonize the UVM memory maps of the device and the host; see:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/42162337/cudagetcacheconfig-takes-0-5-seconds-how-why">cudaGetCacheConfig takes 0.5 seconds - how/why?</a></li>
  <li><a href="https://stackoverflow.com/questions/33404220/slowness-of-first-cudamalloc-k40-vs-k20-even-after-cudasetdevice">slowness of first cudaMalloc (K40 vs K20), even after cudaSetDevice</a></li>
  </ul>
  
  <p>Now, it's been suggested to me that using <a href="http://docs.nvidia.com/deploy/driver-persistence/index.html#persistence-mode" rel="noreferrer">Persistence Mode</a> would mitigate this phenomenon significantly. In what way? I mean, what will happen, or fail to happen, when persistence mode is on, and a process using CUDA exists?</p>
  
  <p>The documentation says:</p>
  
  <blockquote>
    <p>Persistence Mode is the term for a user-settable driver property that keeps a target GPU initialized even when no clients are connected to it.</p>
  </blockquote>
  
  <p>but - what does "keeping initialized" mean? Later, the section about the persistence daemon (which is not the same thing as persistence mode) says:</p>
  
  <blockquote>
    <p>The GPU state remains loaded in the driver whenever one or more clients have the device file open. Once all clients have closed the device file, the GPU state will be unloaded unless persistence mode is enabled. </p>
  </blockquote>
  
  <p>So what exactly is unloaded? To where it is unloaded? How does it relate to the memory size? And why would it take so much time to load it back if nothing significant has happend on the system?</p>