Skip to content

Instantly share code, notes, and snippets.

@ilyakava
Created November 28, 2020 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyakava/4ff879c0d7653ac9901c43231fbaa835 to your computer and use it in GitHub Desktop.
Save ilyakava/4ff879c0d7653ac9901c43231fbaa835 to your computer and use it in GitHub Desktop.

Getting a linux virtual environment with GPU access on Windows 10

WSL2 with Ubuntu 18.04 and NVidia containers (tf 1.15)

  • Follow these directions, everything before "Set up Python environment"
    • Choose Ubuntu 18.04
  • Follow some sections in these directions
    • Do "Setting up CUDA Toolkit"
    • In "Running CUDA Applications", try to cd /usr/local/cuda/samples/0_Simple/matrixMulCUBLAS/, make, and ./matrixMulCUBLAS
    • Do "Setting up to Run Containers"
  • Follow 1-4 in these directions
  • Inside wsl do docker pull nvcr.io/nvidia/tensorflow:20.11-tf1-py3
    • run this container with docker run --gpus all --rm -it -v /mnt/d/Documents/:/projects nvcr.io/nvidia/tensorflow:20.11-tf1-py3 substituting /mnt/d/Documents/ for your documents folder
    • other containers are available here

Easy benchmark test of tf 1.15

git clone https://github.com/aime-team/tf1-benchmarks.git
cd tf1-benchmarks
python ./scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py --model resnet50 --num_gpus=1 --batch_size=1

Increase batch size slowly, out of memory error in this benchmark needs to be kill -9ed from another terminal (docker container list, docker exec -it CONTAINER_ID bash, ps -a, and kill -9 PID).

On GeForce GTX 960 4GB, max batchsize is 3 and gets 20.48 images/sec. This is 10x faster than benchmark running with directml tensorflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment