Skip to content

Instantly share code, notes, and snippets.

@valorkin
Last active May 10, 2021 20:32
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 valorkin/7fdd53f949cb3d08e06378941d1ad064 to your computer and use it in GitHub Desktop.
Save valorkin/7fdd53f949cb3d08e06378941d1ad064 to your computer and use it in GitHub Desktop.
py for colab ts2 on wsl2
# only windows + python 3.7
# update env_var path for python scripts
# enable long names for terminal
# cuda windows https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/
# tf-gpu https://www.tensorflow.org/install/gpu#windows_setup
pip install jupyter
pip install --upgrade jupyter_http_over_ws>=0.0.7
jupyter serverextension enable --py jupyter_http_over_ws
# optional for https://colab.research.google.com/drive/16SHo7X27zmFZbggnFe_pbAclYuVOlPbn#scrollTo=wHfsJ5nWLWh9
pip install imageio
pip install google-colab
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
#test
# python models/research/object_detection/builders/model_builder_tf2_test.py
#!/bin/bash
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo sh -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
sudo apt-get update
sudo apt-get install -y cuda-toolkit-11-3
curl https://get.docker.com | sh
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
curl -s -L https://nvidia.github.io/libnvidia-container/experimental/$distribution/libnvidia-container-experimental.list | sudo tee /etc/apt/sources.list.d/libnvidia-container-experimental.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo service docker stop
sudo service docker start
#sleep 10
#sudo docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
# python
sudo apt-get update
sudo apt install -y build-essential
sudo apt install -y python3 python3-dev python-is-python3 python3-pip
sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
# protobuf
sudo apt install -y protobuf-compiler
# cuda
# Read carefull, each line! https://docs.nvidia.com/cuda/wsl-user-guide/index.html
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo sh -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
sudo apt-get update
sudo apt-get install -y cuda-toolkit-11-3
#sudo apt install -y jupyter-core jupyter-notebook
pip install jupyter
#export PATH=$PATH:~/.local/bin
pip install --upgrade jupyter_http_over_ws>=0.0.7
jupyter serverextension enable --py jupyter_http_over_ws
#pip install imageio
#pip install google-colab
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
sudo docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment