nvidia-ubuntu-env

tested for two times.

prepare

use a portable disk to save all the files in case next time you need them

install ubuntu

  1. prepare a blank usb flash disk
  2. open the os iso in ultraios, and write it to your usb flash disk
  3. compress a blank partition in other disks, compress a 200m partition in your windows-disk
  4. reboot, in bois, select the usb flash disk, reboot
  5. edit install config(press e), add nomodeset after quite splash ( or it will 花屏)
  6. f10 to reboot
  7. begin install
    1. choose the last option for install
    2. add ubuntu disk partitions on your blank partition
      1. /, main partition
      2. home, logistic partition
      3. add efi on 200m partition
      4. add swap if your ram is small
  8. after installation reboot
  9. in grub, edit again, use e, add nomodeset after quite splash

install cuda and graphic card driver

tutorials on Chinese websites are not good enough. they always said you need to install the driver first, but actually the cuda will recommend you to install the driver while you are installing cuda

  1. copy the cuda.run from your external disk to your local disk

  2. change directory to where your cuda is

  3. sudo chmod x+a cuda.run

  4. sudo ./cuda.run

  5. after installation, edit environment variables

sudo gedit /etc/profile, append contents like in the bottom

refer to https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions for more

1
2
3
export PATH=/usr/local/cuda-11.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64\
${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

source /etc/profile to make it activated

check

  1. use nvidia-smi and nvcc -V to check whether it works.

  2. now you would be able to reboot the system without the need to add nomodeset

  3. run cuda examples

    • cd ~/nvidia_cuda-11.1-examples

    • make

    • devicequery, it is under utilities/devicequery

install docker

https://docs.docker.com/engine/install/ubuntu/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

check

sudo docker run hello-world

add permission

1
2
3
sudo gpasswd -a current_user_name docker
Sudo service docker restart
reboot

install others, just follow the document

  • ngc
  • nvidia docker

use vm to boost local docker pull

  1. cd to vm_for_docker_pull ( it is from my private repo)
  2. in bash, ssh -i nessvm-asia_key.pem ness@52.175.13.200
  3. pull the containers from NGC
  4. docker tag image_from_ngc registry.cn-hangzhou.aliyuncs.com/ness001/image_name
  5. on your local computer, docker pull registry.cn-hangzhou.aliyuncs.com/ness001/image_name

current pushed images

registry.cn-hangzhou.aliyuncs.com/ness001/ +aliyun image name

original name tag aliyun image name usage
nvcr.io/nvidia/tlt-streamanalytics v2.0_py3 nv-tlt transfer learning toolkit
nvidia/cuda 11.0-base cuda11 test for nvidia-docker2