Examples#
Since a code snippet is more than a thousand words, we believe that the best
way to learn setuptools-cuda is to look at the examples. If you are
feeling adventurous, you can go and view them directly on our GitHub.
However, we recommend reading at least the description of example 01 below,
as it will introduce you to all the concepts needed for writing your own
extensions.
Prerequisites#
Both examples require you to have the following:
Working Python >= 3.9 installation
Ability to install Python packages. We strongly recommend you create a fresh virtual environment for the purpose of experimenting with
setuptools-cuda.Working installation of CUDA toolkit.
(optionally but recommended) Working installation of NVidia driver and CUDA runtime (otherwise you will be able to build but not run the examples).
The setuptools-cuda uses a CUDAHOME environmental variable, which you
should set to the path of your CUDA installation. If you don’t do this,
setuptools-cuda will try to auto-detect it, but it will probably fail and
you will have a bad time trying to figure out why things aren’t working.
Currently available examples#
Example 01: CUDA Saxpy#
This example shows how the basic saxpy implementation works with
setuptools-cuda.
Example 02: Integration with Thrust library#
The second example demonstrates how setuptools-cuda can be integrated with
thrust.