pyopencl icon indicating copy to clipboard operation
pyopencl copied to clipboard

Disable kernel caching from within pyopencl code

Open Novermars opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. When debugging an OpenCL implementation, I like to use pyopencl for my reproducers for other teams and easy testing. Since the default behavior is caching, this causes some surprises when tuning for example an OpenCL compiler, running the same code but expecting different results due to the tuning.

Describe the solution you'd like Add a keyword argument to pyopencl.Program.build(...) called 'cached', which is a bool. If true, use caching even if PYOPENCL_NO_CACHE is not set, possible print a warning about this. If false, don't use caching, even if PYOPENCL_NO_CACHE was set, possibly print a warning about this.

Describe alternatives you've considered

Additional context

Novermars avatar Mar 07 '23 08:03 Novermars

I'm supportive of this suggestion, including the warnings you describe. I would be happy to consider a PR along these lines.

inducer avatar Mar 07 '23 19:03 inducer