Sophie

Sophie

distrib > Mageia > 2 > i586 > media > nonfree-release > by-pkgid > f86555c654b1f4a4c7ccf47789979868 > files > 1167

nvidia-cuda-toolkit-devel-4.2.9-2.mga2.nonfree.i586.rpm

<!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: cuLaunchKernel</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&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
  <div class="navpath"><a class="el" href="group__CUDA__EXEC.html">Execution Control</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__EXEC_g5e92a1b0d8d1b82cb00dcfb2de15961b.html#g5e92a1b0d8d1b82cb00dcfb2de15961b">cuFuncGetAttribute</a></td></tr>
          <tr><td class="navtab"><a class="qindex" href="group__CUDA__EXEC_g40f8c11e81def95dc0072a375f965681.html#g40f8c11e81def95dc0072a375f965681">cuFuncSetCacheConfig</a></td></tr>
          <tr><td class="navtab"><a class="qindexHL" href="group__CUDA__EXEC_gb8f3dc3031b40da29d5f9a7139e52e15.html#gb8f3dc3031b40da29d5f9a7139e52e15">cuLaunchKernel</a></td></tr>
        </table>
      </div>
   </td>
   <td valign="top">
<a class="anchor" name="gb8f3dc3031b40da29d5f9a7139e52e15"></a><!-- doxytag: member="cuda.h::cuLaunchKernel" ref="gb8f3dc3031b40da29d5f9a7139e52e15" args="(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra)" -->
<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> cuLaunchKernel           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__CUDA__TYPES_gba6128b948022f495706d93bc2cea9c8.html#gba6128b948022f495706d93bc2cea9c8">CUfunction</a>&nbsp;</td>
          <td class="paramname"> <em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>gridDimX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>gridDimY</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>gridDimZ</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>blockDimX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>blockDimY</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>blockDimZ</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>sharedMemBytes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CUDA__TYPES_gb946c7f02e09efd788a204718015d88a.html#gb946c7f02e09efd788a204718015d88a">CUstream</a>&nbsp;</td>
          <td class="paramname"> <em>hStream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **&nbsp;</td>
          <td class="paramname"> <em>kernelParams</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **&nbsp;</td>
          <td class="paramname"> <em>extra</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Invokes the kernel <code>f</code> on a <code>gridDimX</code> x <code>gridDimY</code> x <code>gridDimZ</code> grid of blocks. Each block contains <code>blockDimX</code> x <code>blockDimY</code> x <code>blockDimZ</code> threads.<p>
<code>sharedMemBytes</code> sets the amount of dynamic shared memory that will be available to each thread block.<p>
<a class="el" href="group__CUDA__EXEC_gb8f3dc3031b40da29d5f9a7139e52e15.html#gb8f3dc3031b40da29d5f9a7139e52e15" title="Launches a CUDA function.">cuLaunchKernel()</a> can optionally be associated to a stream by passing a non-zero <code>hStream</code> argument.<p>
Kernel parameters to <code>f</code> can be specified in one of two ways:<p>
1) Kernel parameters can be specified via <code>kernelParams</code>. If <code>f</code> has N parameters, then <code>kernelParams</code> needs to be an array of N pointers. Each of <code>kernelParams</code>[0] through <code>kernelParams</code>[N-1] must point to a region of memory from which the actual kernel parameter will be copied. The number of kernel parameters and their offsets and sizes do not need to be specified as that information is retrieved directly from the kernel's image.<p>
2) Kernel parameters can also be packaged by the application into a single buffer that is passed in via the <code>extra</code> parameter. This places the burden on the application of knowing each kernel parameter's size and alignment/padding within the buffer. Here is an example of using the <code>extra</code> parameter in this manner: <div class="fragment"><pre class="fragment">    <span class="keywordtype">size_t</span> argBufferSize;
    <span class="keywordtype">char</span> argBuffer[256];

    <span class="comment">// populate argBuffer and argBufferSize</span>

    <span class="keywordtype">void</span> *config[] = {
        <a class="code" href="group__CUDA__TYPES_g36d10d0b40c51372877578a2cffd6acd.html#g36d10d0b40c51372877578a2cffd6acd">CU_LAUNCH_PARAM_BUFFER_POINTER</a>, argBuffer,
        <a class="code" href="group__CUDA__TYPES_gf339c057cd94562ead93a192e11c17e9.html#gf339c057cd94562ead93a192e11c17e9">CU_LAUNCH_PARAM_BUFFER_SIZE</a>,    &amp;argBufferSize,
        <a class="code" href="group__CUDA__TYPES_gd5c11cff5adfa5a69d66829399653532.html#gd5c11cff5adfa5a69d66829399653532">CU_LAUNCH_PARAM_END</a>
    };
    status = <a class="code" href="group__CUDA__EXEC_gb8f3dc3031b40da29d5f9a7139e52e15.html#gb8f3dc3031b40da29d5f9a7139e52e15" title="Launches a CUDA function.">cuLaunchKernel</a>(f, gx, gy, gz, bx, by, bz, sh, s, NULL, config);
</pre></div><p>
The <code>extra</code> parameter exists to allow <a class="el" href="group__CUDA__EXEC_gb8f3dc3031b40da29d5f9a7139e52e15.html#gb8f3dc3031b40da29d5f9a7139e52e15" title="Launches a CUDA function.">cuLaunchKernel</a> to take additional less commonly used arguments. <code>extra</code> specifies a list of names of extra settings and their corresponding values. Each extra setting name is immediately followed by the corresponding value. The list must be terminated with either NULL or <a class="el" href="group__CUDA__TYPES_gd5c11cff5adfa5a69d66829399653532.html#gd5c11cff5adfa5a69d66829399653532">CU_LAUNCH_PARAM_END</a>.<p>
<ul>
<li><a class="el" href="group__CUDA__TYPES_gd5c11cff5adfa5a69d66829399653532.html#gd5c11cff5adfa5a69d66829399653532">CU_LAUNCH_PARAM_END</a>, which indicates the end of the <code>extra</code> array;</li><li><a class="el" href="group__CUDA__TYPES_g36d10d0b40c51372877578a2cffd6acd.html#g36d10d0b40c51372877578a2cffd6acd">CU_LAUNCH_PARAM_BUFFER_POINTER</a>, which specifies that the next value in <code>extra</code> will be a pointer to a buffer containing all the kernel parameters for launching kernel <code>f</code>;</li><li><a class="el" href="group__CUDA__TYPES_gf339c057cd94562ead93a192e11c17e9.html#gf339c057cd94562ead93a192e11c17e9">CU_LAUNCH_PARAM_BUFFER_SIZE</a>, which specifies that the next value in <code>extra</code> will be a pointer to a size_t containing the size of the buffer specified with <a class="el" href="group__CUDA__TYPES_g36d10d0b40c51372877578a2cffd6acd.html#g36d10d0b40c51372877578a2cffd6acd">CU_LAUNCH_PARAM_BUFFER_POINTER</a>;</li></ul>
<p>
The error <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa90696c86fcee1f536a1ec7d25867feeb">CUDA_ERROR_INVALID_VALUE</a> will be returned if kernel parameters are specified with both <code>kernelParams</code> and <code>extra</code> (i.e. both <code>kernelParams</code> and <code>extra</code> are non-NULL).<p>
Calling <a class="el" href="group__CUDA__EXEC_gb8f3dc3031b40da29d5f9a7139e52e15.html#gb8f3dc3031b40da29d5f9a7139e52e15" title="Launches a CUDA function.">cuLaunchKernel()</a> sets persistent function state that is the same as function state set through the following deprecated APIs:<p>
<a class="el" href="group__CUDA__EXEC__DEPRECATED_g61e4450eaedf5159547e75199fe1c447.html#g61e4450eaedf5159547e75199fe1c447" title="Sets the block-dimensions for the function.">cuFuncSetBlockShape()</a> <a class="el" href="group__CUDA__EXEC__DEPRECATED_g440dbf66d2e977528779527f3eaadab1.html#g440dbf66d2e977528779527f3eaadab1" title="Sets the dynamic shared-memory size for the function.">cuFuncSetSharedSize()</a> <a class="el" href="group__CUDA__EXEC__DEPRECATED_gdf689dac0db8f6c1232c339d3f923554.html#gdf689dac0db8f6c1232c339d3f923554" title="Sets the parameter size for the function.">cuParamSetSize()</a> <a class="el" href="group__CUDA__EXEC__DEPRECATED_g183700c3c8934cf46077355c39247c14.html#g183700c3c8934cf46077355c39247c14" title="Adds an integer parameter to the function&#39;s argument list.">cuParamSeti()</a> <a class="el" href="group__CUDA__EXEC__DEPRECATED_g793176d32b0bf9ad842d4fc157d07e80.html#g793176d32b0bf9ad842d4fc157d07e80" title="Adds a floating-point parameter to the function&#39;s argument list.">cuParamSetf()</a> <a class="el" href="group__CUDA__EXEC__DEPRECATED_gcc446977269d74db8fdd341959409ea7.html#gcc446977269d74db8fdd341959409ea7" title="Adds arbitrary data to the function&#39;s argument list.">cuParamSetv()</a><p>
When the kernel <code>f</code> is launched via <a class="el" href="group__CUDA__EXEC_gb8f3dc3031b40da29d5f9a7139e52e15.html#gb8f3dc3031b40da29d5f9a7139e52e15" title="Launches a CUDA function.">cuLaunchKernel()</a>, the previous block shape, shared size and parameter info associated with <code>f</code> is overwritten.<p>
Note that to use <a class="el" href="group__CUDA__EXEC_gb8f3dc3031b40da29d5f9a7139e52e15.html#gb8f3dc3031b40da29d5f9a7139e52e15" title="Launches a CUDA function.">cuLaunchKernel()</a>, the kernel <code>f</code> must either have been compiled with toolchain version 3.2 or later so that it will contain kernel parameter information, or have no kernel parameters. If either of these conditions is not met, then <a class="el" href="group__CUDA__EXEC_gb8f3dc3031b40da29d5f9a7139e52e15.html#gb8f3dc3031b40da29d5f9a7139e52e15" title="Launches a CUDA function.">cuLaunchKernel()</a> will return <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa0b7bd1dd2fb3491c588ce569c02d1a2f">CUDA_ERROR_INVALID_IMAGE</a>.<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>f</em>&nbsp;</td><td>- Kernel to launch </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>gridDimX</em>&nbsp;</td><td>- Width of grid in blocks </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>gridDimY</em>&nbsp;</td><td>- Height of grid in blocks </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>gridDimZ</em>&nbsp;</td><td>- Depth of grid in blocks </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>blockDimX</em>&nbsp;</td><td>- X dimension of each thread block </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>blockDimY</em>&nbsp;</td><td>- Y dimension of each thread block </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>blockDimZ</em>&nbsp;</td><td>- Z dimension of each thread block </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>sharedMemBytes</em>&nbsp;</td><td>- Dynamic shared-memory size per thread block in bytes </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>hStream</em>&nbsp;</td><td>- Stream identifier </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>kernelParams</em>&nbsp;</td><td>- Array of pointers to kernel parameters </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>extra</em>&nbsp;</td><td>- Extra options</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>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa0b7bd1dd2fb3491c588ce569c02d1a2f">CUDA_ERROR_INVALID_IMAGE</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa90696c86fcee1f536a1ec7d25867feeb">CUDA_ERROR_INVALID_VALUE</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa4f270bc1011b152febc8154b2b1e1b8d">CUDA_ERROR_LAUNCH_FAILED</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaab5da09cc5697599a56a71a04184ffdaa">CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa65460d83f63575af9805ca59f8f19d74">CUDA_ERROR_LAUNCH_TIMEOUT</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaa9e36a98a3a2c5123d422b9a1b69dd5f6">CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING</a>, <a class="el" href="group__CUDA__TYPES_g0cdead942fd5028d157641eef6bdeeaa.html#gg0cdead942fd5028d157641eef6bdeeaad8a149ebc98aa90f6417e531fa645043">CUDA_ERROR_SHARED_OBJECT_INIT_FAILED</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__CTX_g40b6b141698f76744dea6e39b9a25360.html#g40b6b141698f76744dea6e39b9a25360" title="Returns the preferred cache configuration for the current context.">cuCtxGetCacheConfig</a>, <a class="el" href="group__CUDA__CTX_g54699acf7e2ef27279d013ca2095f4a3.html#g54699acf7e2ef27279d013ca2095f4a3" title="Sets the preferred cache configuration for the current context.">cuCtxSetCacheConfig</a>, <a class="el" href="group__CUDA__EXEC_g40f8c11e81def95dc0072a375f965681.html#g40f8c11e81def95dc0072a375f965681" title="Sets the preferred cache configuration for a device function.">cuFuncSetCacheConfig</a>, <a class="el" href="group__CUDA__EXEC_g5e92a1b0d8d1b82cb00dcfb2de15961b.html#g5e92a1b0d8d1b82cb00dcfb2de15961b" title="Returns information about a function.">cuFuncGetAttribute</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 &nbsp;<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>