|
| 1 | +This guide covers all installation scenarios for TritonParse, from basic usage to full development setup. |
| 2 | + |
| 3 | +## 📋 Prerequisites |
| 4 | + |
| 5 | +### System Requirements |
| 6 | +- **Python** >= 3.10 |
| 7 | +- **Operating System**: Linux, macOS, or Windows (with WSL recommended) |
| 8 | +- **GPU Required** (Triton depends on GPU): |
| 9 | + - **NVIDIA GPUs**: CUDA 11.8+ |
| 10 | + - **AMD GPUs**: ROCm 5.0+ (supports MI100, MI200, MI300 series) |
| 11 | +- **Node.js** >= 22.0.0 (for website development only) |
| 12 | + |
| 13 | +> ⚠️ **Important**: GPU is required to generate traces because Triton kernels can only run on GPU hardware. The web interface can view existing traces without GPU. |
| 14 | +
|
| 15 | +--- |
| 16 | + |
| 17 | +## 🔧 Install Required Dependencies |
| 18 | + |
| 19 | +All installation options require PyTorch and Triton. Complete these steps first before choosing your installation option below. |
| 20 | + |
| 21 | +### Step 1: Install PyTorch with GPU Support |
| 22 | + |
| 23 | +#### For NVIDIA GPUs (CUDA) |
| 24 | +```bash |
| 25 | +# Install PyTorch nightly with CUDA 12.8 support (recommended) |
| 26 | +pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128 |
| 27 | + |
| 28 | +# Alternative: Install stable PyTorch with CUDA support |
| 29 | +pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 |
| 30 | +``` |
| 31 | + |
| 32 | +#### For AMD GPUs (ROCm) |
| 33 | +```bash |
| 34 | +# Install PyTorch nightly with ROCm support (recommended) |
| 35 | +pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.2 |
| 36 | + |
| 37 | +# Alternative: Install stable PyTorch with ROCm support |
| 38 | +pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1 |
| 39 | +``` |
| 40 | + |
| 41 | +### Step 2: Verify GPU Setup |
| 42 | +```bash |
| 43 | +# Verify PyTorch and GPU |
| 44 | +python -c "import torch; print(f'PyTorch: {torch.__version__}')" |
| 45 | +python -c "import torch; print(f'GPU available: {torch.cuda.is_available()}')" |
| 46 | +python -c "import torch; print(f'GPU device: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"No GPU\"}')" |
| 47 | + |
| 48 | +# Verify Triton (bundled with PyTorch) |
| 49 | +python -c "import triton; print(f'Triton: {triton.__version__}')" |
| 50 | +``` |
| 51 | + |
| 52 | +> 💡 **Note**: Triton is bundled with PyTorch nightly and recent stable releases. No separate installation is needed. |
| 53 | +
|
| 54 | +--- |
| 55 | + |
| 56 | +## 🎯 Installation Options |
| 57 | + |
| 58 | +Now choose your installation method based on your needs: |
| 59 | + |
| 60 | +### Option 1: PyPI Installation (Recommended for Most Users) |
| 61 | +**Quick installation from Python Package Index** |
| 62 | + |
| 63 | +```bash |
| 64 | +# Install nightly version (recommended, latest features) |
| 65 | +pip install -U --pre tritonparse |
| 66 | + |
| 67 | +# OR install stable version |
| 68 | +pip install tritonparse |
| 69 | +``` |
| 70 | + |
| 71 | +### Option 2: Install from Source |
| 72 | + |
| 73 | +```bash |
| 74 | +# Clone and install |
| 75 | +git clone https://github.com/meta-pytorch/tritonparse.git |
| 76 | +cd tritonparse |
| 77 | +pip install -e . |
| 78 | + |
| 79 | +# OR install directly from GitHub without cloning |
| 80 | +pip install git+https://github.com/meta-pytorch/tritonparse.git |
| 81 | +``` |
| 82 | + |
| 83 | +**Additional setup for contributors:** |
| 84 | + |
| 85 | +```bash |
| 86 | +# For Python development: install formatting tools (black, usort, ruff) |
| 87 | +make install-dev |
| 88 | + |
| 89 | +# For website development: install Node.js dependencies (requires Node.js >= 22.0.0) |
| 90 | +cd website && npm install |
| 91 | +npm run dev # Start dev server at http://localhost:5173 |
| 92 | +``` |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## ✅ Verify Installation |
| 97 | + |
| 98 | +Test that TritonParse is working correctly: |
| 99 | + |
| 100 | +```bash |
| 101 | +# Navigate to tests directory |
| 102 | +cd tests # or cd tritonparse/tests if you didn't clone |
| 103 | + |
| 104 | +# Run example test |
| 105 | +TORCHINDUCTOR_FX_GRAPH_CACHE=0 python test_add.py |
| 106 | +``` |
| 107 | + |
| 108 | +**Expected output:** |
| 109 | +```bash |
| 110 | +Triton kernel executed successfully |
| 111 | +Torch compiled function executed successfully |
| 112 | +================================================================================ |
| 113 | +📁 TRITONPARSE PARSING RESULTS |
| 114 | +================================================================================ |
| 115 | +📂 Parsed files directory: /scratch/findhao/tritonparse/tests/parsed_output |
| 116 | +📊 Total files generated: 2 |
| 117 | +... |
| 118 | +✅ Parsing completed successfully! |
| 119 | +================================================================================ |
| 120 | +``` |
| 121 | + |
| 122 | +### Using the Web Interface |
| 123 | +1. Generate trace files using the Python API (see [Usage Guide](02.-Usage-Guide.md)) |
| 124 | +2. Visit [https://meta-pytorch.org/tritonparse/](https://meta-pytorch.org/tritonparse/) |
| 125 | +3. Load your trace files (.ndjson or .gz format) |
| 126 | + |
| 127 | +### Additional Commands for Development |
| 128 | + |
| 129 | +**For Python development (Option 3):** |
| 130 | +```bash |
| 131 | +# Check code formatting |
| 132 | +make format-check |
| 133 | + |
| 134 | +# Run linting |
| 135 | +make lint-check |
| 136 | + |
| 137 | +# Run tests |
| 138 | +make test |
| 139 | +``` |
| 140 | + |
| 141 | +**For website development (Option 4):** |
| 142 | +```bash |
| 143 | +npm run dev # Development server |
| 144 | +npm run build # Production build |
| 145 | +npm run build:single # Standalone HTML build |
| 146 | +npm run preview # Preview production build |
| 147 | +``` |
| 148 | + |
| 149 | +--- |
| 150 | + |
| 151 | +## 🐛 Troubleshooting |
| 152 | + |
| 153 | +### Common Issues |
| 154 | + |
| 155 | +#### 1. GPU Not Available |
| 156 | +**Error:** "CUDA not available" or "ROCm not available" |
| 157 | + |
| 158 | +**Diagnosis:** |
| 159 | +```bash |
| 160 | +python -c "import torch; print(f'GPU available: {torch.cuda.is_available()}')" |
| 161 | +python -c "import torch; print(f'Device count: {torch.cuda.device_count()}')" |
| 162 | +``` |
| 163 | + |
| 164 | +**Solution:** Reinstall PyTorch with GPU support following [Step 1](#step-1-install-pytorch-with-gpu-support) above. |
| 165 | + |
| 166 | +#### 2. Triton Installation Issues |
| 167 | +**Error:** "No module named 'triton'" or "Triton version mismatch" |
| 168 | + |
| 169 | +**Solution:** |
| 170 | +```bash |
| 171 | +pip uninstall -y pytorch-triton triton || true |
| 172 | +pip install --upgrade triton |
| 173 | +``` |
| 174 | + |
| 175 | +#### 3. Permission Issues |
| 176 | +**Error:** Permission denied during installation |
| 177 | + |
| 178 | +**Solution:** Use a virtual environment |
| 179 | +```bash |
| 180 | +python -m venv tritonparse-env |
| 181 | +source tritonparse-env/bin/activate # Linux/Mac |
| 182 | +# OR |
| 183 | +tritonparse-env\Scripts\activate # Windows |
| 184 | +``` |
| 185 | + |
| 186 | +#### 4. Development Tools Not Found |
| 187 | +**Error:** "black not found" or similar |
| 188 | + |
| 189 | +**Solution:** |
| 190 | +```bash |
| 191 | +make install-dev |
| 192 | +# OR manually: pip install black usort ruff |
| 193 | +``` |
| 194 | + |
| 195 | +#### 5. Website Build Issues |
| 196 | +**Error:** Node.js version too old |
| 197 | + |
| 198 | +**Solution:** |
| 199 | +```bash |
| 200 | +# Update Node.js to >= 22.0.0 |
| 201 | +conda install 'nodejs>=22.0.0' -c conda-forge |
| 202 | + |
| 203 | +# Clear cache and reinstall |
| 204 | +rm -rf node_modules package-lock.json |
| 205 | +npm install |
| 206 | +``` |
| 207 | + |
| 208 | +### Useful Environment Variables |
| 209 | + |
| 210 | +> 💡 **See [Environment Variables Reference](07.-Environment-Variables-Reference.md)** for complete documentation of all variables. |
| 211 | +
|
| 212 | +```bash |
| 213 | +# TritonParse |
| 214 | +export TRITONPARSE_DEBUG=1 # Enable debug logging |
| 215 | +export TRITON_TRACE_COMPRESSION=gzip # Enable gzip compression |
| 216 | +export TRITON_TRACE=/path/to/traces # Custom trace directory |
| 217 | +export TRITON_TRACE_LAUNCH=1 # Enable launch tracing |
| 218 | +export TRITONPARSE_MORE_TENSOR_INFORMATION=1 # Collect tensor statistics |
| 219 | + |
| 220 | +# PyTorch/TorchInductor |
| 221 | +export TORCHINDUCTOR_FX_GRAPH_CACHE=0 # Disable FX graph cache (for testing) |
| 222 | +export TORCH_LOGS="+dynamo,+inductor" # Enable PyTorch debug logs |
| 223 | + |
| 224 | +# GPU control |
| 225 | +export CUDA_VISIBLE_DEVICES=0 # Limit to specific GPU (NVIDIA) |
| 226 | +export ROCR_VISIBLE_DEVICES=0 # Limit to specific GPU (AMD) |
| 227 | +export CUDA_LAUNCH_BLOCKING=1 # Synchronous CUDA execution (for debugging) |
| 228 | +``` |
| 229 | + |
| 230 | +### Getting Help |
| 231 | + |
| 232 | +If you encounter issues: |
| 233 | + |
| 234 | +1. Check the [Troubleshooting section](#-troubleshooting) above |
| 235 | +2. Review the [FAQ](06.-FAQ.md) for frequently asked questions |
| 236 | +3. Search [GitHub Issues](https://github.com/meta-pytorch/tritonparse/issues) |
| 237 | +4. Open a new issue with system info (`python --version`, `pip list`) and error messages |
| 238 | + |
| 239 | +--- |
| 240 | + |
| 241 | +## 🚀 Next Steps |
| 242 | + |
| 243 | +After successful installation: |
| 244 | + |
| 245 | +1. **Read the [Usage Guide](02.-Usage-Guide.md)** to learn how to generate traces |
| 246 | +2. **Explore the [Web Interface Guide](03.-Web-Interface-Guide.md)** to master the visualization |
| 247 | +3. **Check out [Basic Examples](02.-Usage-Guide.md#example-complete-triton-kernel)** for practical usage scenarios |
| 248 | +4. **Review the [Environment Variables Reference](07.-Environment-Variables-Reference.md)** for configuration options |
| 249 | +5. **See the [Python API Reference](08.-Python-API-Reference.md)** for complete API documentation |
| 250 | +6. **Join the [GitHub Discussions](https://github.com/meta-pytorch/tritonparse/discussions)** for community support |
0 commit comments