Because setup is always a pain
Here is an in depth breakdown of each step from chapter 2 if you are on windows. Feel free to copy and modify into your own notes. Note that the `wget` and `sudo sh cuda` lines are already slightly different from the course.
### WSL Setup:
Open the search bar and type Windows Features
Select turn windows features on and off
Make sure the following are checked:
* Hypervisor
* Virtual Machine Platform
* Windows Subsystem for Linux
Open the command prompt as Administrator
`wsl --install -d Ubuntu`
`wsl.exe --install --no-distribution`
restart as needed
Open wsl by typing `wsl` then enter the password
`sudo apt update && sudo apt upgrade`
`sudo apt install wget curl git`
`sudo apt install python3-pip`
### Install the CUDA toolkit:
https://developer.nvidia.com/cuda-downloads
Click through the options to install in Linux which for me were:
* Linux
* x86_64
* WSL-Ubuntu
* 2.0
* runfile(local)
`wget https://developer.download.nvidia.com/compute/cuda/12.6.1/local_installers/cuda_12.6.1_560.35.03_linux.run`
`sudo sh cuda_12.6.1_560.35.03_linux.run`
The environment vars still had to be installed so:
`nano ~/.bashrc`
add the lines somewhere in the file:
`export PATH=/usr/local/cuda-12.6/bin${PATH:+:${PATH}}`
`export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64`
back in the terminal run `source ~/.bashrc`
### Test
run `nvcc --version` and `nvidia-smi`
Also create a test file `main.cu`
```
#include <iostream>
using namespace std;
int main() {
cout << "hello world" >> endl;
}
```
Compile back in the terminal with `nvcc -o main main.cu`
Then run with `./main`
关闭于 2024-09-28 0 条评论