From 33506069f55d8e15d65938e8ec5b7bee37bd3486 Mon Sep 17 00:00:00 2001 From: Matthew Mazzola Date: Sun, 3 Mar 2024 00:56:05 +0000 Subject: [PATCH] Add .devcontainer --- .devcontainer/devcontainer.env | 3 ++ .devcontainer/devcontainer.json | 68 ++++++++++++++++++++++++++++++ .devcontainer/postCreateCommand.sh | 26 ++++++++++++ .github/dependabot.yml | 12 ++++++ 4 files changed, 109 insertions(+) create mode 100644 .devcontainer/devcontainer.env create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/postCreateCommand.sh create mode 100644 .github/dependabot.yml diff --git a/.devcontainer/devcontainer.env b/.devcontainer/devcontainer.env new file mode 100644 index 0000000..9b9352a --- /dev/null +++ b/.devcontainer/devcontainer.env @@ -0,0 +1,3 @@ +# Control the number of GPUs visible to scripts +CUDA_VISIBLE_DEVICES=0,1 + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..38ab34a --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,68 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Python 3", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", + "features": { + "ghcr.io/devcontainers/features/azure-cli:1": {}, + "ghcr.io/devcontainers/features/common-utils:2": {}, + "ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {} + }, + "postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh", + "customizations": { + "vscode": { + "settings": { + "python.analysis.autoImportCompletions": true, + "python.analysis.autoImportUserSymbols": true, + "python.defaultInterpreterPath": "~/miniconda3/envs/llava/bin/python", + "python.formatting.provider": "black", + "python.linting.enabled": true, + "python.linting.flake8Enabled": true, + "isort.check": true, + "dev.containers.copyGitConfig": true, + "terminal.integrated.defaultProfile.linux": "zsh", + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/usr/bin/zsh" + }, + }, + "[python]": {} + }, + "extensions": [ + "aaron-bond.better-comments", + "alefragnani.Bookmarks", + "dotenv.dotenv-vscode", + "eamodio.gitlens", + "EditorConfig.EditorConfig", + "foxundermoon.shell-format", + "GitHub.copilot", + "lehoanganh298.json-lines-viewer", + "mechatroner.rainbow-csv", + "mhutchie.git-graph", + "ms-azuretools.vscode-docker", + "ms-dotnettools.dotnet-interactive-vscode", + "ms-python.black-formatter", + "ms-python.flake8", + "ms-python.isort", + "ms-python.python", + "ms-python.vscode-pylance", + "njpwerner.autodocstring", + "redhat.vscode-yaml", + "stkb.rewrap", + "tamasfe.even-better-toml", + "yzhang.markdown-all-in-one" + ] + } + }, + "runArgs": [ + "--gpus", + "all", + // "--ipc", + // "host", + "--ulimit", + "memlock=-1", + "--env-file", + ".devcontainer/devcontainer.env" + ], +} diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100644 index 0000000..17c7332 --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,26 @@ +git config --global safe.directory '*' +git config --global core.editor "code --wait" +git config --global pager.branch false + +# Activate conda by default +echo "source /home/vscode/miniconda3/bin/activate" >> ~/.zshrc +echo "source /home/vscode/miniconda3/bin/activate" >> ~/.bashrc + +# Use environment by default +echo "conda activate mathvista" >> ~/.zshrc +echo "conda activate mathvista" >> ~/.bashrc + +# Activate conda on current shell +source /home/vscode/miniconda3/bin/activate + +# Create and activate mathvista environment +conda create -n mathvista python=3.10 -y +conda activate mathvista + +# Install Nvidia Cuda Compiler +CUDA_VERSION=11.8 +conda install -y -c nvidia cuda=$CUDA_VERSION cuda-nvcc=$CUDA_VERSION + +pip install --upgrade pip + +echo "postCreateCommand.sh completed!" diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f33a02c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly