Fireship · @fireship
Nvidia CUDA in 100 Seconds
Uploaded March 7, 2024 · Length 3:13
Summary
Nvidia CUDA explained in 100 seconds: a parallel computing platform for GPUs, used for machine learning and deep neural networks.
- cuda
- gpu
- parallel computing
- machine learning
- deep learning
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
Cuda a parallel Computing platform that
- 0:02
allows you to use your GPU for more than
- 0:05
just playing video games compute unified
- 0:07
device architecture was developed by
- 0:09
Nvidia in 2007 based on the prior work
- 0:11
of Ian buck and John Nichols since then
- 0:14
Cuda has revolutionized the World by
- 0:16
allowing humans to compute large blocks
- 0:17
of data in parallel which is unlock the
- 0:19
true potential of the deep neural
- 0:21
networks behind artificial intelligence
- 0:23
the graphics Processing Unit or GPU is
- 0:25
historically used for what the name
- 0:27
implies to compute Graphics when you
- 0:29
play a game in 1080p at 60 FPS you've
- 0:31
got over 2 million pixels on the screen
- 0:33
that may need to be recalculated after
- 0:35
every frame which requires Hardware that
- 0:37
can do a lot of matrix multiplication
- 0:39
and Vector transformations in parallel
- 0:41
and I mean a lot modern gpus are
- 0:43
measured in teraflops or how many
- 0:45
trillions of floating Point operations
- 0:46
can it handle per second unlike modern
- 0:48
CPUs like the Intel I9 which has 24
- 0:51
cores a modern GPU like the RTX 490 has
- 0:54
over 16,000 cores a CPU is designed to
- 0:57
be versatile while a GPU is designed to
- 1:00
go really fast in parallel Cuda allows
- 1:02
developers to tap into the gpu's power
- 1:04
and data scientists all around the world
- 1:06
are using at this very moment trying to
- 1:07
train the most powerful machine learning
- 1:09
models it works like this you write a
- 1:11
function called a Cuda kernel that runs
- 1:13
on the GPU you then copy some data from
- 1:15
your main Ram over to the gpu's memory
- 1:18
then the CPU will tell the GPU to
- 1:20
execute that function or kernel in
- 1:22
parallel the code is executed in a block
- 1:24
which itself organizes threads into a
- 1:26
multi-dimensional grid then the final
- 1:27
result from the GPU is copied back to
- 1:30
the main memory a piece of cake let's go
- 1:31
ahead and build a Cuda application right
- 1:33
now first you'll need an Nvidia GPU then
- 1:36
install the Cuda toolkit Cuda includes
- 1:38
device drivers a runtime compilers and
- 1:40
Dev tools but the actual code is most
- 1:42
often written in C++ as I'm doing here
- 1:44
in Visual Studio first we use the global
- 1:47
specifier to define a function or Cuda
- 1:49
kernel that runs on the actual GPU this
- 1:51
function adds two vectors or arrays
- 1:54
together it takes pointer arguments A
- 1:55
and B which are the two vectors to be
- 1:57
added together and pointer C for the
- 1:59
result C equals a plus b but because


