TODO
This post contains the solutions to some common bugs occured in deep learning with Ubuntu. It contains:
- Basic usage of Ubuntu
- CUDA
Ubuntu
Add/delete user
# add a new user NEW_USER_NAME
sudo adduser -m NEW_USER_NAME
# set password
sudo pass NEW_USER_NAME
# delete a user
sudo deluser NEW_USER_NAME
# Fix a bug: if the console of the new user does
# NOT display current directory OR only display $
# OR cannot use most of the shell command
# It means the path "bin" is not connected correctly
# delete the user and add it through:
useradd -s /bin/bash -d /home/xxx -m xxx
Install CUDA
Install CUDA 10.2
To use CUDA 10.2 as an example, the official instruction is like:
from https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=runfilelocal
Command:
# for ubuntu 20.04, it needs to install GCC 8
# the maximum support version of CUDA 10.2 is GCC 8,
# Install GCC 8, and switch system GCC version to GCC 8
sudo apt-get install gcc-8 g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
# download cuda and install CUDA 10.2
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
sudo sh cuda_10.2.89_440.33.01_linux.run
- Do you accept the above EULA? (accept/decline/quit): accept
- Unselect Driver, Samples, Demo, and Documentation
like:
CUDA Installer
- [ ] Driver
[ ] 440.33.01
+ [X] CUDA Toolkit 10.2
[ ] CUDA Samples 10.2
[ ] CUDA Demo Suite 10.2
[ ] CUDA Documentation 10.2
- Select Install
Enable NVCC / Solve Error: NVCC is not found
NVCC is the compile tools to use NVIDIA CUDA. Lacks of the soft link of NVCC may cause the compiling error: NVCC is not found.
Copy the following two lines to .bashrc, and restart the terminal, or run "source .bashrc"
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/bin
To check whether the CUDA is installed successfully
# open a terminal and run
nvcc --version
The output is looks like:
----
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
----