inducer / pyopencl

OpenCL integration for Python, plus shiny features
http://mathema.tician.de/software/pyopencl
Other
1.04k stars 238 forks source link

Disable kernel caching from within pyopencl code #678

Open Novermars opened 1 year ago

Novermars commented 1 year ago

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

inducer commented 1 year ago

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