Clear Filters
Clear Filters

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

5 views (last 30 days)
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?

Answers (1)

Joss Knight
Joss Knight on 26 Feb 2016
Edited: Joss Knight on 26 Feb 2016
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.

Tags

Community Treasure Hunt

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

Start Hunting!