├── .devcontainer └── devcontainer.json ├── .dockerignore ├── LICENSE ├── README.md ├── base.dockerfile ├── docker.sh ├── entrypoint.sh ├── init.vim ├── puffer-deps.dockerfile ├── pufferbox_setup.sh ├── puffertank ├── puffertank.dockerfile ├── sources.list ├── ubuntu_pufferbox_setup.sh ├── version_check.py └── vimrc /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/containers/docker-existing-dockerfile 3 | { 4 | "name": "Existing Dockerfile", 5 | "runArgs": ["--init", "--gpus=all"], 6 | 7 | // Sets the run context to one level up instead of the .devcontainer folder. 8 | "context": "..", 9 | 10 | // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. 11 | "dockerFile": "../puffertank.dockerfile", 12 | 13 | // Set *default* container specific settings.json values on container create. 14 | "settings": {}, 15 | 16 | // Add the IDs of extensions you want installed when the container is created. 17 | "extensions": [ 18 | "ms-python.python", 19 | "ms-python.vscode-pylance" 20 | ], 21 | 22 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 23 | // "forwardPorts": [], 24 | 25 | // Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker. 26 | // "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], 27 | 28 | // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. 29 | // "remoteUser": "vscode" 30 | } 31 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .gitignore 3 | Dockerfile* 4 | docker-compose* 5 | README.md 6 | LICENSE 7 | .vscode -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 PufferAI 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![figure](https://pufferai.github.io/source/resource/header.png) 2 | 3 | # Puffertank 4 | 5 | An Nvidia GPU container for PufferTank, PufferLib, and supported projects. We **strongly** recommend VSCode DevContainers for local development. 6 | 7 | ### 1. Install Docker 8 | 9 | Docker is a containerization technology to package code and its dependencies. Install and configure docker [Docker Desktop](https://docs.docker.com/desktop/) by following the official install instructions for your operationg system and then completing the post-installation steps. Linux users may also need to install [Nvidia Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#installation-guide). 10 | 11 | To test your docker installation: `docker run hello-world`. 12 | 13 | ### 2. Download This Repository 14 | 15 | Windows users should clone to WSL 16 | 17 | ### 3. Open in VS code 18 | 19 | Install [Visual Studio Code](https://code.visualstudio.com/) 20 | From the Extensions panel on the left: Dev Containers > Install 21 | F1 > Dev Containers: Open Folder in Container > puffertank 22 | 23 | For more information see [Containerized Development](https://code.visualstudio.com/docs/devcontainers/containers) 24 | 25 | ### 4. Run without VS code 26 | 27 | ``` 28 | bash docker.sh test 29 | ``` 30 | 31 | Comes pre-loaded with my NeoVim config. :PlugInstall for code completion with SuperMaven. 32 | -------------------------------------------------------------------------------- /base.dockerfile: -------------------------------------------------------------------------------- 1 | FROM nvcr.io/nvidia/cuda:12.1.0-runtime-ubuntu22.04 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | RUN apt-get update && \ 6 | apt-get install -y \ 7 | # Basics 8 | vim git curl htop screen software-properties-common sudo \ 9 | # Python 10 | && apt-add-repository -y ppa:deadsnakes/ppa \ 11 | && apt-get install -y python3.11 \ 12 | && apt-get install -y python3.11-dev \ 13 | && apt-get install -y python3.11-distutils \ 14 | # Clean 15 | && apt clean \ 16 | && rm -rf /var/lib/apt/lists/* 17 | 18 | # Install Pip 19 | RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 20 | 21 | # Set Python 3.11 as default 22 | RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 11 && \ 23 | update-alternatives --install /usr/bin/python python /usr/bin/python3.11 11 24 | 25 | # PyTorch 26 | RUN python3.11 -m pip install --upgrade pip 27 | RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 28 | -------------------------------------------------------------------------------- /docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Default values 4 | username="pufferai" # replace with your Docker Hub username 5 | dockerfile="" # Dockerfile to use 6 | image="puffertank" 7 | tag="2.0" 8 | name="puffertank" 9 | 10 | # Function for building Docker image 11 | build() { 12 | # Verify a Dockerfile was provided 13 | if [ -z "$dockerfile" ]; then 14 | echo "You must specify a Dockerfile with -d." 15 | exit 1 16 | fi 17 | # Check if a Docker container with the same name already exists 18 | if [ "$(docker ps -aq -f name=^/${name}$)" ]; then 19 | # Stop and remove the existing container 20 | echo "A Docker container with the name ${name} already exists. Stopping and removing it..." 21 | docker stop ${name} 22 | docker rm ${name} 23 | fi 24 | echo "Building Docker image ${username}/${image}:${tag} with Dockerfile ${dockerfile}..." 25 | docker build -t ${username}/${image}:${tag} -f ${dockerfile} . 26 | } 27 | 28 | # Function for testing Docker image 29 | # Need this on ubuntu for x11: xhost +local:docker 30 | test() { 31 | # Check if a Docker container with the same name already exists 32 | if [ "$(docker ps -aq -f name=^/${name})" ]; then 33 | # If the container exists and is stopped, start it 34 | echo "A Docker container with the name ${name} already exists. Starting it..." 35 | docker start ${name} 36 | else 37 | # If the container does not exist, run a new one 38 | echo "Running Docker image ${username}/${image}:${tag} and executing shell..." 39 | docker run -it \ 40 | --name ${name} \ 41 | --gpus all \ 42 | -v /tmp/.X11-unix:/tmp/.X11-unix \ 43 | -v /var/run/docker.sock:/var/run/docker.sock \ 44 | -v /mnt/wslg:/mnt/wslg \ 45 | -v "$(pwd):/puffertank/docker" \ 46 | -e DISPLAY \ 47 | -e WAYLAND_DISPLAY \ 48 | -e XDG_RUNTIME_DIR \ 49 | -e PULSE_SERVER \ 50 | -p 8000:8000 \ 51 | --memory=110g \ 52 | --shm-size=32g \ 53 | ${username}/${image}:${tag} bash 54 | fi 55 | # Attach to the running container 56 | docker exec -it ${name} bash 57 | } 58 | 59 | # Function for pushing Docker image 60 | push() { 61 | echo "Pushing Docker image ${username}/${name}:${tag}..." 62 | docker push ${username}/${name}:${tag} 63 | } 64 | 65 | # Function for displaying usage instructions 66 | usage() { 67 | echo "Usage: $0 command [-d dockerfile] [-n name] [-i image] [-t tag] [-u username]" 68 | echo "Commands:" 69 | echo " build" 70 | echo " test" 71 | echo " push" 72 | } 73 | 74 | # Main script 75 | if [ "$#" -eq 0 ]; then 76 | usage 77 | exit 1 78 | fi 79 | 80 | command=$1 81 | shift 82 | 83 | # Parse command-line arguments for Dockerfile, name, tag, and username 84 | while getopts n:i:t:u:d: flag 85 | do 86 | case "${flag}" in 87 | n) name=${OPTARG};; 88 | i) image=${OPTARG};; 89 | t) tag=${OPTARG};; 90 | u) username=${OPTARG};; 91 | d) dockerfile=${OPTARG};; 92 | esac 93 | done 94 | 95 | case $command in 96 | build) 97 | build 98 | ;; 99 | test) 100 | test 101 | ;; 102 | push) 103 | push 104 | ;; 105 | *) 106 | usage 107 | ;; 108 | esac 109 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # print CUDA version 4 | echo "CUDA Version: $(nvcc --version | grep "release" | awk '{print $6}')" 5 | 6 | # check if NVIDIA driver is loaded 7 | if ! nvidia-smi > /dev/null 2>&1; then 8 | echo "WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available." 9 | fi 10 | 11 | # check PufferLib version 12 | python3 /root/version_check.py 13 | 14 | # keep container running 15 | exec "$@" -------------------------------------------------------------------------------- /init.vim: -------------------------------------------------------------------------------- 1 | call plug#begin('~/.config/nvim/plugged') 2 | 3 | Plug 'supermaven-inc/supermaven-nvim' 4 | Plug 'wookayin/semshi', { 'do': ':UpdateRemotePlugins' } 5 | 6 | call plug#end() 7 | 8 | autocmd VimEnter * ++once lua require('supermaven-nvim').setup({}) 9 | 10 | set nocompatible 11 | 12 | " Not sure if I want line numbers 13 | "set number 14 | set signcolumn=yes 15 | 16 | set clipboard=unnamedplus 17 | 18 | set tabstop=4 19 | set shiftwidth=4 20 | set expandtab 21 | 22 | set path+=** 23 | set wildmenu 24 | command! MakeTags !ctags -R . 25 | 26 | let g:netrw_banner=0 27 | let g:netrw_browse_split=4 28 | let g:netrw_altv=1 29 | let g:netrw_liststyle=3 30 | 31 | ""Colorscheme 32 | set termguicolors 33 | 34 | " local syntax file - set colors on a per-machine basis: 35 | " vim: tw=0 ts=4 sw=4 36 | " Vim color file 37 | " Maintainer: Ron Aaron 38 | " Last Change: 2003 May 02 39 | 40 | set background=dark 41 | hi clear 42 | if exists("syntax_on") 43 | syntax reset 44 | endif 45 | 46 | let g:colors_name = "elflord" 47 | hi Normal guifg=Cyan guibg=#061a1a 48 | hi SignColumn guibg=#061a1a 49 | hi Comment term=bold ctermfg=Cyan guifg=White 50 | hi Constant term=underline ctermfg=Cyan guifg=White 51 | hi Special term=bold ctermfg=Red guifg=LightBlue 52 | hi Identifier term=underline cterm=bold ctermfg=Cyan guifg=LightBlue 53 | hi Statement term=bold ctermfg=Yellow gui=bold guifg=Red 54 | hi PreProc term=underline ctermfg=LightBlue guifg=Red 55 | hi Type term=underline ctermfg=LightGreen guifg=Red gui=bold 56 | hi Function term=bold ctermfg=White guifg=White 57 | hi Repeat term=underline ctermfg=White guifg=Red 58 | hi Operator ctermfg=Red guifg=Red 59 | hi Ignore ctermfg=black guifg=bg 60 | hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=#ff0000 61 | hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Black guibg=Yellow gui=bold 62 | hi LineNr ctermfg=LightBlue guifg=LightBlue 63 | 64 | hi ParenHighlight ctermfg=magenta guifg=LightBlue 65 | match ParenHighlight /[\\\.\,\+\-\*\=(){}\[\]]/ 66 | 67 | 68 | " Common groups that link to default highlighting. 69 | " You can specify other highlighting easily. 70 | hi link String Constant 71 | hi link Character Constant 72 | hi link Number Constant 73 | hi link Boolean Constant 74 | hi link Float Number 75 | hi link Conditional Repeat 76 | hi link Label Statement 77 | hi link Keyword Statement 78 | hi link Exception Statement 79 | hi link Include PreProc 80 | hi link Define PreProc 81 | hi link Macro PreProc 82 | hi link PreCondit PreProc 83 | hi link StorageClass Type 84 | hi link Structure Type 85 | hi link Typedef Type 86 | hi link Tag Special 87 | hi link SpecialChar Special 88 | hi link Delimiter Special 89 | hi link SpecialComment Special 90 | hi link Debug Special 91 | 92 | syntax enable 93 | filetype plugin on 94 | 95 | 96 | let g:semshi#excluded_hl_groups = ['local', 'global', 'free', 'attribute'] 97 | 98 | function MyCustomHighlights() 99 | hi semshiImported ctermfg=214 guifg=Gray cterm=bold gui=bold 100 | hi semshiParameter ctermfg=75 guifg=DarkCyan 101 | hi semshiParameterUnused ctermfg=117 guifg=DarkCyan cterm=underline gui=underline 102 | hi semshiBuiltin ctermfg=207 guifg=LightGray 103 | hi semshiSelf ctermfg=249 guifg=DarkGreen 104 | hi semshiUnresolved ctermfg=226 guifg=#ffff00 cterm=underline gui=underline 105 | hi semshiSelected ctermfg=231 guifg=Green ctermbg=161 guibg=#061a1a gui=bold 106 | 107 | hi semshiErrorSign ctermfg=231 guifg=Yellow ctermbg=160 guibg=#061a1a 108 | hi semshiErrorChar ctermfg=231 guifg=Yellow ctermbg=160 guibg=#061a1a 109 | sign define semshiError text=E texthl=semshiErrorSign 110 | endfunction 111 | autocmd FileType python call MyCustomHighlights() 112 | -------------------------------------------------------------------------------- /puffer-deps.dockerfile: -------------------------------------------------------------------------------- 1 | FROM pufferai/base:2.0 2 | 3 | RUN apt-get update && \ 4 | apt-get install --no-install-recommends -y \ 5 | # Avalon 6 | # libegl-dev libglew-dev libglfw3-dev \ 7 | # libopengl-dev libosmesa6 mesa-utils-extra \ 8 | # NetHack 9 | clang autoconf libtool flex bison libbz2-dev \ 10 | # Griddly 11 | libgl1-mesa-glx \ 12 | # Gym MicroRTS 13 | openjdk-8-jdk \ 14 | # Deepmind lab Bazel 15 | apt-transport-https curl gnupg \ 16 | # Deepmind control rendering 17 | # Note - no libglew2.0? 18 | libglfw3 libglew-dev \ 19 | # Bazel dependencies 20 | build-essential freeglut3 gettext git libffi-dev libglu1-mesa \ 21 | libglu1-mesa-dev libjpeg-dev liblua5.1-0-dev libosmesa6-dev \ 22 | libsdl2-dev lua5.1 pkg-config python-setuptools python3-dev \ 23 | software-properties-common unzip zip zlib1g-dev g++ \ 24 | && apt clean \ 25 | && rm -rf /var/lib/apt/lists/* 26 | 27 | RUN pip3 install wheel 28 | 29 | # Broken as of latest Python -- let me know if you actually need this 30 | # Install Bazel 31 | #RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg \ 32 | # && mv bazel.gpg /etc/apt/trusted.gpg.d/ \ 33 | # && echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list \ 34 | # && apt-get update && apt-get install --no-install-recommends -y bazel \ 35 | # && apt clean \ 36 | # && rm -rf /var/lib/apt/lists/* 37 | 38 | # Install Deepmind Lab 39 | #RUN rm -rf deepmind_lab \ 40 | # && git clone https://github.com/deepmind/lab.git deepmind_lab \ 41 | # && cd deepmind_lab \ 42 | # && echo 'build --cxxopt=-std=c++17' > .bazelrc \ 43 | # && bazel build -c opt //python/pip_package:build_pip_package \ 44 | # && ./bazel-bin/python/pip_package/build_pip_package /tmp/dmlab_pkg \ 45 | # && pip3 install --force-reinstall /tmp/dmlab_pkg/deepmind_lab-*.whl \ 46 | # && rm -rf /tmp/dmlab_pkg/deepmind_lab-*.whl \ 47 | # && rm -rf .git \ 48 | # && cd .. \ 49 | # && rm -rf ~/.cache/bazel/ \ 50 | # && rm -rf deepmind_lab 51 | 52 | # Install Neovim and VimPlug 53 | RUN apt update \ 54 | && apt install -y ninja-build gettext cmake unzip curl \ 55 | && git clone --single-branch --depth=1 https://github.com/neovim/neovim \ 56 | && cd neovim \ 57 | && make CMAKE_BUILD_TYPE=Release \ 58 | && make install \ 59 | && ln -s /usr/local/bin/nvim /usr/bin/nvim \ 60 | && pip3 install pynvim \ 61 | && sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' 62 | 63 | RUN git clone --recursive https://github.com/PufferAI/gpudrive \ 64 | && cd gpudrive \ 65 | && mkdir build \ 66 | && cd build \ 67 | && cmake .. -DCMAKE_BUILD_TYPE=Release \ 68 | && make -j # cores to build with, e.g. 32 \ 69 | && mv gpudrive.cpython-310-x86_64-linux-gnu.so gpudrive.cpython-311-x86_64-linux-gnu.so \ 70 | && cd .. \ 71 | && pip install -e . \ 72 | && ln -s pygpudrive ../pufferlib/pygpudrive 73 | 74 | 75 | 76 | # Avalon -- TODO: Figure out how to autoselect libnvidia-gl version 77 | -------------------------------------------------------------------------------- /pufferbox_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # REMEMBER TO UPDATE DOCKER PULL FLAG WHEN UPDATING THIS SCRIPT 4 | 5 | # Run this script as root. Prerequisites: 6 | # 1. Disable secure boot in BIOS settings! Otherwise, NVIDIA drivers will not work. 7 | # 2. Upgrade system and REBOOT: 8 | # apt-get update && apt-get upgrade && apt-get dist-upgrade && apt-get install git 9 | # 3. cd /home/puffer && git clone https://github.com/pufferai/puffertank 10 | 11 | # Install essentials 12 | apt-get install -y \ 13 | linux-headers-$(uname -r) \ 14 | build-essential \ 15 | openssh-server \ 16 | vim \ 17 | dkms \ 18 | apt-transport-https \ 19 | ca-certificates \ 20 | curl \ 21 | gnupg 22 | 23 | # Fix sources.list 24 | cp sources.list /etc/apt/sources.list 25 | 26 | # Install Tailscale 27 | if ! command -v tailscale &> /dev/null; then 28 | curl -fsSL https://tailscale.com/install.sh | sh 29 | fi 30 | 31 | 32 | cat "cd /home/puffer/puffertank && bash docker.sh test" >> /home/puffer/.bashrc 33 | 34 | # Docker 35 | if ! command -v docker &> /dev/null; then 36 | sudo apt-get update 37 | sudo apt-get install ca-certificates curl 38 | sudo install -m 0755 -d /etc/apt/keyrings 39 | sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc 40 | sudo chmod a+r /etc/apt/keyrings/docker.asc 41 | 42 | # Add the repository to Apt sources: 43 | echo \ 44 | "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable" | \ 45 | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 46 | fi 47 | 48 | # Update the package list to reflect new repositories 49 | apt-get update -y 50 | 51 | apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin 52 | 53 | # Install the NVIDIA driver using the Debian non-free repository 54 | apt-get install -t experimental -y nvidia-driver 55 | 56 | echo "Installation complete. Please reboot your system." 57 | 58 | # Nvidia container (have to use Debian 11 bullseye for now) 59 | curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey > /etc/apt/keyrings/nvidia-docker.key 60 | curl -s -L https://nvidia.github.io/nvidia-docker/debian11/nvidia-docker.list > /etc/apt/sources.list.d/nvidia-docker.list 61 | sed -i -e "s/^deb/deb \[signed-by=\/etc\/apt\/keyrings\/nvidia-docker.key\]/g" /etc/apt/sources.list.d/nvidia-docker.list 62 | 63 | apt-get update && apt-get install -y nvidia-container-toolkit 64 | systemctl restart docker 65 | 66 | # Completion message with instructions 67 | echo -e "Installation complete.\nTo complete installation:\n\ 68 | 1) Set passwords:\n\ 69 | - passwd puffer\n\ 70 | - passwd root\n\ 71 | 2) Initialize Tailscale:\n\ 72 | - tailscale up\n\ 73 | 3) Reboot the machine." 74 | -------------------------------------------------------------------------------- /puffertank: -------------------------------------------------------------------------------- 1 | /puffertank -------------------------------------------------------------------------------- /puffertank.dockerfile: -------------------------------------------------------------------------------- 1 | FROM pufferai/puffer-deps:2.0 2 | 3 | RUN mkdir -p /puffertank 4 | WORKDIR /puffertank 5 | 6 | # Workaround for nethack/minihack 7 | ENV READTHEDOCS=True 8 | 9 | # CARBS hyperparam sweeps 10 | RUN git clone https://github.com/pufferai/carbs && pip3 install --user -e carbs/ 11 | 12 | ADD https://api.github.com/repos/pufferai/pufferlib/git/refs/heads/2.0 version.json 13 | RUN git clone https://github.com/pufferai/pufferlib --branch 2.0 && SETUPTOOLS_ENABLE_FEATURES="legacy-editable" pip3 install --user -e pufferlib/[common] 14 | 15 | # Procgen fix 16 | RUN pip install glfw==2.7 17 | 18 | COPY version_check.py /root/version_check.py 19 | COPY entrypoint.sh /root/entrypoint.sh 20 | RUN chmod +x /root/entrypoint.sh 21 | 22 | # Copy my personal NeoVim config 23 | COPY init.vim /root/.config/nvim/init.vim 24 | 25 | # For the memes. Properly escaped pufferfish prompt 26 | RUN echo "export PS1=$' \xf0\x9f\[\x90\xa1\] '" >> ~/.bashrc \ 27 | && echo "alias vim='/usr/bin/nvim'" >> ~/.bashrc \ 28 | && echo "alias diff='diff --color --palette=':ad=36:de=31:ln=33''" >> ~/.bashrc 29 | 30 | ENTRYPOINT ["/root/entrypoint.sh"] 31 | CMD ["/bin/bash"] 32 | -------------------------------------------------------------------------------- /sources.list: -------------------------------------------------------------------------------- 1 | # For some reason dkms skipped a version and is only in unstable 2 | deb http://deb.debian.org/debian/ unstable main contrib non-free 3 | 4 | # A bunch of stuff for cuda 12.1 is in experimental and non-free-firmware 5 | deb http://deb.debian.org/debian experimental main contrib non-free non-free-firmware 6 | deb-src http://deb.debian.org/debian experimental main contrib non-free non-free-firmware 7 | 8 | deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware 9 | deb-src http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware 10 | 11 | deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware 12 | deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware 13 | 14 | # bookworm-updates, to get updates before a point release is made; 15 | # see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports 16 | deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware 17 | deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware 18 | -------------------------------------------------------------------------------- /ubuntu_pufferbox_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # REMEMBER TO UPDATE DOCKER PULL FLAG WHEN UPDATING THIS SCRIPT 4 | 5 | # Install essentials 6 | apt-get install -y \ 7 | linux-headers-$(uname -r) \ 8 | build-essential \ 9 | openssh-server \ 10 | vim \ 11 | dkms \ 12 | apt-transport-https \ 13 | ca-certificates \ 14 | curl \ 15 | gnupg 16 | 17 | # Install Tailscale 18 | if ! command -v tailscale &> /dev/null; then 19 | curl -fsSL https://tailscale.com/install.sh | sh 20 | fi 21 | 22 | cat "cd /home/puffer/puffertank && bash docker.sh test" >> /home/puffer/.bashrc 23 | 24 | # Docker 25 | if ! command -v docker &> /dev/null; then 26 | # Add Docker's official GPG key: 27 | sudo apt-get update 28 | sudo apt-get install ca-certificates curl 29 | sudo install -m 0755 -d /etc/apt/keyrings 30 | sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc 31 | sudo chmod a+r /etc/apt/keyrings/docker.asc 32 | 33 | # Add the repository to Apt sources: 34 | echo \ 35 | "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ 36 | $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ 37 | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 38 | fi 39 | 40 | # Update the package list to reflect new repositories 41 | apt-get update -y 42 | apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin 43 | 44 | # NVIDIA drivers 45 | apt-get install -y ubuntu-drivers 46 | sudo ubuntu-drivers install 47 | echo "Installation complete. Please reboot your system." 48 | 49 | # Nvidia container (have to use Debian 11 bullseye for now) 50 | curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ 51 | && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ 52 | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ 53 | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list 54 | 55 | apt-get update && apt-get install -y nvidia-container-toolkit 56 | systemctl restart docker 57 | 58 | # Completion message with instructions 59 | echo -e "Installation complete.\nTo complete installation:\n\ 60 | 1) Set passwords:\n\ 61 | - passwd puffer\n\ 62 | - passwd root\n\ 63 | 2) Initialize Tailscale:\n\ 64 | - tailscale up\n\ 65 | 3) sudo usermod -aG docker $USER 66 | 4) Reboot the machine." 67 | -------------------------------------------------------------------------------- /version_check.py: -------------------------------------------------------------------------------- 1 | import pkg_resources as pkg 2 | from distutils.version import LooseVersion as version 3 | import requests as req 4 | import os 5 | import subprocess 6 | 7 | def check_installed_vs_pypi(package): 8 | dist = pkg.get_distribution(package) 9 | installed_version = dist.version 10 | try: 11 | latest_version = req.get(f'https://pypi.org/pypi/{package}/json').json()['info']['version'] 12 | if version(installed_version) < version(latest_version): 13 | print(f'{package} {installed_version} is out of date. Consider rebuilding your container to update to version {latest_version}.') 14 | else: 15 | print(f'{package} {installed_version} is up to date.') 16 | except req.exceptions.RequestException: 17 | print(f'{package} {installed_version} may not be up to date; PufferTank failed to connect to the pip registry to check.') 18 | 19 | def check_dev_version(package): 20 | dist = pkg.get_distribution(package) 21 | os.chdir(dist.location) 22 | print(f'{package} {dist.version} (development)') 23 | result = subprocess.run('git status | head -n 2', shell=True, capture_output=True, text=True) 24 | print(result.stdout) 25 | 26 | if __name__ == "__main__": 27 | dist = pkg.get_distribution('pufferlib') 28 | if '/puffertank/' in dist.location: 29 | check_dev_version('pufferlib') 30 | else: 31 | check_installed_vs_pypi('pufferlib') -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | filetype plugin indent on 2 | set nocompatible 3 | 4 | set tabstop=4 5 | set shiftwidth=4 6 | set expandtab 7 | 8 | syntax enable 9 | filetype plugin on 10 | 11 | " Search down into subfolders 12 | set path+=** 13 | 14 | " Display all matching files when we tab complete 15 | set wildmenu 16 | 17 | " Create the tags file (may need to install ctags first) 18 | command! MakeTags !ctags -R . 19 | 20 | " Tweaks for browsing 21 | let g:netrw_banner=0 " disable annoying banner 22 | let g:netrw_browse_split=4 " open in prior window 23 | let g:netrw_altv=1 " open splits to the right 24 | let g:netrw_liststyle=3 " tree view 25 | let g:netrw_list_hide=netrw_gitignore#Hide() 26 | let g:netrw_list_hide.=',(^|\s\s)\zs.\S+' --------------------------------------------------------------------------------