(serverId?: string)
| 176 | }; |
| 177 | |
| 178 | const checkCudaSupport = async (serverId?: string) => { |
| 179 | let cudaVersion: string | undefined; |
| 180 | let cudaSupport = false; |
| 181 | |
| 182 | try { |
| 183 | const cudaCommand = 'nvidia-smi -q | grep "CUDA Version"'; |
| 184 | const { stdout: cudaInfo } = serverId |
| 185 | ? await execAsyncRemote(serverId, cudaCommand) |
| 186 | : await execAsync(cudaCommand); |
| 187 | |
| 188 | const cudaMatch = cudaInfo.match(/CUDA Version\s*:\s*([\d.]+)/); |
| 189 | cudaVersion = cudaMatch ? cudaMatch[1] : undefined; |
| 190 | cudaSupport = !!cudaVersion; |
| 191 | } catch (error) { |
| 192 | console.debug("CUDA support check:", error); |
| 193 | } |
| 194 | |
| 195 | return { cudaVersion, cudaSupport }; |
| 196 | }; |
| 197 | |
| 198 | export async function setupGPUSupport(serverId?: string): Promise<void> { |
| 199 | try { |
no test coverage detected