Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ Parallax Windows CLI adopts modern C++ design patterns and mainly contains the f

### 1. Download and Install
Download the latest installer from the Release page:
```
Gradient_Parallax_PC_Setup_v1.0.0.0.exe
```

[Parallax_Win_Setup.exe](https://github.com/GradientHQ/parallax_win_cli/releases/latest/download/Parallax_Win_Setup.exe)

### 2. Environment Check
```cmd
Expand Down
9 changes: 9 additions & 0 deletions src/parallax/cli/commands/base_command.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ class WSLCommand : public BaseCommand<Derived> {
command);
}

// Build venv activation command with CUDA environment
std::string BuildVenvActivationCommand(const CommandContext& context) {
// Filter out Windows paths and add CUDA path
// Use single quotes and careful escaping for PowerShell/CMD compatibility
return "cd ~/parallax && "
"export PATH=/usr/local/cuda-12.8/bin:$(echo '$PATH' | tr ':' '\\n' | grep -v '/mnt/c' | paste -sd ':' -) && "
"source ./venv/bin/activate";
}

// Escape arguments for safe passing through bash -c "..."
// This prevents command injection and correctly handles spaces/special chars
// Note: This is for WSL bash layer, not Windows PowerShell layer
Expand Down
12 changes: 6 additions & 6 deletions src/parallax/cli/commands/cmd_command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,22 @@ std::string CmdCommand::BuildCommand(const CommandContext& context,
std::string full_command;

if (options.use_venv) {
// Execute in virtual environment
full_command = "cd ~/parallax && source ./venv/bin/activate";
// Execute in virtual environment with CUDA PATH
full_command = BuildVenvActivationCommand(context);

// Add proxy support (similar to implementation in model_commands.cpp)
if (!context.proxy_url.empty()) {
full_command += " && HTTP_PROXY=\"" + context.proxy_url +
"\" HTTPS_PROXY=\"" + context.proxy_url + "\" " +
full_command += " && HTTP_PROXY='" + context.proxy_url +
"' HTTPS_PROXY='" + context.proxy_url + "' " +
command;
} else {
full_command += " && " + command;
}
} else {
// Execute directly in WSL
if (!context.proxy_url.empty()) {
full_command = "HTTP_PROXY=\"" + context.proxy_url +
"\" HTTPS_PROXY=\"" + context.proxy_url + "\" " +
full_command = "HTTP_PROXY='" + context.proxy_url +
"' HTTPS_PROXY='" + context.proxy_url + "' " +
command;
} else {
full_command = command;
Expand Down
18 changes: 8 additions & 10 deletions src/parallax/cli/commands/model_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ bool ModelRunCommand::RunParallaxScript(const CommandContext& context) {
// Build run command: parallax run [user parameters...]
std::string run_command = BuildRunCommand(context);

// Build complete WSL command: cd ~/parallax && source ./venv/bin/activate
// && parallax run [args...]
std::string full_command = "cd ~/parallax && source ./venv/bin/activate";
// Build complete WSL command with venv activation and CUDA environment
std::string full_command = BuildVenvActivationCommand(context);

// If proxy is configured, add proxy environment variables
if (!context.proxy_url.empty()) {
full_command += " && HTTP_PROXY=\"" + context.proxy_url +
"\" HTTPS_PROXY=\"" + context.proxy_url + "\" " +
full_command += " && HTTP_PROXY='" + context.proxy_url +
"' HTTPS_PROXY='" + context.proxy_url + "' " +
run_command;
} else {
full_command += " && " + run_command;
Expand Down Expand Up @@ -95,14 +94,13 @@ CommandResult ModelJoinCommand::ExecuteImpl(const CommandContext& context) {
// Build cluster join command: parallax join [user parameters...]
std::string join_command = BuildJoinCommand(context);

// Build complete WSL command: cd ~/parallax && source ./venv/bin/activate
// && parallax join [args...]
std::string full_command = "cd ~/parallax && source ./venv/bin/activate";
// Build complete WSL command with venv activation and CUDA environment
std::string full_command = BuildVenvActivationCommand(context);

// If proxy is configured, add proxy environment variables
if (!context.proxy_url.empty()) {
full_command += " && HTTP_PROXY=\"" + context.proxy_url +
"\" HTTPS_PROXY=\"" + context.proxy_url + "\" " +
full_command += " && HTTP_PROXY='" + context.proxy_url +
"' HTTPS_PROXY='" + context.proxy_url + "' " +
join_command;
} else {
full_command += " && " + join_command;
Expand Down
22 changes: 5 additions & 17 deletions src/parallax/environment/software_installer2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,23 +257,11 @@ ComponentResult ParallaxProjectInstaller::Install() {
true);

if (!is_update_mode) {
// Only install sgl_kernel during first installation (use real-time
// output)
std::string install_sgl_cmd =
"cd ~/parallax && source ./venv/bin/activate && pip install "
"https://github.com/sgl-project/whl/releases/download/v0.3.7/"
"sgl_kernel-0.3.7+cu128-cp310-abi3-manylinux2014_x86_64.whl "
"--force-reinstall";
if (!proxy_url.empty()) {
install_sgl_cmd =
"cd ~/parallax && source ./venv/bin/activate && HTTP_PROXY=\"" +
proxy_url + "\" HTTPS_PROXY=\"" + proxy_url +
"\" pip install "
" https://github.com/sgl-project/whl/releases/download/v0.3.7/"
"sgl_kernel-0.3.7+cu128-cp310-abi3-manylinux2014_x86_64.whl "
"--force-reinstall";
}
commands.emplace_back("install_sgl_kernel", install_sgl_cmd, 600, true);
// Add CUDA environment variable to system profile (only during first installation)
std::string add_cuda_env_cmd =
"grep -q '/usr/local/cuda-12.8/bin' ~/.bashrc || "
"echo 'export PATH=/usr/local/cuda-12.8/bin:$PATH' >> ~/.bashrc";
commands.emplace_back("add_cuda_env", add_cuda_env_cmd, 30, false);
}

// Execute command sequence
Expand Down
Loading