• Stars
    star
    231
  • Rank 173,434 (Top 4 %)
  • Language
    Jupyter Notebook
  • Created over 3 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nvidia contributed CUDA tutorial for Numba

Numba for CUDA Programmers

Author: Graham Markall, NVIDIA [email protected].

What is this course?

This is an adapted version of one delivered internally at NVIDIA - its primary audience is those who are familiar with CUDA C/C++ programming, but perhaps less so with Python and its ecosystem. That said, it should be useful to those familiar with the Python and PyData ecosystem.

It focuses on using CUDA concepts in Python, rather than going over basic CUDA concepts - those unfamiliar with CUDA may want to build a base understanding by working through Mark Harris's An Even Easier Introduction to CUDA blog post, and briefly reading through the CUDA Programming Guide Chapters 1 and 2 (Introduction and Programming Model). Other concepts discussed in the course (such as shared memory) are discussed in later chapters. For expediency, it is recommended to look up concepts in those sections when necessary, rather than reading all the reference material in detail.

What is in this course?

The course is broken into 5 sessions, designed for a session to be presented then the examples and exercises worked through before participants move to the next session. This could be presented at a cadence of one session per week with an hour of presentation time to fit the course around other tasks. Alternatively it could be delivered as a tutorial session over the course of 2-3 days.

Session 1: An introduction to Numba and CUDA Python

Session 1 files are in the session-1 folder. Contents:

  • Presentation: The presentation for this session, along with notes.
  • Mandelbrot example: See the README for exercises.
  • CUDA Kernels notebook: In the exercises folder. Open the notebook using Jupyter.
  • UFuncs notebooks In the exercises folder. Open the notebooks using Jupyter. Contains two notebooks on vectorize and guvectorize on the CPU (as it's a little easier to experiment with them on the CPU target) and one notebook on CUDA ufuncs and memory management.

Session 2: Typing

Session 2 files are in the session-2 folder. Contents:

  • Presentation: The presentation for this session, along with notes.
  • Exercises: In the exercises folder. Open the notebook using Jupyter.

Session 3: Porting strategies, performance, interoperability, debugging

Session 3 files are in the session-3 folder. Contents:

  • Presentation: The presentation for this session, along with notes.
  • Exercises: In the exercises folder. Open the notebook using Jupyter.
  • Examples: In the examples folder. These are mostly executable versions of the examples given in the slides.

Session 4: Extending Numba

Session 4 files are in the session-4 folder. Contents:

  • Presentation: The presentation for this session, along with notes.
  • Exercises: In the exercises folder. Open the notebook using Jupyter. A solution to the exercise is also provided.
  • Examples: In the examples folder. This contains a notebook working through the Interval example presented in the slides.

Session 5: Memory Management

Session 5 files are in the session-5 folder. Contents:

  • Presentation: The presentation for this session, along with notes.
  • Exercises: In the exercises folder. Open the notebook using Jupyter.
  • Examples: In the examples folder. This contains examples of a simple EMM Plugin wrapping cudaMalloc, and an EMM Plugin for using the CuPy pool allocator with Numba.

Sources

Some of the material in this course is derived from various sources. These sources, are:

References

The following references can be useful for studying CUDA programming in general, and the intermediate languages used in the implementation of Numba:

More Repositories

1

numba

NumPy aware dynamic Python compiler using LLVM
Python
9,480
star
2

llvmlite

A lightweight LLVM python binding for writing JIT compilers
Python
1,840
star
3

numba-scipy

numba_scipy extends Numba to make it aware of SciPy
Python
248
star
4

numba-examples

Example Numba implementations of functions
Jupyter Notebook
161
star
5

pyculib

Pyculib - Python bindings for CUDA libraries
Python
96
star
6

numba-mlir

POC work on MLIR backend
C++
38
star
7

data_profiler

An augmented version of cProfile and Snakeviz
Python
27
star
8

numba-rvsdg

Numba compatible RVSDG (Regionalized Value State Dependence Graph) utilities.
Python
14
star
9

pyculib_sorting

Sorting libraries for pyculib
Cuda
14
star
10

euroscipy2019-numba

EuroSciPy 2019 Numba Tutorial
Jupyter Notebook
12
star
11

texasbbq

Smoke out the bugs that break dependent projects.
Python
10
star
12

numba-benchmark

Python
9
star
13

roctools

Tools for using AMD ROCm with Numba
C++
9
star
14

pixie

8
star
15

roc-examples

Examples for ROC GPUs
Jupyter Notebook
7
star
16

numba-extras

[Archived due to lack of maintainer] A repo for extra and experimental features for Numba
Python
7
star
17

conda-recipe-cudatoolkit

conda recipe for cudatoolkit
Python
6
star
18

numba-integration-testing

Testing Numba 'master' against the latest released versions of dependent libraries.
Python
6
star
19

stacktrace

DO NOT USE. Low-level stacktrace utils.
Python
5
star
20

pyegraphsgood

Rust
5
star
21

llvm-py

The llvm-py project is moved to github.com/llvmpy/llvmpy or www.llvmpy.org
4
star
22

ctflgrdiff

Rust
4
star
23

numba-hatchery

Full-stack build for llvmdev --> llvmlite --> Numba.
Shell
4
star
24

llvm-mirror

LLVM mirror and patches for building llvmlite
C++
3
star
25

rocm_testing_dockers

Dockers for testing numba HSA support and pyroclib on ROCm platforms
Makefile
2
star
26

numba-doc

Documentation pages served from here.
2
star
27

numba-rocm

Numba support for ROCm
2
star
28

llvmlite-doc

llvmlite documentation pages
HTML
1
star
29

dispyatcher

Python
1
star
30

libHLC

A standalone shared library of HLC-LLVM from HSAFoundation for generating HSAIL and BRIG from LLVM
C++
1
star
31

numba-governance

Documentation of the governance of the Numba project and associated subprojects (llvmlite, etc)
1
star
32

numba.github.com

Website served from here
HTML
1
star