- Setup Ubuntu x86_64 18.04
- Disable UEFI Safe Boot in BIOS (for NVIDIA module signing, may not be necessary)
Download the latest driver for your NVIDIA: https://www.nvidia.com/Download/index.aspx?lang=en-us
- Take note of the driver (ex. 430.30)
Run cat /proc/driver/nvidia/version
:
NVRM version: NVIDIA UNIX x86_64 Kernel Module 430.40 Sun Jul 21 04:53:48 CDT 2019
GCC version: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
Run nvidia-smi
:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.40 Driver Version: 430.40 CUDA Version: 10.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce RTX 2080 On | 00000000:01:00.0 Off | N/A |
| N/A 43C P8 5W / N/A | 211MiB / 7982MiB | 6% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1195 G /usr/lib/xorg/Xorg 128MiB |
| 0 1599 G /usr/bin/gnome-shell 81MiB |
+-----------------------------------------------------------------------------+
Install CUDA using Package Manager method (this ensure you're not forced to swap NVIDIA driver to unsupported lower driver)
- Pick
deb (network)
after selecting Linux 64 Ubuntu 18.04 - https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=debnetwork
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda
export PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.1${PATH:+:${PATH}}
Run systemctl status nvidia-persistenced
and verify active
state:
nvidia-persistenced.service - NVIDIA Persistence Daemon
Loaded: loaded (/lib/systemd/system/nvidia-persistenced.service; enabled; ven
Active: active (running) since Thu 2019-08-22 19:05:55 PDT; 22min ago
Process: 1238 ExecStart=/usr/bin/nvidia-persistenced --verbose (code=exited, s
Main PID: 1239 (nvidia-persiste)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/nvidia-persistenced.service
└─1239 /usr/bin/nvidia-persistenced --verbose
# Add the package repositories
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
$ sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
$ sudo systemctl restart docker
$ docker run --gpus all nvidia/cuda:9.0-base nvidia-smi
sudo apt-get install python-opencv
sudo apt-get install libopencv-dev
git clone https://github.com/pjreddie/darknet
cd darknet
wget https://pjreddie.com/media/files/yolov3.weights
wget https://pjreddie.com/media/files/yolov2.weights
Edit the Makefile
via vim
:
- Update
GPU=1
- Update
OPENCV=1
Run make
Assumes testing within darknet
download git folder.
./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
GPU-accelerated (ESC to escape)
20 FPS
./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights
30 FPS
./darknet detector demo cfg/coco.data cfg/yolov2.cfg yolov2.weights
./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights <video_file>
wget https://pjreddie.com/media/files/yolov3-tiny.weights
./darknet detect cfg/yolov3-tiny.cfg yolov3-tiny.weights data/dog.jpg
GPU-accelerated (ESC to escape)
30-40 FPS
./darknet detector demo cfg/yolov3-tiny.cfg yolov3-tiny.weights