CUDA is a parallel computing platform and API that allows for GPU programming. To get started in CUDA, we will take a look at creating a Hello World program.
CUDA Hello World
Steps | Example |
1. Create a file with the .cu extension using vi. |
$ vi hello_world.cu |
2. Insert hello world code into the file. |
#include <stdio.h> |
3. Compile the program via the nvcc command |
$ nvcc hello_world.cu -o hello_world |
4. Run the compiled CUDA file created in the last step. If done correctly, "Hello, CUDA!" should be output to the terminal screen. |
$ ./hello_world |