diff --git a/python/pylibcudf/pylibcudf/CMakeLists.txt b/python/pylibcudf/pylibcudf/CMakeLists.txt index 3a93b4aa1750..38313cfb2bd3 100644 --- a/python/pylibcudf/pylibcudf/CMakeLists.txt +++ b/python/pylibcudf/pylibcudf/CMakeLists.txt @@ -1,6 +1,6 @@ # ============================================================================= # cmake-format: off -# SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # cmake-format: on # ============================================================================= @@ -10,6 +10,7 @@ set(cython_sources binaryop.pyx column.pyx column_factories.pyx + context.pyx contiguous_split.pyx concatenate.pyx copying.pyx diff --git a/python/pylibcudf/pylibcudf/__init__.py b/python/pylibcudf/pylibcudf/__init__.py index 05b6a76ca8ab..85348f398b74 100644 --- a/python/pylibcudf/pylibcudf/__init__.py +++ b/python/pylibcudf/pylibcudf/__init__.py @@ -16,6 +16,7 @@ binaryop, column_factories, concatenate, + context, contiguous_split, copying, datetime, @@ -71,6 +72,7 @@ "binaryop", "column_factories", "concatenate", + "context", "contiguous_split", "copying", "datetime", diff --git a/python/pylibcudf/pylibcudf/context.pxd b/python/pylibcudf/pylibcudf/context.pxd new file mode 100644 index 000000000000..a0745fef4034 --- /dev/null +++ b/python/pylibcudf/pylibcudf/context.pxd @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. +# SPDX-License-Identifier: Apache-2.0 + +cpdef enable_jit_cache(bool enable) + +cpdef clear_jit_cache() diff --git a/python/pylibcudf/pylibcudf/context.pyi b/python/pylibcudf/pylibcudf/context.pyi new file mode 100644 index 000000000000..515e5eeb79ac --- /dev/null +++ b/python/pylibcudf/pylibcudf/context.pyi @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. +# SPDX-License-Identifier: Apache-2.0 + +def enable_jit_cache(enable: bool) -> None: ... +def clear_jit_cache() -> None: ... diff --git a/python/pylibcudf/pylibcudf/context.pyx b/python/pylibcudf/pylibcudf/context.pyx new file mode 100644 index 000000000000..f474bfeba875 --- /dev/null +++ b/python/pylibcudf/pylibcudf/context.pyx @@ -0,0 +1,29 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. +# SPDX-License-Identifier: Apache-2.0 + +from pylibcudf.libcudf cimport context as cpp_context + + +__all__ = ["clear_jit_cache", "enable_jit_cache"] + + +cpdef enable_jit_cache(bool enable): + """Enable or disable the JIT program cache. + + When disabled, the cache will not be used for storing or retrieving + compiled programs. When enabled, the cache will be used as normal. + + Parameters + ---------- + enable : bool + If ``True``, the JIT program cache is enabled; if ``False``, it is + disabled. + """ + cpp_context.enable_jit_cache(enable) + + +cpdef clear_jit_cache(): + """Clear the JIT program cache, removing all cached programs from memory + and disk. + """ + cpp_context.clear_jit_cache() diff --git a/python/pylibcudf/pylibcudf/libcudf/context.pxd b/python/pylibcudf/pylibcudf/libcudf/context.pxd new file mode 100644 index 000000000000..b4a42d3c1ddf --- /dev/null +++ b/python/pylibcudf/pylibcudf/libcudf/context.pxd @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. +# SPDX-License-Identifier: Apache-2.0 + +from libcpp cimport bool +from pylibcudf.exception_handler cimport libcudf_exception_handler + + +cdef extern from "cudf/context.hpp" namespace "cudf" nogil: + void enable_jit_cache(bool enable) noexcept + void clear_jit_cache() except +libcudf_exception_handler