29.01.2013 Views

Tutorial CUDA

Tutorial CUDA

Tutorial CUDA

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Host Runtime Component:<br />

Events<br />

Events are inserted (recorded) into <strong>CUDA</strong> call streams<br />

Usage scenarios:<br />

measure elapsed time for <strong>CUDA</strong> calls (clock cycle precision)<br />

query the status of an asynchronous <strong>CUDA</strong> call<br />

block CPU until <strong>CUDA</strong> calls prior to the event are completed<br />

asyncAPI sample in <strong>CUDA</strong> SDK<br />

cudaEvent_t start, stop;<br />

cudaEventCreate(&start); cudaEventCreate(&stop);<br />

cudaEventRecord(start, 0);<br />

kernel(...);<br />

cudaEventRecord(stop, 0);<br />

cudaEventSynchronize(stop);<br />

float et;<br />

cudaEventElapsedTime(&et, start, stop);<br />

cudaEventDestroy(start); cudaEventDestroy(stop);<br />

© NVIDIA Corporation 2008<br />

144

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!