cuda-python icon indicating copy to clipboard operation
cuda-python copied to clipboard

Make NumPy an optional dependency perhaps?

Open carterbox opened this issue 10 months ago • 3 comments

Would it be possible to make numpy an optional dependency for cuda.core? For example, if you just want to use cuda.core to query system device properties, installing a BLAS implementation is a bit heavy.

carterbox avatar Mar 12 '25 21:03 carterbox

+1 it looks like our numpy usage outside of tests, benchmarks, and examples is only related to dtypes where we should be able to make it handle numpy dtypes optionally

kkraus14 avatar Mar 13 '25 02:03 kkraus14

Very unlikely. We use NumPy heavily in cuda-core (and nvmath-python and the upstream Numba): https://github.com/search?q=repo%3ANVIDIA%2Fcuda-python+numpy+path%3Acuda_core%2Fcuda&type=code Without assuming NumPy exists it is really challenging to write interoperable code. We'd end up reinventing a whole set of infra as done in mpi4py. In a modern workload NumPy always exists somewhere, so I don't get where this is coming from?

leofang avatar Mar 13 '25 02:03 leofang

FWIW we don't even set a version constraint on NumPy as suggested by NEP 29/Spec 0, only that it exists in the user env: https://github.com/NVIDIA/cuda-python/blob/f903d98bb57f628533de392b745dc94b3e27dc3c/cuda_core/pyproject.toml#L45-L47, so this is pretty relaxing.

leofang avatar Mar 13 '25 02:03 leofang

Unless there is a compelling reason let's close this for now.

leofang avatar Nov 03 '25 21:11 leofang