NVIDIA / NVIDIA/cudf

`set_up_kvikio()` silently overrides kvikio thread pool configuration set by callers

Open
#23,786 0 comments 0 reactions 1 assignee Claimed by @Matt711 View on GitHub
bug libcudf
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

`set_up_kvikio()` in libcudf is called lazily on the first IO operation via `std::call_once`. It does two things:

1. One-time initialization: warms the CUDA context (`cudaFree(nullptr)`) and sets compat mode from `KVIKIO_COMPAT_MODE`.
2. Sets the kvikio thread pool size from `KVIKIO_NTHREADS`, defaulting to 4 if unset.

Any caller that sets the thread pool size via the kvikio API before the first IO (say, `kvikio.defaults.set(num_threads=256)`) will have that setting silently overridden when \`set_up_kvikio()\` fires. Note that setting `KVIKIO_NTHREADS` in the environment does work, since `set_up_kvikio()` reads it. But callers should not have to rely on env vars to make their configuration stick.

This is the root cause of the hack in #23683, where cudf-polars has to call `set_up_kvikio()` eagerly (and pass its own thread count) to prevent libcudf from undoing its configuration later.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.