How can I set shared memory configuration for NVIDIA graphics card to increase L1 cache?

5 次查看(过去 30 天)
I need to set the shared memory configuration for NVIDIA graphics card by running the following command in C:
cudaDeviceSetCacheConfig(cudaFuncCachePreferL1);
This will set L1 cache to 48KB instead of default 16KB (to benefit from higher L1 cache hit rate in my application).
How do I do this if I don't want to use mex file but run CUDA kernel on GPU using precompiled PTX code?

回答(1 个)

Joss Knight
Joss Knight 2016-2-26
编辑:Joss Knight 2016-2-26
You can't, but you can write a mex function to do it, that will affect your next CUDAKernel call.
MEX functions do not initialise the GPU on every call so I don't quite understand what is preventing you from using mex functions in this case. The mechanism through which kernels are launched are different so I couldn't say definitively whether using CUDAKernel or launching a kernel yourself using a MEX function would be faster.

类别

Help CenterFile Exchange 中查找有关 GPU Computing 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by