soutrik commited on
Commit
a31745a
·
1 Parent(s): a46d6f7

added cuda details

Browse files
Files changed (1) hide show
  1. ec2_runner_setup.md +268 -0
ec2_runner_setup.md CHANGED
@@ -68,3 +68,271 @@ aws s3 cp data s3://deep-bucket-s3/data --recursive
68
  aws s3 ls s3://deep-bucket-s3
69
  aws s3 rm s3://deep-bucket-s3/data --recursive
70
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  aws s3 ls s3://deep-bucket-s3
69
  aws s3 rm s3://deep-bucket-s3/data --recursive
70
  ```
71
+
72
+ __Cuda Update Setup__:
73
+ ```bash
74
+ # if you already have nvidia drivers installed and you have a Tesla T4 GPU
75
+ sudo apt update
76
+ sudo apt upgrade
77
+ sudo reboot
78
+
79
+ sudo apt --fix-broken install
80
+ sudo apt install ubuntu-drivers-common
81
+ sudo apt autoremove
82
+
83
+ nvidia-smi
84
+ lsmod | grep nvidia
85
+
86
+ sudo apt install nvidia-cuda-toolkit
87
+ nvcc --version
88
+
89
+ ls /usr/local/ | grep cuda
90
+ ldconfig -p | grep cudnn
91
+ lspci | grep -i nvidia
92
+
93
+ Based on the provided details, here is the breakdown of the information about your GPU, CUDA, and environment setup:
94
+
95
+ ---
96
+
97
+ ### **1. GPU Details**
98
+ - **Model**: Tesla T4
99
+ - A popular NVIDIA GPU for deep learning and AI workloads.
100
+ - It belongs to the Turing architecture (TU104GL).
101
+
102
+ - **Memory**: 16 GB
103
+ - Only **2 MiB is currently in use**, indicating minimal GPU activity.
104
+
105
+ - **Temperature**: 25°C
106
+ - The GPU is operating at a low temperature, suggesting no heavy utilization currently.
107
+
108
+ - **Power Usage**: 11W / 70W
109
+ - The GPU is in idle or low-performance mode (P8).
110
+
111
+ - **MIG Mode**: Not enabled.
112
+ - MIG (Multi-Instance GPU) mode is specific to NVIDIA A100 and other GPUs, so it is not applicable here.
113
+
114
+ ---
115
+
116
+ ### **2. Driver and CUDA Version**
117
+ - **Driver Version**: 535.216.03
118
+ - Installed NVIDIA driver supports CUDA 12.x.
119
+
120
+ - **CUDA Runtime Version**: 12.2
121
+ - This is the active runtime version compatible with the driver.
122
+
123
+ ---
124
+
125
+ ### **3. CUDA Toolkit Versions**
126
+ From your `nvcc` and file system checks:
127
+ - **Default `nvcc` Version**: CUDA 10.1
128
+ - The system's default `nvcc` is pointing to an older CUDA 10.1 installation (`nvcc --version` output shows CUDA 10.1).
129
+
130
+ - **Installed CUDA Toolkits**:
131
+ - `cuda-12`
132
+ - `cuda-12.2`
133
+ - `cuda` (likely symlinked to `cuda-12.2`)
134
+
135
+ Multiple CUDA versions are installed. However, the runtime and drivers align with **CUDA 12.2**, while the default compiler (`nvcc`) is still from CUDA 10.1.
136
+
137
+ ---
138
+
139
+ ### **4. cuDNN Version**
140
+ From `cudnn_version.h` and `ldconfig`:
141
+ - **cuDNN Version**: 9.5.1
142
+ - This cuDNN version is compatible with **CUDA 12.x**.
143
+ - **cuDNN Runtime**: The libraries for cuDNN 9 are present under `/lib/x86_64-linux-gnu`.
144
+
145
+ ---
146
+
147
+ ### **5. NVIDIA Software Packages**
148
+ From `dpkg`:
149
+ - **NVIDIA Drivers**: Driver version 535 is installed.
150
+ - **CUDA Toolkit**: Multiple versions installed (`10.1`, `12`, `12.2`).
151
+ - **cuDNN**: Versions for CUDA 12 and CUDA 12.6 are installed (`cudnn9-cuda-12`, `cudnn9-cuda-12-6`).
152
+
153
+ ---
154
+
155
+ ### **6. Other Observations**
156
+ - **Graphics Settings Issue**:
157
+ - `nvidia-settings` failed due to the lack of a display server connection (`Connection refused`). Likely, this is a headless server without a GUI environment.
158
+
159
+ - **OpenGL Tools Missing**:
160
+ - `glxinfo` command is missing, indicating the `mesa-utils` package needs to be installed.
161
+
162
+ ---
163
+
164
+ ### **Summary of Setup**
165
+ - **GPU**: Tesla T4
166
+ - **Driver Version**: 535.216.03
167
+ - **CUDA Runtime Version**: 12.2
168
+ - **CUDA Toolkit Versions**: 10.1 (default `nvcc`), 12, 12.2
169
+ - **cuDNN Version**: 9.5.1 (compatible with CUDA 12.x)
170
+ - **Software Packages**: NVIDIA drivers, CUDA, cuDNN installed
171
+ ```
172
+
173
+ __CUDA New Installation__:
174
+ ```bash
175
+ # if you don't have nvidia drivers installed and you have a Tesla T4 GPU
176
+ lspci | grep -i nvidia # Check if the GPU is detected
177
+ To set up the T4 GPU from scratch, starting with no drivers or CUDA tools, and replicating the above configurations and drivers, follow these reverse-engineered steps:
178
+
179
+ ---
180
+
181
+ ### **1. Update System**
182
+ Ensure the system is updated:
183
+ ```bash
184
+ sudo apt update && sudo apt upgrade -y
185
+ sudo reboot
186
+ ```
187
+
188
+ ---
189
+
190
+ ### **2. Install NVIDIA Driver**
191
+ #### **a. Identify Required Driver**
192
+ The T4 GPU requires a compatible NVIDIA driver version. Based on your configurations, we will install **Driver 535**.
193
+
194
+ #### **b. Add NVIDIA Repository**
195
+ Add the official NVIDIA driver repository:
196
+ ```bash
197
+ sudo apt install -y software-properties-common
198
+ sudo add-apt-repository -y ppa:graphics-drivers/ppa
199
+ sudo apt update
200
+ ```
201
+
202
+ #### **c. Install Driver**
203
+ Install the driver for the T4 GPU:
204
+ ```bash
205
+ sudo apt install -y nvidia-driver-535
206
+ ```
207
+
208
+ #### **d. Verify Driver Installation**
209
+ Reboot the system and check the driver:
210
+ ```bash
211
+ sudo reboot
212
+ nvidia-smi
213
+ ```
214
+ This should display the GPU model and driver version.
215
+
216
+ ---
217
+
218
+ ### **3. Install CUDA Toolkit**
219
+ #### **a. Add CUDA Repository**
220
+ Download and install the CUDA 12.2 repository for Ubuntu 20.04:
221
+ ```bash
222
+ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
223
+ sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
224
+ wget https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda-repo-ubuntu2004-12-2-local_12.2.0-535.86.10-1_amd64.deb
225
+ sudo dpkg -i cuda-repo-ubuntu2004-12-2-local_12.2.0-535.86.10-1_amd64.deb
226
+ sudo cp /var/cuda-repo-ubuntu2004-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/
227
+ sudo apt update
228
+ ```
229
+
230
+ #### **b. Install CUDA Toolkit**
231
+ Install CUDA 12.2:
232
+ ```bash
233
+ sudo apt install -y cuda
234
+ ```
235
+
236
+ #### **c. Set Up Environment Variables**
237
+ Add CUDA binaries to the PATH and library paths:
238
+ ```bash
239
+ echo 'export PATH=/usr/local/cuda-12.2/bin:$PATH' >> ~/.bashrc
240
+ echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.2/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
241
+ source ~/.bashrc
242
+ ```
243
+
244
+ #### **d. Verify CUDA Installation**
245
+ Check CUDA installation:
246
+ ```bash
247
+ nvcc --version
248
+ nvidia-smi
249
+ ```
250
+
251
+ ---
252
+
253
+ ### **4. Install cuDNN**
254
+ #### **a. Download cuDNN**
255
+ Download cuDNN 9.5.1 (compatible with CUDA 12.x) from the [NVIDIA cuDNN page](https://developer.nvidia.com/cudnn). You’ll need to log in and download the appropriate `.deb` files for Ubuntu 20.04.
256
+
257
+ #### **b. Install cuDNN**
258
+ Install the downloaded `.deb` files:
259
+ ```bash
260
+ sudo dpkg -i libcudnn9*.deb
261
+ ```
262
+
263
+ #### **c. Verify cuDNN**
264
+ Check the installed version:
265
+ ```bash
266
+ cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
267
+ ```
268
+
269
+ ---
270
+
271
+ ### **5. Install NCCL and Other Libraries**
272
+ Install additional NVIDIA libraries (like NCCL) required for distributed deep learning:
273
+ ```bash
274
+ sudo apt install -y libnccl2 libnccl-dev
275
+ ```
276
+
277
+ ---
278
+
279
+ ### **6. Install PyTorch**
280
+ #### **a. Install Python Environment**
281
+ Install Python and `pip` if not already present:
282
+ ```bash
283
+ sudo apt install -y python3 python3-pip
284
+ ```
285
+
286
+ #### **b. Install PyTorch with CUDA 12.2**
287
+ Install PyTorch with the appropriate CUDA runtime:
288
+ ```bash
289
+ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu122
290
+ ```
291
+
292
+ #### **c. Test PyTorch**
293
+ Run a quick test:
294
+ ```python
295
+ import torch
296
+ print(torch.cuda.is_available()) # Should return True
297
+ print(torch.cuda.get_device_name(0)) # Should return "Tesla T4"
298
+ ```
299
+
300
+ ---
301
+
302
+ ### **7. Optional: Install Nsight Tools**
303
+ For debugging and profiling:
304
+ ```bash
305
+ sudo apt install -y nsight-compute nsight-systems
306
+ ```
307
+
308
+ ---
309
+
310
+ ### **8. Check for OpenGL**
311
+ If you need OpenGL utilities (like `glxinfo`):
312
+ ```bash
313
+ sudo apt install -y mesa-utils
314
+ glxinfo | grep "OpenGL version"
315
+ ```
316
+
317
+ ---
318
+
319
+ ### **9. Validate Entire Setup**
320
+ Run the NVIDIA sample tests to confirm the configuration:
321
+ ```bash
322
+ cd /usr/local/cuda-12.2/samples/1_Utilities/deviceQuery
323
+ make
324
+ ./deviceQuery
325
+ ```
326
+ If successful, it should show details of the T4 GPU.
327
+
328
+ ---
329
+
330
+ ### **Summary of Installed Components**
331
+ - **GPU**: Tesla T4
332
+ - **Driver**: 535
333
+ - **CUDA Toolkit**: 12.2
334
+ - **cuDNN**: 9.5.1
335
+ - **PyTorch**: Installed with CUDA 12.2 support
336
+
337
+ This setup ensures your system is ready for deep learning workloads with the T4 GPU.
338
+ ```