mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-04 12:13:28 -07:00
fix CUDA detection?
This commit is contained in:
parent
3e87a2c3e2
commit
978d8db455
4 changed files with 24 additions and 41 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "gerbil",
|
"name": "gerbil",
|
||||||
"productName": "Gerbil",
|
"productName": "Gerbil",
|
||||||
"version": "1.7.0",
|
"version": "1.7.1",
|
||||||
"description": "Run Large Language Models locally",
|
"description": "Run Large Language Models locally",
|
||||||
"main": "out/main/index.js",
|
"main": "out/main/index.js",
|
||||||
"homepage": "./",
|
"homepage": "./",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useEffect, useState, useCallback, useMemo } from 'react';
|
import { useEffect, useState, useCallback, useMemo } from 'react';
|
||||||
import type { BackendOption, BackendSupport } from '@/types';
|
|
||||||
import { CPUCapabilities, GPUDevice } from '@/types/hardware';
|
import { CPUCapabilities, GPUDevice } from '@/types/hardware';
|
||||||
|
import type { BackendOption, BackendSupport } from '@/types';
|
||||||
|
|
||||||
export interface Warning {
|
export interface Warning {
|
||||||
type: 'warning' | 'info';
|
type: 'warning' | 'info';
|
||||||
|
|
@ -61,7 +61,7 @@ const checkGpuWarnings = async (
|
||||||
backendSupport: BackendSupport,
|
backendSupport: BackendSupport,
|
||||||
gpuCapabilities: GpuCapabilities,
|
gpuCapabilities: GpuCapabilities,
|
||||||
gpuInfo: GpuInfo
|
gpuInfo: GpuInfo
|
||||||
): Promise<Warning[]> => {
|
) => {
|
||||||
const warnings: Warning[] = [];
|
const warnings: Warning[] = [];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,11 @@ async function detectVulkan() {
|
||||||
|
|
||||||
async function detectCUDA() {
|
async function detectCUDA() {
|
||||||
try {
|
try {
|
||||||
const { stdout } = await execa('nvidia-smi', [], COMMON_EXEC_OPTIONS);
|
const { stdout } = await execa(
|
||||||
|
'nvidia-smi',
|
||||||
|
['--query-gpu=name,driver_version,cuda_version', '--format=csv,noheader'],
|
||||||
|
COMMON_EXEC_OPTIONS
|
||||||
|
);
|
||||||
|
|
||||||
if (stdout.trim()) {
|
if (stdout.trim()) {
|
||||||
const errorPatterns = [
|
const errorPatterns = [
|
||||||
|
|
@ -145,33 +149,21 @@ async function detectCUDA() {
|
||||||
return { devices: [] } as const;
|
return { devices: [] } as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const lines = stdout.split('\n').filter((line) => line.trim());
|
||||||
const devices: string[] = [];
|
const devices: string[] = [];
|
||||||
let cudaVersion: string | undefined;
|
|
||||||
let driverVersion: string | undefined;
|
let driverVersion: string | undefined;
|
||||||
|
let cudaVersion: string | undefined;
|
||||||
|
|
||||||
const cudaMatch = stdout.match(/CUDA Version:\s*(\d+\.\d+)/);
|
for (const line of lines) {
|
||||||
if (cudaMatch) {
|
const [name, driver, cuda] = line.split(',').map((s) => s.trim());
|
||||||
cudaVersion = cudaMatch[1];
|
if (name) {
|
||||||
}
|
devices.push(formatDeviceName(name));
|
||||||
|
}
|
||||||
const driverMatch = stdout.match(
|
if (driver && !driverVersion) {
|
||||||
/Driver Version:\s*(\d+\.\d+(?:\.\d+)?)/
|
driverVersion = driver;
|
||||||
);
|
}
|
||||||
|
if (cuda && !cudaVersion) {
|
||||||
if (driverMatch) {
|
cudaVersion = cuda;
|
||||||
driverVersion = driverMatch[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
const gpuNameMatch = stdout.match(/\|\s+\d+\s+([^|]+)\s+On\s+\|/g);
|
|
||||||
|
|
||||||
if (gpuNameMatch) {
|
|
||||||
for (const match of gpuNameMatch) {
|
|
||||||
const name = match
|
|
||||||
.replace(/\|\s+\d+\s+([^|]+)\s+On\s+\|/, '$1')
|
|
||||||
.trim();
|
|
||||||
if (name) {
|
|
||||||
devices.push(formatDeviceName(name));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
17
yarn.lock
17
yarn.lock
|
|
@ -1376,12 +1376,12 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/node@npm:*":
|
"@types/node@npm:*, @types/node@npm:^24.9.1":
|
||||||
version: 24.9.0
|
version: 24.9.1
|
||||||
resolution: "@types/node@npm:24.9.0"
|
resolution: "@types/node@npm:24.9.1"
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: "npm:~7.16.0"
|
undici-types: "npm:~7.16.0"
|
||||||
checksum: 10c0/c0129572f2c1528d2d1b7f4ebdbc3c4b40273964d40786c8be3596e7482394ed4882676b2a44362d4b1da5bac0274fdf2cae11dce3d76319cadac541fd76e531
|
checksum: 10c0/c52f8168080ef9a7c3dc23d8ac6061fab5371aad89231a0f6f4c075869bc3de7e89b075b1f3e3171d9e5143d0dda1807c3dab8e32eac6d68f02e7480e7e78576
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|
@ -1394,15 +1394,6 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/node@npm:^24.9.1":
|
|
||||||
version: 24.9.1
|
|
||||||
resolution: "@types/node@npm:24.9.1"
|
|
||||||
dependencies:
|
|
||||||
undici-types: "npm:~7.16.0"
|
|
||||||
checksum: 10c0/c52f8168080ef9a7c3dc23d8ac6061fab5371aad89231a0f6f4c075869bc3de7e89b075b1f3e3171d9e5143d0dda1807c3dab8e32eac6d68f02e7480e7e78576
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@types/plist@npm:^3.0.1":
|
"@types/plist@npm:^3.0.1":
|
||||||
version: 3.0.5
|
version: 3.0.5
|
||||||
resolution: "@types/plist@npm:3.0.5"
|
resolution: "@types/plist@npm:3.0.5"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue