title: Is Thrust synchronous or asynchronous?
body: <p>I'm new to using Thrust and there is one thing I don't understand. Is Thrust asynchronous or synchronous?</p>
  
  <p>If I write the following code, the time taken isn't <code>0</code>. But in the other tags, other users report a result of <code>0</code>. What is the truth?</p>
  
  <pre class="lang-c++ prettyprint-override"><code>clock_t start,end;
  
  start=clock(); 
  thrust::sort_by_key(vettore.begin(), vettore.end(), counter.begin()); 
  
  end=clock();
  
  double time=((double)(end-start))/CLOCKS_PER_SEC; 
  
  cout&lt;&lt;"execution time"&lt;&lt;time&lt;&lt;endl;// the result is 0.327
  </code></pre>