"git@developer.sourcefind.cn:OpenDAS/torch-spline-conv.git" did not exist on "d6f4cb01714a844a22bf6ad05e05c30f433034a1"
Commit f07f8b7a authored by Daniel Hiltgen's avatar Daniel Hiltgen
Browse files

Harden for zero detected GPUs

At least with the ROCm libraries, its possible to have the library
present with zero GPUs.  This fix avoids a divide by zero bug in llm.go
when we try to calculate GPU memory with zero GPUs.
parent e02ecfb6
...@@ -135,7 +135,7 @@ func GetGPUInfo() GpuInfo { ...@@ -135,7 +135,7 @@ func GetGPUInfo() GpuInfo {
if memInfo.err != nil { if memInfo.err != nil {
slog.Info(fmt.Sprintf("error looking up CUDA GPU memory: %s", C.GoString(memInfo.err))) slog.Info(fmt.Sprintf("error looking up CUDA GPU memory: %s", C.GoString(memInfo.err)))
C.free(unsafe.Pointer(memInfo.err)) C.free(unsafe.Pointer(memInfo.err))
} else { } else if memInfo.count > 0 {
// Verify minimum compute capability // Verify minimum compute capability
var cc C.cuda_compute_capability_t var cc C.cuda_compute_capability_t
C.cuda_compute_capability(*gpuHandles.cuda, &cc) C.cuda_compute_capability(*gpuHandles.cuda, &cc)
...@@ -157,7 +157,7 @@ func GetGPUInfo() GpuInfo { ...@@ -157,7 +157,7 @@ func GetGPUInfo() GpuInfo {
} else if memInfo.igpu_index >= 0 && memInfo.count == 1 { } else if memInfo.igpu_index >= 0 && memInfo.count == 1 {
// Only one GPU detected and it appears to be an integrated GPU - skip it // Only one GPU detected and it appears to be an integrated GPU - skip it
slog.Info("ROCm unsupported integrated GPU detected") slog.Info("ROCm unsupported integrated GPU detected")
} else { } else if memInfo.count > 0 {
if memInfo.igpu_index >= 0 { if memInfo.igpu_index >= 0 {
// We have multiple GPUs reported, and one of them is an integrated GPU // We have multiple GPUs reported, and one of them is an integrated GPU
// so we have to set the env var to bypass it // so we have to set the env var to bypass it
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment