title: What is the role of cudaDeviceReset() in Cuda
body: <pre><code>#include "cuda_runtime.h"
  #include "device_launch_parameters.h"
  #include &lt;stdio.h&gt;
  __global__ void funct(void){
        printf("Hello from GPU!\n");
  }
  
  int main(void){
           funct &lt;&lt; &lt; 2, 4 &gt;&gt; &gt;();
  
  for (int i = 0; i &lt; 10; i++){
      cudaDeviceReset();
      //cudaDeviceSynchronize();
      printf("Hello, World from CPU!\n");
  
      }
  return 0;
  }
  </code></pre>
  
  <p>I thought the role of cudaDeviceReset is cudamemcpy. this case we didn't have the result of number. So we were not able to use cudamemcpy. But We used cudaDeviceReset for returning four "Hello from GPU!" result from kernel.</p>
  
  <p>Is that right?</p>
  
  <p>and I replaced cudaDeviceRest() with cudaDeviceSynchronize(). I saw the same result. but I couldn't know the difference between them.</p>