feat: introduce server process manager and OpenVINO NPU setup scripts for cross-platform model hosting
This commit is contained in:
1 parent
7d83de23f4
commit
6cf13a52d6
3 files changed
+33
-5
No files matched your search
+31
-3
@@ -389,11 +389,13 @@ function getOpenVinoPythonCandidates() {
|
||||
const candidates = [];
|
||||
if (process.env.OPENVINO_PYTHON) candidates.push(process.env.OPENVINO_PYTHON);
|
||||
if (osPlatform === "win32") {
|
||||
candidates.push(path.join(ROOT, "app", "tools", "openvino-venv", "Scripts", "python.exe"));
|
||||
candidates.push(path.join(ROOT, "app", "tools", "openvino-venv-win", "Scripts", "python.exe"));
|
||||
candidates.push(path.join(ROOT, "app", "tools", "openvino-venv", "Scripts", "python.exe")); // legacy fallback
|
||||
candidates.push("C:\\tmp\\npu-test-venv\\Scripts\\python.exe");
|
||||
candidates.push("python");
|
||||
} else {
|
||||
candidates.push(path.join(ROOT, "app", "tools", "openvino-venv", "bin", "python"));
|
||||
candidates.push(path.join(ROOT, "app", "tools", "openvino-venv-linux", "bin", "python"));
|
||||
candidates.push(path.join(ROOT, "app", "tools", "openvino-venv", "bin", "python")); // legacy fallback
|
||||
candidates.push("python3");
|
||||
candidates.push("python");
|
||||
}
|
||||
@@ -713,6 +715,32 @@ function hasAmdGpu() {
|
||||
return info.includes("amd") || info.includes("advanced micro devices") || info.includes("radeon");
|
||||
}
|
||||
|
||||
// Detect whether we are running inside WSL2 (Windows Subsystem for Linux).
|
||||
// WSL2's GPU paravirtualization (GPU-PV) only exposes a D3D12/DirectX interface
|
||||
// to Linux. Vulkan hardware passthrough is only supported for NVIDIA (via CUDA).
|
||||
// Intel Arc and AMD GPUs in WSL2 fall back to llvmpipe (CPU software rendering).
|
||||
function isRunningInWSL() {
|
||||
if (osPlatform !== "linux") return false;
|
||||
try {
|
||||
const procVersion = fs.readFileSync("/proc/version", "utf8").toLowerCase();
|
||||
return procVersion.includes("microsoft") || procVersion.includes("wsl");
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getVulkanUnavailableReason() {
|
||||
if (osPlatform === "linux" && isRunningInWSL()) {
|
||||
const gpuName = getGpuInfo().name;
|
||||
const lowerGpu = gpuName.toLowerCase();
|
||||
if (lowerGpu.includes("intel") || lowerGpu.includes("arc")) {
|
||||
return `Vulkan GPU is not available in WSL2 for Intel ${gpuName}. WSL2's GPU paravirtualization only exposes a DirectX interface — Intel Arc Vulkan requires running natively on Windows.`;
|
||||
}
|
||||
return "Vulkan GPU is not available in WSL2. WSL2's GPU paravirtualization does not support hardware Vulkan for this GPU. Run natively on Windows or Linux for GPU acceleration.";
|
||||
}
|
||||
return "Installed, but this binary did not register a Vulkan backend on this machine.";
|
||||
}
|
||||
|
||||
function getBackendOptions() {
|
||||
if (cachedBackendOptions) return cachedBackendOptions;
|
||||
|
||||
@@ -749,7 +777,7 @@ function getBackendOptions() {
|
||||
|
||||
const unavailable = [];
|
||||
if (vulkanInstalled && !vulkanAvailable) {
|
||||
unavailable.push({ id: "vulkan", label: "Vulkan GPU", reason: "Installed, but this binary did not register a Vulkan backend on this machine." });
|
||||
unavailable.push({ id: "vulkan", label: "Vulkan GPU", reason: getVulkanUnavailableReason() });
|
||||
}
|
||||
if (cudaInstalled && !cudaAvailable) {
|
||||
unavailable.push({ id: "cuda", label: "CUDA GPU", reason: "Installed, but CUDA backend validation failed." });
|
||||
|
||||
@@ -5,7 +5,7 @@ $ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$rootDir = Split-Path -Parent $scriptDir
|
||||
$venvDir = Join-Path $rootDir "app\tools\openvino-venv"
|
||||
$venvDir = Join-Path $rootDir "app\tools\openvino-venv-win"
|
||||
$pythonExe = Join-Path $venvDir "Scripts\python.exe"
|
||||
|
||||
Write-Host ""
|
||||
|
||||
@@ -7,7 +7,7 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
VENV_DIR="$ROOT_DIR/app/tools/openvino-venv"
|
||||
VENV_DIR="$ROOT_DIR/app/tools/openvino-venv-linux"
|
||||
PYTHON_BIN="$VENV_DIR/bin/python"
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in new issue
Block a user