About this tutorial
This tutorial will guide you about installation steps for CUDA parallel programming architecture.
About this tutorial
This tutorial will guide you about installation steps for CUDA parallel programming
architecture.
Introduction
CUDA (Compute Unified Device Architecture) is technology developed by NVIDIA Inc.
The purpose of CUDA is to execute the programs and instructions in parallel manner on
the processor.Prerequisites
Installation
After completing download and installation of Ubuntu, follow the next steps.
1. Log in as root user
2. Update Ubuntu for latest packages
# apt-get update
3. To install compiler, essential for CUDA toolkit, run following command:
# apt-get install build-essential
Some desktop version of Linux might cause problems such as slow response,
unresponsive GUI. In order to avoid such problems, we need to switch to text mode.
4. To switch to text mode, use keyboard shortcut: Alt+Ctrl+F1
5. Login as root.
6. Stop GUI service, use following command:
# service lightdm stop
7. Go to folder location of CUDA toolkit file
# cd /home/user_name/Downloads/
8. Download CUDA toolkit
# wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda_11.4.0_470.42.01_linux.run 9. Change the permission of file and run following command
# sudo sh cuda_11.4.0_470.42.01_linux.run
If file is not executable, try to run it with following command:
# ./cuda_11.4.0_470.42.01_linux.run
10. If prompt of absolute path of CUDA toolkit appear on screen, press Y
11. For /home/<user_name> option, where <user_name> will be your current name, press 'Enter'.
You'll see installation skipped then reboot with
# reboot -h
After restart, Linux will automatically switch to GUI mode.
Repeat the steps from 4 to 9 to switch back from GUI to text mode. Now reboot system manually.
After system will start, enter two commands as general user:
# export PATH=/usr/local/cuda-11.4/bin:$PATH
# export LD_LIBRARY=/usr/local/cuda-11.4/lib64:$LD_LIBRARY_PATH
Now we are ready to run our hello world program for Nvidia CUDA.
Copy and paste Hello World example in gedit.
.cu is the extension of our program.
Save to current directory.
To compile:
# nvcc -cuda hello.cu
To run:
# ./a.out
If you can see Hello World as output, you've successfully installed CUDA toolkit on Ubuntu.