CUDA programming in Julia
The CUDA.jl package is the main programming interface for working with NVIDIA CUDA GPUs using Julia. It features a user-friendly array abstraction, a compiler for writing CUDA kernels in Julia, and wrappers for various CUDA libraries.
The latest development version of CUDA.jl requires Julia 1.8 or higher. If you are using an older version of Julia, you need to use a previous version of CUDA.jl. This will happen automatically when you install the package using Julia's package manager.
CUDA.jl currently also requires a CUDA-capable GPU with compute capability 3.5 (Kepler) or higher, and an accompanying NVIDIA driver with support for CUDA 11.0 or newer. These requirements are not enforced by the Julia package manager when installing CUDA.jl. Depending on your system and GPU, you may need to install an older version of the package:
- CUDA.jl v4.4 is the last version with support for CUDA 11.0-11.3 (deprecated in v5.0)
- CUDA.jl v4.0 is the last version to work with CUDA 10.2 (removed in v4.1)
- CUDA.jl v3.13 is the last version to work with CUDA 10.1 (removed in v4.0)
- CUDA.jl v1.3 is the last version to work with CUDA 9-10.0 (removed in v2.0)
Finally, you should be using a platform supported by NVIDIA. Currently, that means using 64-bit Linux or Windows, with an X86, ARM, or PowerPC host processor.
Before all, make sure you have a recent NVIDIA driver. On Windows, also make sure you have the Visual C++ redistributable installed. You do not need to install the CUDA Toolkit.
CUDA.jl can be installed with the Julia package manager. From the Julia REPL, type
enter the Pkg REPL mode and run:
pkg> add CUDA
Or, equivalently, via the
julia> import Pkg; Pkg.add("CUDA")
For an overview of the CUDA toolchain in use, you can run the following command after importing the package:
julia> using CUDA
This may take a while, as it will precompile the package and download a suitable version of the CUDA toolkit. If your GPU is not fully supported, the above command (or any other command that initializes the toolkit) will issue a warning.
For more usage instructions and other information, please refer to the documentation.
Much of the software in this ecosystem was developed as part of academic research. If you would like to help support it, please star the repository as such metrics may help us secure funding in the future. If you use our software as part of your research, teaching, or other activities, we would be grateful if you could cite our work. The CITATION.bib file in the root of this repository lists the relevant papers.
The package is tested against, and being developed for, Julia 1.6 and above. Main development and testing happens on x86 Linux, but the package is expected to work on Windows, and on ARM and PowerPC as well.
Contributions are very welcome, as are feature requests and suggestions. Please open an issue if you encounter any problems.