Skip to content

Commit 605a562

Browse files
authored
Update README.md
1 parent 7f1e951 commit 605a562

File tree

1 file changed

+167
-14
lines changed

1 file changed

+167
-14
lines changed

02 Setup/README.md

Lines changed: 167 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,181 @@
1-
# Setup Instructions
1+
# **CUDA Installation Guide**
22

3-
1. first do a `sudo apt update && sudo apt upgrade -y && sudo apt autoremove` then pop over to [downloads](https://developer.nvidia.com/cuda-downloads)
4-
2. fill in the following settings that match the device you'll be doing this course on: Operating System
5-
- Architecture
6-
- Distribution
7-
- Version
8-
- Installer Type
9-
3. you'll have to run a command very similar to the one below in the "runfile section"
3+
This guide will walk you through the process of installing **CUDA** on your machine, ensuring you can take full advantage of the GPU for deep learning and computational tasks. The instructions are optimized for both novice and advanced users.
4+
5+
---
6+
7+
## **Prerequisites**
8+
9+
Before proceeding with the installation, ensure the following:
10+
11+
1. **NVIDIA GPU** installed on your system (you can verify this using the `nvidia-smi` command).
12+
2. **NVIDIA drivers** should be installed and configured correctly for your GPU.
13+
3. An updated system with **sudo** privileges for installation steps.
14+
15+
---
16+
17+
## **Step-by-Step Installation**
18+
19+
### **1. System Update**
20+
21+
Open a terminal and update your system packages to ensure you're starting with the latest software:
22+
23+
```bash
24+
sudo apt update && sudo apt upgrade -y && sudo apt autoremove
25+
```
26+
27+
This ensures your system is up to date and cleans up any unnecessary packages.
28+
29+
---
30+
31+
### **2. Download CUDA Toolkit**
32+
33+
Go to the official [CUDA Downloads Page](https://developer.nvidia.com/cuda-downloads) and fill in the following details:
34+
35+
- **Operating System**: Select your OS (Ubuntu, CentOS, etc.).
36+
- **Architecture**: Choose `x86_64` for most modern systems.
37+
- **Distribution**: Choose the correct Linux distribution.
38+
- **Version**: Select the version you want to install (e.g., 12.6.0).
39+
- **Installer Type**: Choose **`runfile`** as the installer type.
40+
41+
Click on the **Download** button to get the installer.
42+
43+
Alternatively, you can directly download the installation file using `wget`:
1044

1145
```bash
1246
wget https://developer.download.nvidia.com/compute/cuda/12.6.0/local_installers/cuda_12.6.0_560.28.03_linux.run
47+
```
48+
49+
This command downloads the CUDA installer package for version 12.6.0.
50+
51+
---
52+
53+
### **3. Install CUDA**
54+
55+
After downloading, navigate to the directory where the `.run` file is saved. Execute the installation command:
56+
57+
```bash
1358
sudo sh cuda_12.6.0_560.28.03_linux.run
1459
```
1560

16-
4. in the end, you should be able to run `nvcc --version` and get info about the nvidia cuda compiler (version and such).
17-
also run `nvidia-smi` to ensure nvidia recognizes your cuda version and connected GPU
61+
During installation, you’ll be prompted with some options. You can proceed with the default options, but be mindful of:
62+
63+
- **Driver installation**: You may choose to install or skip installing NVIDIA drivers if they are already installed on your system.
64+
- **Toolkit installation**: Ensure that the CUDA Toolkit is installed.
65+
66+
After the installation is complete, you can verify it by checking the **CUDA version** using the `nvcc` command.
67+
68+
---
69+
70+
### **4. Verify Installation**
71+
72+
To check the installed version of CUDA, run:
73+
74+
```bash
75+
nvcc --version
76+
```
77+
78+
You should see something similar to:
79+
80+
```bash
81+
nvcc: NVIDIA (R) Cuda compiler driver
82+
Copyright (c) 2005-2024 NVIDIA Corporation
83+
Built on Thu_Sep_15_22:25:13_PDT_2024
84+
Cuda compilation tools, release 12.6, V12.6.0
85+
```
86+
87+
Additionally, run `nvidia-smi` to confirm that your GPU is recognized by CUDA:
88+
89+
```bash
90+
nvidia-smi
91+
```
92+
93+
You should see information about your GPU and CUDA version.
94+
95+
---
96+
97+
### **5. Update Environment Variables (if needed)**
98+
99+
If `nvcc` doesn’t work right away, the issue might be with your environment variables. First, check which shell you’re using:
100+
101+
```bash
102+
echo $SHELL
103+
```
104+
105+
- If it returns `/bin/bash`, modify the **`~/.bashrc`** file.
106+
- If it returns `/bin/zsh`, modify the **`~/.zshrc`** file.
107+
108+
Add the following lines to the appropriate configuration file:
18109

19-
5. If `nvcc` doesn't work, run `echo $SHELL`. If it says bin/bash, add the following lines to the ~/.bashrc rile. If it says bin/zsh, add to the ~/.zshrc file.
20110
```bash
21111
export PATH=/usr/local/cuda-12.6/bin${PATH:+:${PATH}}
22112
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64
23113
```
24-
do `source ~/.zshrc` or `source ~/.bashrc` after this then try `nvcc -V` again
25114

26-
## Alternatively
115+
Then, apply the changes:
116+
117+
- For **Bash** users:
118+
119+
```bash
120+
source ~/.bashrc
121+
```
122+
123+
- For **Zsh** users:
124+
125+
```bash
126+
source ~/.zshrc
127+
```
128+
129+
Now, try running `nvcc -V` again.
130+
131+
---
132+
133+
### **6. Alternative Method: Run Shell Script**
134+
135+
If you prefer an automated method, you can run the shell script that handles the installation. Simply execute:
136+
137+
```bash
138+
./cuda-installer.sh
139+
```
140+
141+
This will automatically handle the installation steps for you.
142+
143+
---
144+
145+
## **Troubleshooting**
146+
147+
- **Issue**: `nvcc --version` command not found.
148+
149+
**Solution**: Ensure the environment variables are correctly set in your `~/.bashrc` or `~/.zshrc` and that you’ve sourced the file after modifications.
150+
151+
- **Issue**: CUDA Toolkit installation fails during the process.
152+
153+
**Solution**: Ensure that you are not conflicting with an already installed version of CUDA. It might be necessary to uninstall previous CUDA versions using `sudo apt-get remove cuda` before reinstalling.
154+
155+
---
156+
157+
## **Graphical User Interface (GUI) Installers**
158+
159+
If you prefer to use a graphical interface for installation, you can download the **CUDA installer** with a GUI from the [CUDA downloads page](https://developer.nvidia.com/cuda-downloads).
160+
161+
---
162+
163+
## **Conclusion**
164+
165+
You have successfully installed **CUDA** on your system, enabling you to harness the power of GPU acceleration for deep learning tasks. You can now use this setup to run neural network models, optimize performance, and speed up computations.
166+
167+
For further instructions and resources, refer to the official [NVIDIA CUDA documentation](https://docs.nvidia.com/cuda/).
168+
169+
---
170+
171+
## **Visual Enhancements (optional)**
172+
173+
For a more graphical approach, include **screenshots** or **diagrams** of the steps, especially for the following sections:
174+
175+
- **Environment setup** (e.g., where to modify `~/.bashrc` or `~/.zshrc`).
176+
- **Running `nvcc --version`** and **`nvidia-smi`** commands with expected outputs.
177+
- **CUDA installation options** screen, showing the prompts during installation.
178+
179+
---
27180

28-
- run the shell script in this directory: `./cuda-installer.sh`
181+
Happy coding! 🎉

0 commit comments

Comments
 (0)