Skip to content

Commit

Permalink
remove reg match
Browse files Browse the repository at this point in the history
  • Loading branch information
zhewang1-intc committed Jul 17, 2024
1 parent 0382709 commit e9034b8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions gpu/gpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
Expand Down Expand Up @@ -193,10 +192,8 @@ func DetectInteliGpuMemStatus(gpuInfo *OneapiGPUInfo) {
return
}
result := strings.TrimSpace(string(output))
re := regexp.MustCompile("[0-9]+")
match := re.FindString(result)
if match != "" {
usedVRAM, _ := strconv.ParseUint(match, 10, 64)
if result != "" {
usedVRAM, _ := strconv.ParseUint(result, 10, 64)
gpuInfo.FreeMemory = gpuInfo.TotalMemory - usedVRAM
} else {
gpuInfo.GpuInfo.UnreliableFreeMemory = true
Expand Down

0 comments on commit e9034b8

Please sign in to comment.