Yes, your understanding is completely correct! Prakasa Windows CLI indeed uses C++ as a shell, ultimately calling the Python version of Prakasa.
┌─────────────────────────────────────────────────────────────┐
│ Windows User Layer │
│ prakasa.exe (C++ CLI) │
└────────────────────┬────────────────────────────────────────┘
│
├── check (Environment Check)
├── install (Environment Setup)
├── config (Configuration)
│
└── Core Commands (WSL Forwarding)
├── run ──┐
├── join ──┤
├── chat ──┤
└── cmd ──┤
│ │
┌─────────────────────────────┼──────┼──────────────────────┐
│ WSL2 (Ubuntu) │ │ │
│ ▼ ▼ │
│ ~/prakasa/ │
│ ├── venv/ (Python Virtual Environment) │
│ │ └── bin/activate │
│ ├── src/prakasa/ │
│ │ └── launch.py (Python Core) │
│ └── setup.py (pip install -e .[gpu]) │
│ │
│ Actual Execution: │
│ $ cd ~/prakasa │
│ $ source ./venv/bin/activate │
│ $ prakasa run [args] ← Python CLI │
│ │
└────────────────────────────────────────────────────────────┘
The C++ code executes in WSL2:
# 1. Clone Python version of Prakasa
cd ~ && git clone https://github.com/hetu-project/prakasa.git
# 2. Create Python virtual environment
cd ~/prakasa
python3 -m venv ./venv
# 3. Install Python version of Prakasa (editable mode)
source ./venv/bin/activate
pip install -e '.[gpu]'Key Code Location:
src/prakasa/environment/software_installer2.cpp(lines 200-280)
When user executes prakasa.exe run -m Qwen/Qwen3-0.6B:
// 1. C++ builds WSL command
std::string command =
"cd ~/prakasa && "
"export PATH=/usr/local/cuda-12.8/bin:$PATH && "
"source ./venv/bin/activate && "
"prakasa run -m Qwen/Qwen3-0.6B"; // ← Calls Python CLI
// 2. Execute via WSL
wsl.exe -d Ubuntu-24.04 -u root -- bash -c "$command"Key Code Locations:
src/prakasa/cli/commands/model_commands.cpp(lines 40-70)src/prakasa/cli/commands/base_command.h(lines 214-220)
C++ uses WSLProcess class to read Python program output in real-time:
WSLProcess wsl_process;
int exit_code = wsl_process.Execute(wsl_command);
// Real-time printing of Python's stdout/stderrKey Code Locations:
src/prakasa/utils/wsl_process.cppsrc/prakasa/utils/process.cpp
- ✅ Check Windows version and permissions
- ✅ Enable WSL2 and Virtual Machine Platform
- ✅ Install WSL2 kernel updates
- ✅ Detect NVIDIA GPU and drivers
- ✅ Verify CUDA Toolkit version
Code Locations:
src/prakasa/environment/system_checker.cppsrc/prakasa/environment/windows_feature_manager.cpp
- ✅ Install Ubuntu distribution
- ✅ Set proxy environment variables
- ✅ Clone Python version of Prakasa repository
- ✅ Create Python virtual environment
- ✅ Install Python dependencies
- ✅ Parse user command-line arguments
- ✅ Build WSL execution commands
- ✅ Activate Python virtual environment
- ✅ Call Python version of prakasa CLI
- ✅ Forward output and errors in real-time
- ✅ Support Ctrl+C interruption
- ✅ Manage
prakasa_config.txt - ✅ Proxy URL configuration
- ✅ WSL distribution selection
- ✅ Git repository URL configuration
The Python version of Prakasa handles all actual inference logic:
- 🐍 Distributed inference scheduling
- 🐍 Model loading and sharding
- 🐍 GPU management and CUDA calls
- 🐍 Network communication (gRPC/HTTP)
- 🐍 Web UI server
- 🐍 Tensor parallelism and pipeline parallelism
| Windows Command | C++ Behavior | Command Executed in WSL |
|---|---|---|
prakasa check |
Pure C++ environment check | (Does not call Python) |
prakasa install |
C++ install + clone Python version | git clone ... + pip install |
prakasa config |
Pure C++ configuration management | (Does not call Python) |
prakasa run [args] |
Forward to Python | cd ~/prakasa && source venv/bin/activate && prakasa run [args] |
prakasa join [args] |
Forward to Python | cd ~/prakasa && source venv/bin/activate && prakasa join [args] |
prakasa chat [args] |
Forward to Python | cd ~/prakasa && source venv/bin/activate && prakasa chat [args] |
prakasa cmd <cmd> |
Forward any command to WSL | wsl bash -c "<cmd>" |
-
User Experience Optimization
- Windows users only need to double-click
.exeto install - No manual WSL2 or Python environment configuration needed
- One-click environment check and installation
- Windows users only need to double-click
-
Windows System Integration
- Requires Windows API to enable system features
- Requires administrator privileges for registry operations
- Requires PowerShell to manage WSL2
-
Environment Isolation
- C++ handles Windows-side logic
- Python handles Linux-side inference logic
- Clear separation of concerns
-
Performance Considerations
- C++ shell starts quickly
- System-level operations more efficient in C++
- GPU computation handled by Python/CUDA
-
Dual-Language Maintenance
- Need to maintain both C++ and Python code
- Interface changes require synchronization
-
Complex Error Handling
- Need to pass error information across processes
- Encoding conversion issues (UTF-8 ↔ UTF-16)
-
Debugging Difficulty
- Need to debug both Windows + WSL environments
- Cross-process communication troubleshooting
// Build command
std::string command =
"cd ~/prakasa && "
"source ./venv/bin/activate && "
"prakasa run";
// Execute via wsl.exe
std::string wsl_cmd =
"wsl.exe -d Ubuntu-24.04 -u root -- bash -c \"" + command + "\"";
// Real-time output
WSLProcess::Execute(wsl_cmd);// PowerShell output is UTF-16 LE
std::string utf8_output =
ConvertPowerShellOutputToUtf8(powershell_raw_output);
// WSL output is UTF-8
std::string converted =
ConvertWslOutputToUtf8(wsl_raw_output);// C++ reads configuration
std::string proxy_url = config.GetConfigValue("proxy_url");
// Pass to Python
std::string command =
"HTTP_PROXY='" + proxy_url + "' "
"HTTPS_PROXY='" + proxy_url + "' "
"prakasa run";Prakasa Windows CLI is a typical "Local Shell + Remote Core" architecture:
- C++ Shell: Handles Windows-specific environment configuration and system integration
- Python Core: Handles actual distributed inference logic
- WSL2 Bridge: Connects Windows and Linux environments
This design allows Windows users to enjoy the same Prakasa functionality as Linux users, while providing a native Windows installation and configuration experience.
C++ Shell Core Files:
src/prakasa/main.cpp- Entry pointsrc/prakasa/cli/command_parser.cpp- Command routingsrc/prakasa/cli/commands/model_commands.cpp- run/join/chat forwardingsrc/prakasa/environment/software_installer2.cpp- Python environment installation
Python Core (in WSL2):
~/prakasa/- Python version of Prakasa repository~/prakasa/venv/- Python virtual environment~/prakasa/src/prakasa/launch.py- Python CLI entry point
Configuration Files:
prakasa_config.txt- Configuration file read by C++~/.bashrc- WSL environment variables (CUDA paths, etc.)