Skip to content

Commit

Permalink
fix lint & compile
Browse files Browse the repository at this point in the history
  • Loading branch information
zhewang1-intc committed Mar 19, 2024
1 parent d815e78 commit edfbd44
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 64 deletions.
54 changes: 0 additions & 54 deletions gpu/gpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ var OneapiLinuxGlobs = []string{
"/usr/lib*/libze_intel_gpu.so*",
}

var OneapiLinuxGlobs = []string{
"/usr/lib/x86_64-linux-gnu/libze_intel_gpu.so*",
"/usr/lib*/libze_intel_gpu.so*",
}

// Note: gpuMutex must already be held
func initGPUHandles() {

Expand Down Expand Up @@ -110,16 +105,6 @@ func initGPUHandles() {
return
}
}

oneapiLibPaths := FindGPULibs(oneapiMgmtName, oneapiMgmtPatterns)
if len(oneapiLibPaths) > 0 {
oneapi := LoadOneapiMgmt(oneapiLibPaths)
if oneapi != nil {
slog.Info("Intel GPU detected")
gpuHandles.oneapi = oneapi
return
}
}
}

func GetGPUInfo() GpuInfo {
Expand Down Expand Up @@ -185,28 +170,6 @@ func GetGPUInfo() GpuInfo {
if resp.Library != "" {
return resp
}
} else if gpuHandles.oneapi != nil && (cpuVariant != "" || runtime.GOARCH != "amd64") {
C.oneapi_check_vram(*gpuHandles.oneapi, &memInfo)
if memInfo.err != nil {
slog.Info(fmt.Sprintf("error looking up OneAPI GPU memory: %s", C.GoString(memInfo.err)))
C.free(unsafe.Pointer(memInfo.err))
} else if memInfo.igpu_index >= 0 && memInfo.count == 1 {
// Only one GPU detected and it appears to be an integrated GPU - skip it
slog.Info("OneAPI unsupported integrated GPU detected")
} else if memInfo.count > 0 {
if memInfo.igpu_index >= 0 {
// We have multiple GPUs reported, and one of them is an integrated GPU
// so we have to set the env var to bypass it
// If the user has specified their own SYCL_DEVICE_ALLOWLIST, don't clobber it
val := os.Getenv("SYCL_DEVICE_ALLOWLIST")
if val == "" {
val = "DeviceType:gpu"
os.Setenv("SYCL_DEVICE_ALLOWLIST", val)
}
slog.Info(fmt.Sprintf("oneAPI integrated GPU detected - SYCL_DEVICE_ALLOWLIST=%s", val))
}
resp.Library = "oneapi"
}
}
if resp.Library == "" {
C.cpu_check_ram(&memInfo)
Expand Down Expand Up @@ -352,23 +315,6 @@ func LoadOneapiMgmt(rocmLibPaths []string) *C.oneapi_handle_t {
return nil
}

func LoadOneapiMgmt(rocmLibPaths []string) *C.oneapi_handle_t {
var resp C.oneapi_init_resp_t
resp.oh.verbose = getVerboseState()
for _, libPath := range rocmLibPaths {
lib := C.CString(libPath)
defer C.free(unsafe.Pointer(lib))
C.oneapi_init(lib, &resp)
if resp.err != nil {
slog.Info(fmt.Sprintf("Unable to load oneAPI management library %s: %s", libPath, C.GoString(resp.err)))
C.free(unsafe.Pointer(resp.err))
} else {
return &resp.oh
}
}
return nil
}

func getVerboseState() C.uint16_t {
if debug := os.Getenv("OLLAMA_DEBUG"); debug != "" {
return C.uint16_t(1)
Expand Down
10 changes: 0 additions & 10 deletions scripts/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,3 @@ docker build \
-f Dockerfile \
-t ollama/ollama:$VERSION-oneapi \
.

docker build \
--load \
--platform=linux/amd64 \
--build-arg=VERSION \
--build-arg=GOFLAGS \
--target runtime-oneapi \
-f Dockerfile \
-t ollama/ollama:$VERSION-oneapi \
.

0 comments on commit edfbd44

Please sign in to comment.