Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invoker, scan: honor PYOPENCL_NO_CACHE for writing #736

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pyopencl/invoker.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ def _check_arg_size(function_name, num_cl_args, arg_types, devs):
# }}}


invoker_cache = WriteOncePersistentDict(
if not cl._PYOPENCL_NO_CACHE:
invoker_cache = WriteOncePersistentDict(
"pyopencl-invoker-cache-v41",
key_builder=_NumpyTypesKeyBuilder(),
in_mem_cache_size=0)
matthiasdiener marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -400,7 +401,8 @@ def generate_enqueue_and_set_args(function_name,

if not from_cache:
pmod, enqueue_name = _generate_enqueue_and_set_args_module(*cache_key)
invoker_cache.store_if_not_present(cache_key, (pmod, enqueue_name))
if not cl._PYOPENCL_NO_CACHE:
invoker_cache.store_if_not_present(cache_key, (pmod, enqueue_name))

return (
pmod.mod_globals[enqueue_name],
Expand Down
6 changes: 4 additions & 2 deletions pyopencl/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,8 @@ def finish_setup(self) -> None:
pass


generic_scan_kernel_cache = WriteOncePersistentDict(
if not cl._PYOPENCL_NO_CACHE:
generic_scan_kernel_cache = WriteOncePersistentDict(
"pyopencl-generated-scan-kernel-cache-v1",
key_builder=_NumpyTypesKeyBuilder(),
in_mem_cache_size=0)
Expand Down Expand Up @@ -1199,7 +1200,8 @@ def finish_setup(self) -> None:
self.second_level_scan_gen_info,
self.final_update_gen_info)

generic_scan_kernel_cache.store_if_not_present(cache_key, result)
if not cl._PYOPENCL_NO_CACHE:
generic_scan_kernel_cache.store_if_not_present(cache_key, result)

# Build the kernels.
self.first_level_scan_info = self.first_level_scan_gen_info.build(
Expand Down
Loading