19.11.2014 Views

Tutorial: Introduction to CUDA Fortran | GTC 2013

Tutorial: Introduction to CUDA Fortran | GTC 2013

Tutorial: Introduction to CUDA Fortran | GTC 2013

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.

GPU/CPU Synchronization<br />

• Stream-based using <strong>CUDA</strong> events<br />

– Events can be inserted in<strong>to</strong> streams<br />

type (cudaEvent) :: event<br />

...<br />

istat = cudaEventRecord(event, stream1)<br />

– Event is recorded when the GPU reaches it in the stream<br />

• Recorded = assigned a time stamp<br />

• Useful for timing code<br />

– cudaEventSynchronize(event)<br />

• Blocks CPU until event is recorded

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

Saved successfully!

Ooh no, something went wrong!