Skip to content

[DOCS] Improve the introduction and installation section of the documentation#293

Merged
kkraus14 merged 7 commits intoNVIDIA:mainfrom
gmarkall:intro-docs-2
Jun 13, 2025
Merged

[DOCS] Improve the introduction and installation section of the documentation#293
kkraus14 merged 7 commits intoNVIDIA:mainfrom
gmarkall:intro-docs-2

Conversation

@gmarkall
Copy link
Contributor

The scope of these changes is to make it so that:

  • A user landing on the index page of the documentation gets a coherent, quick summary of Numba, and links to different parts of the document.
  • Proceeding through the docs to the first page, they get installation instructions that are both relevant and correct
  • Following that, the documentation continues with the "usual" introduction to writing CUDA kernels.

The Installation section here is mostly what was called "Overview" before - anything from that section that wasn't to do with installation was pushed into the next page that explains how to write kernels - I have not put much effort into improving that page here.

The Installation section should give users a good reference on how to install numba-cuda and have the required bindings installed and usable, or they should be able to disable the NVIDIA bindings if they don't want to use them.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Jun 12, 2025

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@gmarkall
Copy link
Contributor Author

/ok to test

@gmarkall gmarkall added the 3 - Ready for Review Ready for review by team label Jun 12, 2025
@gmarkall gmarkall requested a review from leofang June 12, 2025 13:11

For CUDA 12, ``cuda-nvcc`` and ``cuda-nvrtc`` are required::

$ conda install -c conda-forge numba-cuda cuda-nvcc cuda-nvrtc "cuda-version>=12.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider just adding these to the conda recipe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add, once we depend on cuda-bindings in the conda recipe, cuda-nvrtc is already a dependency. What is cuda-nvcc needed for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm stretching my memory a bit here, but I think it might have been the only way to get libdevice installed (I'm not sure if that's still current).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's only for libdevice then that comes from the cuda-nvvm-tools conda package these days that we should depend on instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cuda-nvcc was probably used to provide libnvvm. I need to look it up and check which 12.x did we split it from nvcc-impl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just remembered - if you want to run the full test suite, you need to have nvcc installed to build the test binaries. I don't know whether this means it makes sense to have it installed for end-users though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider just adding these to the conda recipe?

If I run

$ mamba create -n test-install-numba-cuda-015 python=3.12 nvidia::numba-cuda

(using the NVIDIA channel only because 0.15.0 is not yet on conda-forge right now)

then it will install (amongst others)

  Package                     Version  Build                 Channel           Size
─────────────────────────────────────────────────────────────────────────────────────
  Install:
─────────────────────────────────────────────────────────────────────────────────────

 
  + cuda-version                 12.9  h4f385c5_3            conda-forge       22kB
  + cuda-nvvm-dev_linux-64    12.9.86  ha770c72_1            conda-forge       27kB
  + cuda-nvvm-tools           12.9.86  he02047a_1            conda-forge       24MB
  + cuda-nvvm-impl            12.9.86  he02047a_1            conda-forge       21MB
  + libnvjitlink              12.9.86  h5888daf_0            conda-forge       31MB
  + cuda-nvrtc                12.9.86  h5888daf_0            conda-forge       67MB
  + cuda-nvvm                 12.9.86  h69a702a_1            conda-forge       25kB
  + cuda-bindings              12.9.0  py312h77ce6f0_0       conda-forge     Cached
  + numba                      0.61.2  py312h7bcfee6_1       conda-forge     Cached
  + numba-cuda                 0.15.0  py_0                  nvidia          Cached

so it looks like mamba install numba-cuda is going to be sufficient to pull in all required dependencies for running Numba-CUDA - I'll simplify the docs here.

Setting CUDA Installation Path
------------------------------

Numba searches for a CUDA toolkit installation in the following order:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this order is for the ctypes based bindings and doesn't reflect the cuda-bindings based search order. For cuda-bindings it will follow the behavior described here: https://github.com/NVIDIA/cuda-python/tree/main/cuda_bindings/cuda/bindings/_path_finder#library-loading-search-priority

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I didn't realise this until our sync meeting today, after I made this PR. Will update.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to add a note explaining the search order might change in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make it clear that the behaviour using the NVIDIA bindings follows path-finder's logic, and that the ctypes behaviour is for the deprecated path.


if you are using Conda, or::

$ pip install cuda-bindings[cu11]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is cu11 an extra for cuda-bindings? Same with cu12 below

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it is not. We should be doing cuda-bindings[all]==11 / cuda-bindings[all]==12. That being said, I think we should just advertise the numba-cuda[cuXX] path instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be happy to change this but I'm not clear what the exact correct thing to write should be. Can you make a suggestion please?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can just keep the text but remove all conda/pip install commands from this section. In the previous section, we already taught users how to install things, and cuda-bindings will be installed there. So, here we just need to teach users how to fall back to ctypes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Leo - I've now removed these, and it does read better.

@leofang
Copy link
Member

leofang commented Jun 13, 2025

@gmarkall the root README also has installation instructions that need to be updated 😅

@gmarkall
Copy link
Contributor Author

@gmarkall the root README also has installation instructions that need to be updated 😅

Thanks for the reminder - I want to handle that in a separate PR when I can get round to it. My thinking here was that a little improvement is better than no improvement because I didn't have time to do both.

@gmarkall gmarkall added 4 - Waiting on author Waiting for author to respond to review and removed 3 - Ready for Review Ready for review by team labels Jun 13, 2025
@gmarkall gmarkall added 4 - Waiting on reviewer Waiting for reviewer to respond to author and removed 4 - Waiting on author Waiting for author to respond to review labels Jun 13, 2025
@gmarkall
Copy link
Contributor Author

Thanks all - I believe I've now addressed all comments (and it does read better as a result!).

@gmarkall
Copy link
Contributor Author

/ok to test

@kkraus14 kkraus14 merged commit 56c3bae into NVIDIA:main Jun 13, 2025
gmarkall added a commit to gmarkall/numba-cuda that referenced this pull request Jun 14, 2025
- NFC: Don't rely on `Dispatcher._compiler` API (NVIDIA#289)
- [DOCS] Improve the introduction and installation section of the documentation (NVIDIA#293)
- Fix `DeviceNDArray.device_ctypes_pointer` to always be ctypes (NVIDIA#295)
- Raise better error when `cuda.bindings` are not available (NVIDIA#294)
@gmarkall gmarkall mentioned this pull request Jun 14, 2025
gmarkall added a commit that referenced this pull request Jun 14, 2025
- NFC: Don't rely on `Dispatcher._compiler` API (#289)
- [DOCS] Improve the introduction and installation section of the documentation (#293)
- Fix `DeviceNDArray.device_ctypes_pointer` to always be ctypes (#295)
- Raise better error when `cuda.bindings` are not available (#294)
@leofang
Copy link
Member

leofang commented Jun 16, 2025

@gmarkall the root README also has installation instructions that need to be updated 😅

Thanks for the reminder - I want to handle that in a separate PR when I can get round to it. My thinking here was that a little improvement is better than no improvement because I didn't have time to do both.

Let me take care of this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 - Waiting on reviewer Waiting for reviewer to respond to author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants