OpenACC-Runtime-Library-Routines.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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: OpenACC Runtime Library Routines</title>
  20. <meta name="description" content="GNU libgomp: OpenACC Runtime Library Routines">
  21. <meta name="keywords" content="GNU libgomp: OpenACC Runtime Library Routines">
  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="acc_005fget_005fnum_005fdevices.html#acc_005fget_005fnum_005fdevices" rel="next" title="acc_get_num_devices">
  31. <link href="Enabling-OpenACC.html#Enabling-OpenACC" rel="prev" title="Enabling OpenACC">
  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="OpenACC-Runtime-Library-Routines"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="OpenACC-Environment-Variables.html#OpenACC-Environment-Variables" accesskey="n" rel="next">OpenACC Environment Variables</a>, Previous: <a href="Enabling-OpenACC.html#Enabling-OpenACC" accesskey="p" rel="prev">Enabling OpenACC</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="OpenACC-Runtime-Library-Routines-1"></a>
  69. <h2 class="chapter">5 OpenACC Runtime Library Routines</h2>
  70. <p>The runtime routines described here are defined by section 3 of the OpenACC
  71. specifications in version 2.0.
  72. They have C linkage, and do not throw exceptions.
  73. Generally, they are available only for the host, with the exception of
  74. <code>acc_on_device</code>, which is available for both the host and the
  75. acceleration device.
  76. </p>
  77. <table class="menu" border="0" cellspacing="0">
  78. <tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fnum_005fdevices.html#acc_005fget_005fnum_005fdevices" accesskey="1">acc_get_num_devices</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get number of devices for the given device
  79. type.
  80. </td></tr>
  81. <tr><td align="left" valign="top">&bull; <a href="acc_005fset_005fdevice_005ftype.html#acc_005fset_005fdevice_005ftype" accesskey="2">acc_set_device_type</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Set type of device accelerator to use.
  82. </td></tr>
  83. <tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fdevice_005ftype.html#acc_005fget_005fdevice_005ftype" accesskey="3">acc_get_device_type</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get type of device accelerator to be used.
  84. </td></tr>
  85. <tr><td align="left" valign="top">&bull; <a href="acc_005fset_005fdevice_005fnum.html#acc_005fset_005fdevice_005fnum" accesskey="4">acc_set_device_num</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Set device number to use.
  86. </td></tr>
  87. <tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fdevice_005fnum.html#acc_005fget_005fdevice_005fnum" accesskey="5">acc_get_device_num</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get device number to be used.
  88. </td></tr>
  89. <tr><td align="left" valign="top">&bull; <a href="acc_005fasync_005ftest.html#acc_005fasync_005ftest" accesskey="6">acc_async_test</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Tests for completion of a specific asynchronous
  90. operation.
  91. </td></tr>
  92. <tr><td align="left" valign="top">&bull; <a href="acc_005fasync_005ftest_005fall.html#acc_005fasync_005ftest_005fall" accesskey="7">acc_async_test_all</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Tests for completion of all asychronous
  93. operations.
  94. </td></tr>
  95. <tr><td align="left" valign="top">&bull; <a href="acc_005fwait.html#acc_005fwait" accesskey="8">acc_wait</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Wait for completion of a specific asynchronous
  96. operation.
  97. </td></tr>
  98. <tr><td align="left" valign="top">&bull; <a href="acc_005fwait_005fall.html#acc_005fwait_005fall" accesskey="9">acc_wait_all</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Waits for completion of all asyncrhonous
  99. operations.
  100. </td></tr>
  101. <tr><td align="left" valign="top">&bull; <a href="acc_005fwait_005fall_005fasync.html#acc_005fwait_005fall_005fasync">acc_wait_all_async</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Wait for completion of all asynchronous
  102. operations.
  103. </td></tr>
  104. <tr><td align="left" valign="top">&bull; <a href="acc_005fwait_005fasync.html#acc_005fwait_005fasync">acc_wait_async</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Wait for completion of asynchronous operations.
  105. </td></tr>
  106. <tr><td align="left" valign="top">&bull; <a href="acc_005finit.html#acc_005finit">acc_init</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Initialize runtime for a specific device type.
  107. </td></tr>
  108. <tr><td align="left" valign="top">&bull; <a href="acc_005fshutdown.html#acc_005fshutdown">acc_shutdown</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Shuts down the runtime for a specific device
  109. type.
  110. </td></tr>
  111. <tr><td align="left" valign="top">&bull; <a href="acc_005fon_005fdevice.html#acc_005fon_005fdevice">acc_on_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Whether executing on a particular device
  112. </td></tr>
  113. <tr><td align="left" valign="top">&bull; <a href="acc_005fmalloc.html#acc_005fmalloc">acc_malloc</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Allocate device memory.
  114. </td></tr>
  115. <tr><td align="left" valign="top">&bull; <a href="acc_005ffree.html#acc_005ffree">acc_free</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Free device memory.
  116. </td></tr>
  117. <tr><td align="left" valign="top">&bull; <a href="acc_005fcopyin.html#acc_005fcopyin">acc_copyin</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Allocate device memory and copy host memory to
  118. it.
  119. </td></tr>
  120. <tr><td align="left" valign="top">&bull; <a href="acc_005fpresent_005for_005fcopyin.html#acc_005fpresent_005for_005fcopyin">acc_present_or_copyin</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">If the data is not present on the device,
  121. allocate device memory and copy from host
  122. memory.
  123. </td></tr>
  124. <tr><td align="left" valign="top">&bull; <a href="acc_005fcreate.html#acc_005fcreate">acc_create</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Allocate device memory and map it to host
  125. memory.
  126. </td></tr>
  127. <tr><td align="left" valign="top">&bull; <a href="acc_005fpresent_005for_005fcreate.html#acc_005fpresent_005for_005fcreate">acc_present_or_create</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">If the data is not present on the device,
  128. allocate device memory and map it to host
  129. memory.
  130. </td></tr>
  131. <tr><td align="left" valign="top">&bull; <a href="acc_005fcopyout.html#acc_005fcopyout">acc_copyout</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Copy device memory to host memory.
  132. </td></tr>
  133. <tr><td align="left" valign="top">&bull; <a href="acc_005fdelete.html#acc_005fdelete">acc_delete</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Free device memory.
  134. </td></tr>
  135. <tr><td align="left" valign="top">&bull; <a href="acc_005fupdate_005fdevice.html#acc_005fupdate_005fdevice">acc_update_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Update device memory from mapped host memory.
  136. </td></tr>
  137. <tr><td align="left" valign="top">&bull; <a href="acc_005fupdate_005fself.html#acc_005fupdate_005fself">acc_update_self</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Update host memory from mapped device memory.
  138. </td></tr>
  139. <tr><td align="left" valign="top">&bull; <a href="acc_005fmap_005fdata.html#acc_005fmap_005fdata">acc_map_data</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Map previously allocated device memory to host
  140. memory.
  141. </td></tr>
  142. <tr><td align="left" valign="top">&bull; <a href="acc_005funmap_005fdata.html#acc_005funmap_005fdata">acc_unmap_data</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Unmap device memory from host memory.
  143. </td></tr>
  144. <tr><td align="left" valign="top">&bull; <a href="acc_005fdeviceptr.html#acc_005fdeviceptr">acc_deviceptr</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get device pointer associated with specific
  145. host address.
  146. </td></tr>
  147. <tr><td align="left" valign="top">&bull; <a href="acc_005fhostptr.html#acc_005fhostptr">acc_hostptr</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get host pointer associated with specific
  148. device address.
  149. </td></tr>
  150. <tr><td align="left" valign="top">&bull; <a href="acc_005fis_005fpresent.html#acc_005fis_005fpresent">acc_is_present</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Indiciate whether host variable / array is
  151. present on device.
  152. </td></tr>
  153. <tr><td align="left" valign="top">&bull; <a href="acc_005fmemcpy_005fto_005fdevice.html#acc_005fmemcpy_005fto_005fdevice">acc_memcpy_to_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Copy host memory to device memory.
  154. </td></tr>
  155. <tr><td align="left" valign="top">&bull; <a href="acc_005fmemcpy_005ffrom_005fdevice.html#acc_005fmemcpy_005ffrom_005fdevice">acc_memcpy_from_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Copy device memory to host memory.
  156. </td></tr>
  157. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  158. API routines for target platforms.
  159. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fcurrent_005fcuda_005fdevice.html#acc_005fget_005fcurrent_005fcuda_005fdevice">acc_get_current_cuda_device</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get CUDA device handle.
  160. </td></tr>
  161. <tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fcurrent_005fcuda_005fcontext.html#acc_005fget_005fcurrent_005fcuda_005fcontext">acc_get_current_cuda_context</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get CUDA context handle.
  162. </td></tr>
  163. <tr><td align="left" valign="top">&bull; <a href="acc_005fget_005fcuda_005fstream.html#acc_005fget_005fcuda_005fstream">acc_get_cuda_stream</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get CUDA stream handle.
  164. </td></tr>
  165. <tr><td align="left" valign="top">&bull; <a href="acc_005fset_005fcuda_005fstream.html#acc_005fset_005fcuda_005fstream">acc_set_cuda_stream</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Set CUDA stream handle.
  166. </td></tr>
  167. </table>
  168. <hr>
  169. <div class="header">
  170. <p>
  171. Next: <a href="OpenACC-Environment-Variables.html#OpenACC-Environment-Variables" accesskey="n" rel="next">OpenACC Environment Variables</a>, Previous: <a href="Enabling-OpenACC.html#Enabling-OpenACC" accesskey="p" rel="prev">Enabling OpenACC</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>
  172. </div>
  173. </body>
  174. </html>