CUDA-Streams-Usage.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 2006-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU libgomp: CUDA Streams Usage</title>
  20. <meta name="description" content="GNU libgomp: CUDA Streams Usage">
  21. <meta name="keywords" content="GNU libgomp: CUDA Streams Usage">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Library-Index.html#Library-Index" rel="index" title="Library Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="index.html#Top" rel="up" title="Top">
  30. <link href="OpenACC-Library-Interoperability.html#OpenACC-Library-Interoperability" rel="next" title="OpenACC Library Interoperability">
  31. <link href="GCC_005fACC_005fNOTIFY.html#GCC_005fACC_005fNOTIFY" rel="prev" title="GCC_ACC_NOTIFY">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="CUDA-Streams-Usage"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="OpenACC-Library-Interoperability.html#OpenACC-Library-Interoperability" accesskey="n" rel="next">OpenACC Library Interoperability</a>, Previous: <a href="OpenACC-Environment-Variables.html#OpenACC-Environment-Variables" accesskey="p" rel="prev">OpenACC Environment Variables</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Library-Index.html#Library-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="CUDA-Streams-Usage-1"></a>
  69. <h2 class="chapter">7 CUDA Streams Usage</h2>
  70. <p>This applies to the <code>nvptx</code> plugin only.
  71. </p>
  72. <p>The library provides elements that perform asynchronous movement of
  73. data and asynchronous operation of computing constructs. This
  74. asynchronous functionality is implemented by making use of CUDA
  75. streams<a name="DOCF1" href="#FOOT1"><sup>1</sup></a>.
  76. </p>
  77. <p>The primary means by that the asychronous functionality is accessed
  78. is through the use of those OpenACC directives which make use of the
  79. <code>async</code> and <code>wait</code> clauses. When the <code>async</code> clause is
  80. first used with a directive, it creates a CUDA stream. If an
  81. <code>async-argument</code> is used with the <code>async</code> clause, then the
  82. stream is associated with the specified <code>async-argument</code>.
  83. </p>
  84. <p>Following the creation of an association between a CUDA stream and the
  85. <code>async-argument</code> of an <code>async</code> clause, both the <code>wait</code>
  86. clause and the <code>wait</code> directive can be used. When either the
  87. clause or directive is used after stream creation, it creates a
  88. rendezvous point whereby execution waits until all operations
  89. associated with the <code>async-argument</code>, that is, stream, have
  90. completed.
  91. </p>
  92. <p>Normally, the management of the streams that are created as a result of
  93. using the <code>async</code> clause, is done without any intervention by the
  94. caller. This implies the association between the <code>async-argument</code>
  95. and the CUDA stream will be maintained for the lifetime of the program.
  96. However, this association can be changed through the use of the library
  97. function <code>acc_set_cuda_stream</code>. When the function
  98. <code>acc_set_cuda_stream</code> is called, the CUDA stream that was
  99. originally associated with the <code>async</code> clause will be destroyed.
  100. Caution should be taken when changing the association as subsequent
  101. references to the <code>async-argument</code> refer to a different
  102. CUDA stream.
  103. </p>
  104. <div class="footnote">
  105. <hr>
  106. <h4 class="footnotes-heading">Footnotes</h4>
  107. <h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
  108. <p>See &quot;Stream Management&quot; in &quot;CUDA Driver API&quot;,
  109. TRM-06703-001, Version 5.5, for additional information</p>
  110. </div>
  111. <hr>
  112. <div class="header">
  113. <p>
  114. Next: <a href="OpenACC-Library-Interoperability.html#OpenACC-Library-Interoperability" accesskey="n" rel="next">OpenACC Library Interoperability</a>, Previous: <a href="OpenACC-Environment-Variables.html#OpenACC-Environment-Variables" accesskey="p" rel="prev">OpenACC Environment Variables</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Library-Index.html#Library-Index" title="Index" rel="index">Index</a>]</p>
  115. </div>
  116. </body>
  117. </html>