MCPcopy
hub / github.com/Dokploy/dokploy / checkGpuDriver

Function checkGpuDriver

packages/server/src/utils/gpu-setup.ts:53–81  ·  view source on GitHub ↗
(serverId?: string)

Source from the content-addressed store, hash-verified

51}
52
53const 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
83const checkRuntime = async (serverId?: string) => {
84 let runtimeInstalled = false;

Callers 1

checkGPUStatusFunction · 0.85

Calls 2

execAsyncRemoteFunction · 0.90
execAsyncFunction · 0.90

Tested by

no test coverage detected