(serverId?: string)
| 51 | } |
| 52 | |
| 53 | const checkGpuDriver = async (serverId?: string) => { |
| 54 | let driverVersion: string | undefined; |
| 55 | let driverInstalled = false; |
| 56 | let availableGPUs = 0; |
| 57 | |
| 58 | try { |
| 59 | const driverCommand = |
| 60 | "nvidia-smi --query-gpu=driver_version --format=csv,noheader"; |
| 61 | const { stdout: nvidiaSmi } = serverId |
| 62 | ? await execAsyncRemote(serverId, driverCommand) |
| 63 | : await execAsync(driverCommand); |
| 64 | |
| 65 | driverVersion = nvidiaSmi.trim(); |
| 66 | if (driverVersion) { |
| 67 | driverInstalled = true; |
| 68 | const countCommand = |
| 69 | "nvidia-smi --query-gpu=gpu_name --format=csv,noheader | wc -l"; |
| 70 | const { stdout: gpuCount } = serverId |
| 71 | ? await execAsyncRemote(serverId, countCommand) |
| 72 | : await execAsync(countCommand); |
| 73 | |
| 74 | availableGPUs = Number.parseInt(gpuCount.trim(), 10); |
| 75 | } |
| 76 | } catch (error) { |
| 77 | console.debug("GPU driver check:", error); |
| 78 | } |
| 79 | |
| 80 | return { driverVersion, driverInstalled, availableGPUs }; |
| 81 | }; |
| 82 | |
| 83 | const checkRuntime = async (serverId?: string) => { |
| 84 | let runtimeInstalled = false; |
no test coverage detected