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.

Expose Parallelism:<br />

CPU/GPU Parallelism<br />

Take advantage of asynchronous kernel launches by<br />

overlapping CPU computations with kernel execution<br />

Take advantage of asynchronous CPU ↔ GPU memory<br />

transfers (cudaMemcpyAsync()) that overlap with kernel<br />

execution (only available for G84 and up)<br />

© NVIDIA Corporation 2008<br />

Overlap implemented by using a <strong>CUDA</strong> stream<br />

<strong>CUDA</strong> Stream = Sequence of <strong>CUDA</strong> operations that execute in order<br />

Example:<br />

cudaStreamCreate(&stream1);<br />

cudaStreamCreate(&stream2);<br />

cudaMemcpyAsync(dst, src, size, stream1);<br />

overlapped<br />

kernel(…);<br />

cudaMemcpyAsync(dst2, src2, size, stream2);<br />

cudaStreamQuery(stream2);

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

Saved successfully!

Ooh no, something went wrong!