Is Thrust synchronous or asynchronous?

I am new to using Thrust, and there is one thing that I do not understand. Is Thrust asynchronous or synchronous?

If I write the following code, there will be no time 0. But in other tags, other users report the result 0. What is the truth?

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<<"execution time"<<time<<endl;// the result is 0.327
+5
source share
3 answers

Starting the kernel has always been asynchronous - even in CUDA 1.0 - so any Thrust call that appears only when the kernel starts will be asynchronous.

Any trust code that implicitly starts memcpy will be synchronous due to the lack of thread support, as indicated in marina.k.

+2
source

clock() , Windows. Windows XP 16 .

clock() Cutil ( ).

Windows: ++ Windows

CUtil : CUDA: CUtil -

0

, time.h , "" → C/++ → Indexer " " :

time.h, cstdarg, stdarg.h, .....

0

All Articles