<!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: cudaFuncSetCacheConfig</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__CUDART__EXECUTION.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__CUDART__EXECUTION_g19a7dd5a102b499c39f6a7648bec757a.html#g19a7dd5a102b499c39f6a7648bec757a">cudaConfigureCall</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__EXECUTION_ge89e3ebfbbdfa352b048c7d19904fc1b.html#ge89e3ebfbbdfa352b048c7d19904fc1b">cudaFuncGetAttributes</a></td></tr> <tr><td class="navtab"><a class="qindexHL" href="group__CUDART__EXECUTION_g400ecf473d4fa8ac6738fbc753d5c288.html#g400ecf473d4fa8ac6738fbc753d5c288">cudaFuncSetCacheConfig</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__EXECUTION_gfb689b458305548d37d91a265cfda9b0.html#gfb689b458305548d37d91a265cfda9b0">cudaLaunch</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__EXECUTION_gb9574eae787e2c3c91f4954542b17515.html#gb9574eae787e2c3c91f4954542b17515">cudaSetDoubleForDevice</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__EXECUTION_g857c928b6e8a9e4c4c2ec4d4cc5c4063.html#g857c928b6e8a9e4c4c2ec4d4cc5c4063">cudaSetDoubleForHost</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__EXECUTION_gad1ff3ec13bd21524425779542eca8ef.html#gad1ff3ec13bd21524425779542eca8ef">cudaSetupArgument</a></td></tr> </table> </div> </td> <td valign="top"> <a class="anchor" name="g400ecf473d4fa8ac6738fbc753d5c288"></a><!-- doxytag: member="cuda_runtime_api.h::cudaFuncSetCacheConfig" ref="g400ecf473d4fa8ac6738fbc753d5c288" args="(const char *func, enum cudaFuncCache cacheConfig)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="group__CUDART__TYPES_gf599e5b8b829ce7db0f5216928f6ecb6.html#gf599e5b8b829ce7db0f5216928f6ecb6">cudaError_t</a> cudaFuncSetCacheConfig </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>func</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">enum <a class="el" href="group__CUDART__TYPES_gb980f35ed69ee7991704de29a13de49b.html#gb980f35ed69ee7991704de29a13de49b">cudaFuncCache</a> </td> <td class="paramname"> <em>cacheConfig</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p> On devices where the L1 cache and shared memory use the same hardware resources, this sets through <code>cacheConfig</code> the preferred cache configuration for the function specified via <code>func</code>. This is only a preference. The runtime will use the requested configuration if possible, but it is free to choose a different configuration if required to execute <code>func</code>.<p> <code>func</code> is a device function symbol and must be declared as a <code>__global__</code> function. If the specified function does not exist, then <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038b6af535e7e53d3f21e2437e8977b8c2e">cudaErrorInvalidDeviceFunction</a> is returned.<p> This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.<p> Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point.<p> The supported cache configurations are:<ul> <li><a class="el" href="group__CUDART__TYPES_gb980f35ed69ee7991704de29a13de49b.html#ggb980f35ed69ee7991704de29a13de49b3b4b8c65376ce1ca107be413e15981bc">cudaFuncCachePreferNone</a>: no preference for shared memory or L1 (default)</li><li><a class="el" href="group__CUDART__TYPES_gb980f35ed69ee7991704de29a13de49b.html#ggb980f35ed69ee7991704de29a13de49b84725d25c531f9bafc61ae329afe5b2b">cudaFuncCachePreferShared</a>: prefer larger shared memory and smaller L1 cache</li><li><a class="el" href="group__CUDART__TYPES_gb980f35ed69ee7991704de29a13de49b.html#ggb980f35ed69ee7991704de29a13de49b8ecb48ccbc2230c81528a2c7c695100e">cudaFuncCachePreferL1</a>: prefer larger L1 cache and smaller shared memory</li></ul> <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>func</em> </td><td>- Char string naming device function </td></tr> <tr><td valign="top"></td><td valign="top"><em>cacheConfig</em> </td><td>- Requested cache configuration</td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd><a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591">cudaSuccess</a>, <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038ce7993a88ecf2c57b8102d55d997a18c">cudaErrorInitializationError</a>, <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038b6af535e7e53d3f21e2437e8977b8c2e">cudaErrorInvalidDeviceFunction</a> </dd></dl> <dl class="note" compact><dt><b>Note:</b></dt><dd>The <code>func</code> paramater may also be a character string that specifies the fully-decorated (C++) name for a function that executes on the device, however this usage is deprecated as of CUDA 4.1. <p> 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__CUDART__EXECUTION_g19a7dd5a102b499c39f6a7648bec757a.html#g19a7dd5a102b499c39f6a7648bec757a" title="Configure a device-launch.">cudaConfigureCall</a>, <a class="el" href="group__CUDART__HIGHLEVEL_ge0969184de8a5c2d809aa8d7d2425484.html#ge0969184de8a5c2d809aa8d7d2425484">cudaFuncSetCacheConfig (C++ API)</a>, <a class="el" href="group__CUDART__EXECUTION_ge89e3ebfbbdfa352b048c7d19904fc1b.html#ge89e3ebfbbdfa352b048c7d19904fc1b">cudaFuncGetAttributes (C API)</a>, <a class="el" href="group__CUDART__EXECUTION_gfb689b458305548d37d91a265cfda9b0.html#gfb689b458305548d37d91a265cfda9b0">cudaLaunch (C API)</a>, <a class="el" href="group__CUDART__EXECUTION_gb9574eae787e2c3c91f4954542b17515.html#gb9574eae787e2c3c91f4954542b17515" title="Converts a double argument to be executed on a device.">cudaSetDoubleForDevice</a>, <a class="el" href="group__CUDART__EXECUTION_g857c928b6e8a9e4c4c2ec4d4cc5c4063.html#g857c928b6e8a9e4c4c2ec4d4cc5c4063" title="Converts a double argument after execution on a device.">cudaSetDoubleForHost</a>, <a class="el" href="group__CUDART__EXECUTION_gad1ff3ec13bd21524425779542eca8ef.html#gad1ff3ec13bd21524425779542eca8ef">cudaSetupArgument (C API)</a>, <a class="el" href="group__CUDART__THREAD__DEPRECATED_g7a82ef85e4f7e0cff0a84b2f7f6bc63a.html#g7a82ef85e4f7e0cff0a84b2f7f6bc63a" title="Returns the preferred cache configuration for the current device.">cudaThreadGetCacheConfig</a>, <a class="el" href="group__CUDART__THREAD__DEPRECATED_g27d0f538b3018142bf04deae7f02c49e.html#g27d0f538b3018142bf04deae7f02c49e" title="Sets the preferred cache configuration for the current device.">cudaThreadSetCacheConfig</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>