codewithyug's picture
Release: Certified-Safe Neural Control MODEL v1.0
0210a65 verified
Raw History Blame Contribute Delete
3.43 kB
https://github.com/mani-skill/ManiSkill#!/bin/bash
# ==============================================================================
# WSL2 Setup Script for Certified Safe Neural Control Under Distribution Shift
# Target: Ubuntu 22.04 LTS on WSL2 with NVIDIA CUDA 12.x Passthrough
# ==============================================================================
set -e
echo "=== [1/6] Updating System & Installing Core Packages ==="
if command -v cmake &> /dev/null && command -v vulkaninfo &> /dev/null; then
echo "[+] Core graphics and build packages already installed. Skipping apt-get."
else
sudo apt-get update && sudo apt-get install -y \
build-essential \
cmake \
git \
curl \
wget \
libgl1 \
libegl1 \
libglvnd0 \
libglx0 \
libvulkan1 \
vulkan-tools \
python3-dev
fi
echo "=== [2/6] Verifying NVIDIA Driver Passthrough in WSL2 ==="
if command -v nvidia-smi &> /dev/null; then
nvidia-smi
echo "[+] NVIDIA Driver passthrough detected successfully!"
else
echo "[!] WARNING: nvidia-smi not found. Ensure NVIDIA Windows Driver with WSL2 support is installed."
fi
echo "=== [3/6] Setting Up Conda Environment ==="
if ! command -v conda &> /dev/null && [ ! -f "$HOME/miniconda3/bin/conda" ]; then
echo "Miniconda not detected. Installing Miniconda..."
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh
bash /tmp/miniconda.sh -b -u -p ~/miniconda3
rm -f /tmp/miniconda.sh
export PATH="$HOME/miniconda3/bin:$PATH"
~/miniconda3/bin/conda init bash
else
echo "[+] Miniconda already installed."
export PATH="$HOME/miniconda3/bin:$PATH"
fi
source ~/.bashrc || true
export PATH="$HOME/miniconda3/bin:$PATH"
# Accept Conda Terms of Service for default channels if prompted
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main 2>/dev/null || true
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r 2>/dev/null || true
# Add conda-forge channel for community packages
conda config --add channels conda-forge 2>/dev/null || true
if conda info --envs | grep -q "cbf-shift"; then
echo "[+] Environment 'cbf-shift' already exists. Activating..."
else
echo "[+] Creating 'cbf-shift' environment with Python 3.10..."
conda create -n cbf-shift python=3.10 -y
fi
eval "$(conda shell.bash hook)"
conda activate cbf-shift
echo "=== [4/6] Installing PyTorch with CUDA 12.1 ==="
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
echo "=== [5/6] Installing CVXPY, OSQP, and Optimization Solvers ==="
pip install cvxpy osqp qpsolvers[open_source] numpy scipy matplotlib pandas hydra-core pytest tqdm
echo "=== [6/6] Installing ManiSkill3 (Dual-Mode: GPU & CPU Support) ==="
# ManiSkill3 supports both GPU (PhysX/Vulkan) and CPU simulation
pip install mani-skill
echo "=== [Done] Validating PyTorch & CUDA ==="
python -c "import torch; print(f'PyTorch {torch.__version__} | CUDA Available: {torch.cuda.is_available()} | Device: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"CPU\"}')"
echo "=========================================================================="
echo "WSL2 Environment Ready! Activate with: conda activate cbf-shift"
echo "=========================================================================="