|
@@ -16,13 +16,12 @@ import (
|
|
"os"
|
|
"os"
|
|
"path/filepath"
|
|
"path/filepath"
|
|
"runtime"
|
|
"runtime"
|
|
- "strconv"
|
|
|
|
"strings"
|
|
"strings"
|
|
"sync"
|
|
"sync"
|
|
"unsafe"
|
|
"unsafe"
|
|
|
|
|
|
- "github.com/ollama/ollama/format"
|
|
|
|
"github.com/ollama/ollama/envconfig"
|
|
"github.com/ollama/ollama/envconfig"
|
|
|
|
+ "github.com/ollama/ollama/format"
|
|
)
|
|
)
|
|
|
|
|
|
type handles struct {
|
|
type handles struct {
|
|
@@ -105,8 +104,6 @@ func initGPUHandles() *handles {
|
|
var cudartMgmtPatterns []string
|
|
var cudartMgmtPatterns []string
|
|
var nvcudaMgmtName string
|
|
var nvcudaMgmtName string
|
|
var nvcudaMgmtPatterns []string
|
|
var nvcudaMgmtPatterns []string
|
|
- var oneapiMgmtName string
|
|
|
|
- var oneapiMgmtPatterns []string
|
|
|
|
|
|
|
|
tmpDir, _ := PayloadsDir()
|
|
tmpDir, _ := PayloadsDir()
|
|
switch runtime.GOOS {
|
|
switch runtime.GOOS {
|
|
@@ -118,8 +115,6 @@ func initGPUHandles() *handles {
|
|
// Aligned with driver, we can't carry as payloads
|
|
// Aligned with driver, we can't carry as payloads
|
|
nvcudaMgmtName = "nvcuda.dll"
|
|
nvcudaMgmtName = "nvcuda.dll"
|
|
nvcudaMgmtPatterns = NvcudaWindowsGlobs
|
|
nvcudaMgmtPatterns = NvcudaWindowsGlobs
|
|
- oneapiMgmtName = "ze_intel_gpu64.dll"
|
|
|
|
- oneapiMgmtPatterns = OneapiWindowsGlobs
|
|
|
|
case "linux":
|
|
case "linux":
|
|
cudartMgmtName = "libcudart.so*"
|
|
cudartMgmtName = "libcudart.so*"
|
|
if tmpDir != "" {
|
|
if tmpDir != "" {
|
|
@@ -130,8 +125,6 @@ func initGPUHandles() *handles {
|
|
// Aligned with driver, we can't carry as payloads
|
|
// Aligned with driver, we can't carry as payloads
|
|
nvcudaMgmtName = "libcuda.so*"
|
|
nvcudaMgmtName = "libcuda.so*"
|
|
nvcudaMgmtPatterns = NvcudaLinuxGlobs
|
|
nvcudaMgmtPatterns = NvcudaLinuxGlobs
|
|
- oneapiMgmtName = "libze_intel_gpu.so"
|
|
|
|
- oneapiMgmtPatterns = OneapiLinuxGlobs
|
|
|
|
default:
|
|
default:
|
|
return gpuHandles
|
|
return gpuHandles
|
|
}
|
|
}
|
|
@@ -159,17 +152,6 @@ func initGPUHandles() *handles {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- oneapiLibPaths := FindGPULibs(oneapiMgmtName, oneapiMgmtPatterns)
|
|
|
|
- if len(oneapiLibPaths) > 0 {
|
|
|
|
- deviceCount, oneapi, libPath := LoadOneapiMgmt(oneapiLibPaths)
|
|
|
|
- if oneapi != nil {
|
|
|
|
- slog.Debug("detected Intel GPUs", "library", libPath, "count", deviceCount)
|
|
|
|
- gpuHandles.oneapi = oneapi
|
|
|
|
- gpuHandles.deviceCount = deviceCount
|
|
|
|
- return gpuHandles
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
return gpuHandles
|
|
return gpuHandles
|
|
}
|
|
}
|
|
|
|
|
|
@@ -245,18 +227,6 @@ func GetGPUInfo() GpuInfoList {
|
|
// TODO potentially sort on our own algorithm instead of what the underlying GPU library does...
|
|
// TODO potentially sort on our own algorithm instead of what the underlying GPU library does...
|
|
resp = append(resp, gpuInfo)
|
|
resp = append(resp, gpuInfo)
|
|
}
|
|
}
|
|
- if gpuHandles.oneapi != nil {
|
|
|
|
- gpuInfo := GpuInfo{
|
|
|
|
- Library: "oneapi",
|
|
|
|
- }
|
|
|
|
- C.oneapi_check_vram(*gpuHandles.oneapi, &memInfo)
|
|
|
|
- var totalFreeMem float64 = float64(memInfo.free) * 0.95 // work-around: leave some reserve vram for mkl lib used in ggml-sycl backend.
|
|
|
|
- memInfo.free = C.uint64_t(totalFreeMem)
|
|
|
|
- gpuInfo.TotalMemory = uint64(memInfo.total)
|
|
|
|
- gpuInfo.FreeMemory = uint64(memInfo.free)
|
|
|
|
- gpuInfo.ID = strconv.Itoa(i)
|
|
|
|
- resp = append(resp, gpuInfo)
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// Then AMD
|
|
// Then AMD
|