<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>NVIDIA CUDA Library: cuStreamWaitEvent</title> <link href="customdoxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.8 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> </div> <div class="contents"> <div class="navpath"><a class="el" href="group__CUDA__STREAM.html">Stream Management</a> </div> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td valign="top"> <div class="navtab"> <table> <tr><td class="navtab"><a class="qindex" href="group__CUDA__STREAM_ga581f0c5833e21ded8b5a56594e243f4.html#ga581f0c5833e21ded8b5a56594e243f4">cuStreamCreate</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDA__STREAM_g244c8833de4596bcd31a06cdf21ee758.html#g244c8833de4596bcd31a06cdf21ee758">cuStreamDestroy</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDA__STREAM_g1b0d24bbe97fa68e4bc511fb6adfeb0b.html#g1b0d24bbe97fa68e4bc511fb6adfeb0b">cuStreamQuery</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDA__STREAM_g15e49dd91ec15991eb7c0a741beb7dad.html#g15e49dd91ec15991eb7c0a741beb7dad">cuStreamSynchronize</a></td></tr> <tr><td class="navtab"><a class="qindexHL" href="group__CUDA__STREAM_g6a898b652dfc6aa1d5c8d97062618b2f.html#g6a898b652dfc6aa1d5c8d97062618b2f">cuStreamWaitEvent</a></td></tr> </table> </div> </td> <td valign="top"> <a class="anchor" name="g6a898b652dfc6aa1d5c8d97062618b2f"></a><!-- doxytag: member="cuda.h::cuStreamWaitEvent" ref="g6a898b652dfc6aa1d5c8d97062618b2f" args="(CUstream hStream, CUevent hEvent, unsigned int Flags)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="group__CUDA__TYPES_g09da14df1a751dcbfeccb9cf0073d64c.html#g09da14df1a751dcbfeccb9cf0073d64c">CUresult</a> cuStreamWaitEvent </td> <td>(</td> <td class="paramtype"><a class="el" href="group__CUDA__TYPES_gb946c7f02e09efd788a204718015d88a.html#gb946c7f02e09efd788a204718015d88a">CUstream</a> </td> <td class="paramname"> <em>hStream</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="group__CUDA__TYPES_g6d740185cf0953636d4ae37f68d7559b.html#g6d740185cf0953636d4ae37f68d7559b">CUevent</a> </td> <td class="paramname"> <em>hEvent</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">unsigned int </td> <td class="paramname"> <em>Flags</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p> Makes all future work submitted to <code>hStream</code> wait until <code>hEvent</code> reports completion before beginning execution. This synchronization will be performed efficiently on the device. The event <code>hEvent</code> may be from a different context than <code>hStream</code>, in which case this function will perform cross-device synchronization.<p> The stream <code>hStream</code> will wait only for the completion of the most recent host call to <a class="el" href="group__CUDA__EVENT_g95424d3be52c4eb95d83861b70fb89d1.html#g95424d3be52c4eb95d83861b70fb89d1" title="Records an event.">cuEventRecord()</a> on <code>hEvent</code>. Once this call has returned, any functions (including <a class="el" href="group__CUDA__EVENT_g95424d3be52c4eb95d83861b70fb89d1.html#g95424d3be52c4eb95d83861b70fb89d1" title="Records an event.">cuEventRecord()</a> and <a class="el" href="group__CUDA__EVENT_g593ec73a8ec5a5fc031311d3e4dca1ef.html#g593ec73a8ec5a5fc031311d3e4dca1ef" title="Destroys an event.">cuEventDestroy()</a>) may be called on <code>hEvent</code> again, and subsequent calls will not have any effect on <code>hStream</code>.<p> If <code>hStream</code> is 0 (the NULL stream) any future work submitted in any stream will wait for <code>hEvent</code> to complete before beginning execution. This effectively creates a barrier for all future work submitted to the context.<p> If <a class="el" href="group__CUDA__EVENT_g95424d3be52c4eb95d83861b70fb89d1.html#g95424d3be52c4eb95d83861b70fb89d1" title="Records an event.">cuEventRecord()</a> has not been called on <code>hEvent</code>, this call acts as if the record has already completed, and so is a functional no-op.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>hStream</em> </td><td>- Stream to wait </td></tr> <tr><td valign="top"></td><td valign="top"><em>hEvent</em> </td><td>- Event to wait on (may not be NULL) </td></tr> <tr><td valign="top"></td><td valign="top"><em>Flags</em> </td><td>- Parameters for the operation (must be 0)</td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd><a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaaa0eed720f8a87cd1c5fd1c453bc7a03d">CUDA_SUCCESS</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaaacf52f132faf29b473cdda6061f0f44a">CUDA_ERROR_DEINITIALIZED</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa8feb999f0af99b4a25ab26b3866f4df8">CUDA_ERROR_NOT_INITIALIZED</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaaa484e9af32c1e9893ff21f0e0191a12d">CUDA_ERROR_INVALID_CONTEXT</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa0fd2e63260c6317ba943af0f7e4b8d21">CUDA_ERROR_INVALID_HANDLE</a>, </dd></dl> <dl class="note" compact><dt><b>Note:</b></dt><dd>Note that this function may also return error codes from previous, asynchronous launches.</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__CUDA__STREAM_ga581f0c5833e21ded8b5a56594e243f4.html#ga581f0c5833e21ded8b5a56594e243f4" title="Create a stream.">cuStreamCreate</a>, <a class="el" href="group__CUDA__EVENT_g95424d3be52c4eb95d83861b70fb89d1.html#g95424d3be52c4eb95d83861b70fb89d1" title="Records an event.">cuEventRecord</a>, <a class="el" href="group__CUDA__STREAM_g1b0d24bbe97fa68e4bc511fb6adfeb0b.html#g1b0d24bbe97fa68e4bc511fb6adfeb0b" title="Determine status of a compute stream.">cuStreamQuery</a>, <a class="el" href="group__CUDA__STREAM_g15e49dd91ec15991eb7c0a741beb7dad.html#g15e49dd91ec15991eb7c0a741beb7dad" title="Wait until a stream's tasks are completed.">cuStreamSynchronize</a>, <a class="el" href="group__CUDA__STREAM_g244c8833de4596bcd31a06cdf21ee758.html#g244c8833de4596bcd31a06cdf21ee758" title="Destroys a stream.">cuStreamDestroy</a> </dd></dl> </div> </div><p> </td> </tr> </table> </div> <hr size="1"><address style="text-align: right;"><small> Generated by Doxygen for NVIDIA CUDA Library <a href="http://www.nvidia.com/cuda"><img src="nvidia_logo.jpg" alt="NVIDIA" align="middle" border="0" height="80"></a></small></address> </body> </html>