# CNTUG Infra Labs Deep Learning Configuration ## Info ### OpenStack Instance - Flavor: g1.xlarge - RAM: 16 GB - vCPU: 16 core - Storage: 60 GB - Distro: Ubuntu 20.04 - GPU: Nvidia Tesla P4 ### In this note - Nvidia driver: 450.80.02 - CUDA: 11.7 - PyTorch: 1.13.1+cu117 ## Install Nvidia driver ```bash= sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf" sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf" cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf sudo update-initramfs -u sudo reboot now sudo apt install linux-headers-5.4.0-91-generic wget https://us.download.nvidia.com/tesla/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run chmod +x NVIDIA-Linux-x86_64-450.80.02.run sudo ./NVIDIA-Linux-x86_64-450.80.02.run sudo reboot now ``` ## Install CUDA ```bash= wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" sudo apt update sudo apt install cuda sudo apt install nvidia-cuda-toolkit ``` ## Install PyTorch ```bash= sudo apt install python-is-python3 sudo apt install python3-pip pip install torch torchvision torchaudio ``` ## Setup Jupyter Lab :::info Security roles: Inbound port 8888 from 0.0.0.0/0 ::: ```bash= export PATH="/usr/local/bin:$PATH" pip install --user jupyter jupyterlab pip install markupsafe==2.0.1 jupyter notebook --generate-config jupyter server password nano ~/.jupyter/jupyter_notebook_config.py ``` `~/.jupyter/jupyter_notebook_config.py` ```py c = get_config() c.NotebookApp.allow_password_change = False c.NotebookApp.allow_root = False c.NotebookApp.base_url = '/' c.NotebookApp.default_url = '/lab' c.NotebookApp.disable_check_xsrf = False c.NotebookApp.ip = '*' c.NotebookApp.nbserver_extensions = { 'jupyterlab' : True } c.NotebookApp.notebook_dir = '~/' c.NotebookApp.open_browser = False c.NotebookApp.password_required = True c.NotebookApp.port = 8888 ``` Back to the terminal. ```bash= jupyter serverextension enable --py jupyterlab screen -S jupyterlab jupyter lab ``` :::warning Press `Ctrl+A` then `Ctrl+D` to detach from the screen. :::