Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mikael Gueck mikaelhg

🏠
Working from home
View GitHub Profile
@mikaelhg
mikaelhg / cleanup.sh
Created Mar 5, 2021
Clean up after NVidia driver update failure
View cleanup.sh
ls /var/lib/initramfs-tools | sudo xargs -n1 /usr/lib/dkms/dkms_autoinstaller start
sudo update-initramfs -c -k all
@mikaelhg
mikaelhg / .bazelrc.user
Last active Feb 9, 2021
Tensorflow Java build scripts
View .bazelrc.user
# AWS P2 instance type has K80 GPUs, compute capability 3.7
# AWS P3 instance type has V100 GPUs, compute capability 7.0
build:cuda --action_env=TF_CUDA_COMPUTE_CAPABILITIES=3.7,7.0
build:cuda --action_env=TF_CUDA_VERSION=10
build:cuda --action_env=TF_CUDNN_VERSION=7
# manually installed CUDA and cuDNN
build:cuda --action_env=TF_CUDA_PATHS=/usr/local/cuda-10.2.89,/usr/local/cudnn-10.2-7.6.5.32
@mikaelhg
mikaelhg / README.md
Created Jul 10, 2020
Using Packer to provision Amazon Linux 2 without seed.iso
View README.md

(I also reported this to AWS: https://github.com/awsdocs/amazon-ec2-user-guide/issues/123)

The "Running Amazon Linux 2 as a virtual machine onpremises" page describes a fairly cumbersome way of running Amazon Linux 2 in local virtual machines through using various tools to provision ISO9660 seed.iso files just to serve the VM instance two small data files.

It would be great it the documentation also pointed out that since the VM provisioning is being done with cloud-init, and the image has configured a fairly extensive datasource_list: [ NoCloud, AltCloud, ConfigDrive, OVF, None ] which starts with NoCloud, that NoCloud also allows you to serve these files over HTTP.

There are two easy ways of using network configuration instead of seed.iso. Either you tell GRUB to add a parameter to the kernel boot configuration, or you tell KVM/VMWare/Virtualbox to set the virtual machine's SMBIOS value to something which cloud-init's NoCloud understands.

The documentation page https://cloudinit.readthedocs.

@mikaelhg
mikaelhg / cuda-install.md
Last active Feb 23, 2021
Proper CUDA and cuDNN installation
View cuda-install.md
date title tags
2020-02-29
Proper CUDA and cuDNN installation
tech

You're here, so you're probably already hurting because of CUDA and cuDNN compatibility, and I won't have to motivate you, or explain why you'd want to have standalone CUDA and cuDNN installations, if you're going to develop using Tensorflow in the long term.

1. Download your CUDA runfile (local) packages

@mikaelhg
mikaelhg / nvidia-resume
Created May 5, 2020
Ubuntu 20.04 suspend / sleep / wakeup NVidia CUDA / NVENC / NVDEC error
View nvidia-resume
#! /bin/sh
# Workaround for broken CUDA/NVENC/NVDEC after suspend.
# This file now lives in /lib/systemd/system-sleep/nvidia-resume .
# Remember to chmod 755 it.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
case $1 in
post)
@mikaelhg
mikaelhg / mnist_quant.py
Last active Dec 13, 2019
TF 2 tflite quantization and int8
View mnist_quant.py
import os
import pathlib
import tensorflow as tf
import logging
## --------------------------------------------------------------------------------
# Configure
physical_devices = tf.config.experimental.list_physical_devices('GPU')
assert len(physical_devices) > 0, "No GPUs found"
@mikaelhg
mikaelhg / wakeup.txt
Created Nov 29, 2019
wakeup requires menu click xfce4
View wakeup.txt
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=781288;msg=37
$ apt-get remove light-locker
@mikaelhg
mikaelhg / docker-run.txt
Created Oct 30, 2019
Docker NVidia Tensorflow shm settings
View docker-run.txt
docker run --gpus all -it --rm --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 nvcr.io/nvidia/tensorflow:19.10-py3 nvidia-smi
@mikaelhg
mikaelhg / 01_error.md
Last active Oct 26, 2019
Tensorflow 1.15.0 "The minimum required Cuda capability is 6.0."
View 01_error.md

The Google official Java build in Maven Central is broken, and has been for quite a while.

Environment: AWS P2.xlarge instance with a K80 GPU and CUDA compute capability of 3.7.

Error: "Ignoring visible gpu device [...] The minimum required Cuda capability is 6.0."

Expected: The minimum CUDA compute capability is 3.5, like the documents state, and as the Python packages require.

https://www.tensorflow.org/install/gpu