Disable caching by the opencl compiler

Hi,
I am trying to profile OpenCL compiler compile time performance. I noticed that the compilation speed reduces dramatically during the subsequent compilation phase. Is there a way to get around that. I want to record similar compilation times for each run. I am using clCreateProgramWithSource
to compile my opencl kernel.

Thanks
Gudge

I don’t know an official way to disallow the compiler to cache and reuse the binaries for the same source code, but you could try to add dummy whitespaces / comments to the source code, hoping that the compiler is just using some sort of checksum of the source code before running the pre-compiler to see whether it has already compiled that source code.

Occasionally I delete the ComputeCache from %AppData%\NVIDIA\ComputeCache (Windows) or
~/.nv/ (Linux).
Don’t know if this is a safe thing to do, but it worked for me.

You can set the CUDA_CACHE_DISABLE variable to disable caching.

In C/C++ do this before Platform initialization:

setenv("CUDA_CACHE_DISABLE", "1", 1);

Cheers,

Richard