Skip to content

Instantly share code, notes, and snippets.

install nvidia driver

sudo apt-get update
sudo apt-get install nvidia-384
sudo reboot

set gpu cards to persistent mode

sudo nvidia-persistenced --persistence-mode
sudo docker run --rm -it -p 8888:8888 --name jupyterlab -e JUPYTER_ENABLE_LAB=yes -v "$PWD":/home/jovyan/work -e NB_UID=$(id -u) -e NB_GID=$(id -g) -e GRANT_SUDO=yes --user root zldrobit/jupyter:py27
# sudo docker run --rm -p 8888:8888 -it --name jupyter -e JUPYTER_ENABLE_LAB=yes -v "$PWD":/home/jovyan/work -e NB_UID=0 -e NB_GID=0 -e GRANT_SUDO=yes --user root zldrobit/jupyter:py27
sleep 3
sudo docker exec jupyter jupyter notebook list
# echo 'jupyter is running.'
@zldrobit
zldrobit / git-misc.txt
Created April 30, 2019 03:18
About git
# search file in git history by 'search_string'
# see https://stackoverflow.com/questions/4468361/search-all-of-git-history-for-a-string?rq=1
git rev-list --all | GIT_PAGER=cat xargs git grep 'search_string'
@zldrobit
zldrobit / ffmpeg-nvidia-docker.build
Last active May 21, 2019 03:56
ffmpeg multi-stage build for nvidia docker
# from
# https://gitlab.com/nvidia/samples/blob/master/cuda/ubuntu16.04/ffmpeg-gpu/Dockerfile
# NVIDIA Video Codec SDK in ffmpeg
# https://www.ffmpeg.org/
# https://developer.nvidia.com/ffmpeg
# FFmpeg is licensed under the GNU Lesser General Public License
# (LGPL) version 2.1 or later.
# FFmpeg incorporates several optional parts and optimizations that
# are covered by the GNU General Public License (GPL) version 2 or
nvidia-docker run --rm -it --name yolo_deepsort -v /home/utiva/workspace:/workspace \
-e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-e QT_X11_NO_MITSHM=1 \
-e NVIDIA_DRIVER_CAPABILITIES='compute,utility,display' \
--privileged --device=/dev/video0:/dev/video0 --ipc=host\
--device /dev/apex_0:/dev/apex_0 \
-v /dev/bus/usb:/dev/bus/usb \
${1:-zldrobit/yolo-deepsort} /bin/bash
# in supervisor:
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.compat.v1.InteractiveSession(config=config)
@zldrobit
zldrobit / check_cuda_cudnn.md
Created June 19, 2020 07:14 — forked from Jongbhin/check_cuda_cudnn.md
[Cuda cudnn version check] #cuda #cudnn #nvidia

To check nvidia driver

modinfo nvidia

To check cuda version

cat /usr/local/cuda/version.txt

Push gdbserver if there isn't

adb push path_to_gdbserver /data/local/tmp/gdbserver
run-as package_name mkdir -p /data/data/package_name/gdb/bin
cat /data/local/tmp/gdbserver | run-as package_name sh -c 'cat > /data/data/package_name/gdb/bin/gdbserver'
run-as package_name chmod 700 /data/data/package_name/gdb/bin/gdbserver

Run app manually on device

yolov4

yolov4 tiny

# execute following 2 lines
sudo nvidia-xconfig --enable-all-gpus
sudo nvidia-xconfig --cool-bits=4
# append following to ~/.profile
# set GPU fan speed
nvidia-settings -a "[gpu:0]/GPUFanControlState=1"
nvidia-settings -a "[fan:0]/GPUTargetFanSpeed=100"
nvidia-settings -a "[fan:1]/GPUTargetFanSpeed=100"