Fireship · @fireship

Nvidia CUDA in 100 Seconds

Uploaded March 7, 2024 · Length 3:13

Nvidia CUDA in 100 Seconds

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.

  1. 0:00

    Cuda a parallel Computing platform that

  2. 0:02

    allows you to use your GPU for more than

  3. 0:05

    just playing video games compute unified

  4. 0:07

    device architecture was developed by

  5. 0:09

    Nvidia in 2007 based on the prior work

  6. 0:11

    of Ian buck and John Nichols since then

  7. 0:14

    Cuda has revolutionized the World by

  8. 0:16

    allowing humans to compute large blocks

  9. 0:17

    of data in parallel which is unlock the

  10. 0:19

    true potential of the deep neural

  11. 0:21

    networks behind artificial intelligence

  12. 0:23

    the graphics Processing Unit or GPU is

  13. 0:25

    historically used for what the name

  14. 0:27

    implies to compute Graphics when you

  15. 0:29

    play a game in 1080p at 60 FPS you've

  16. 0:31

    got over 2 million pixels on the screen

  17. 0:33

    that may need to be recalculated after

  18. 0:35

    every frame which requires Hardware that

  19. 0:37

    can do a lot of matrix multiplication

  20. 0:39

    and Vector transformations in parallel

  21. 0:41

    and I mean a lot modern gpus are

  22. 0:43

    measured in teraflops or how many

  23. 0:45

    trillions of floating Point operations

  24. 0:46

    can it handle per second unlike modern

  25. 0:48

    CPUs like the Intel I9 which has 24

  26. 0:51

    cores a modern GPU like the RTX 490 has

  27. 0:54

    over 16,000 cores a CPU is designed to

  28. 0:57

    be versatile while a GPU is designed to

  29. 1:00

    go really fast in parallel Cuda allows

  30. 1:02

    developers to tap into the gpu's power

  31. 1:04

    and data scientists all around the world

  32. 1:06

    are using at this very moment trying to

  33. 1:07

    train the most powerful machine learning

  34. 1:09

    models it works like this you write a

  35. 1:11

    function called a Cuda kernel that runs

  36. 1:13

    on the GPU you then copy some data from

  37. 1:15

    your main Ram over to the gpu's memory

  38. 1:18

    then the CPU will tell the GPU to

  39. 1:20

    execute that function or kernel in

  40. 1:22

    parallel the code is executed in a block

  41. 1:24

    which itself organizes threads into a

  42. 1:26

    multi-dimensional grid then the final

  43. 1:27

    result from the GPU is copied back to

  44. 1:30

    the main memory a piece of cake let's go

  45. 1:31

    ahead and build a Cuda application right

  46. 1:33

    now first you'll need an Nvidia GPU then

  47. 1:36

    install the Cuda toolkit Cuda includes

  48. 1:38

    device drivers a runtime compilers and

  49. 1:40

    Dev tools but the actual code is most

  50. 1:42

    often written in C++ as I'm doing here

  51. 1:44

    in Visual Studio first we use the global

  52. 1:47

    specifier to define a function or Cuda

  53. 1:49

    kernel that runs on the actual GPU this

  54. 1:51

    function adds two vectors or arrays

  55. 1:54

    together it takes pointer arguments A

  56. 1:55

    and B which are the two vectors to be

  57. 1:57

    added together and pointer C for the

  58. 1:59

    result C equals a plus b but because