Revert "gpu: add env var for detecting Intel oneapi gpus (#5076)"

This reverts commit 163cd3e77c.
This commit is contained in:
Wang,Zhe 2024-06-19 08:59:58 +08:00
parent 21adf8b6d2
commit 755b4e4fc2
2 changed files with 26 additions and 35 deletions

View file

@ -57,8 +57,6 @@ var (
SchedSpread bool SchedSpread bool
// Set via OLLAMA_TMPDIR in the environment // Set via OLLAMA_TMPDIR in the environment
TmpDir string TmpDir string
// Set via OLLAMA_INTEL_GPU in the environment
IntelGpu bool
// Set via CUDA_VISIBLE_DEVICES in the environment // Set via CUDA_VISIBLE_DEVICES in the environment
CudaVisibleDevices string CudaVisibleDevices string
@ -103,7 +101,6 @@ func AsMap() map[string]EnvVar {
ret["ROCR_VISIBLE_DEVICES"] = EnvVar{"ROCR_VISIBLE_DEVICES", RocrVisibleDevices, "Set which AMD devices are visible"} ret["ROCR_VISIBLE_DEVICES"] = EnvVar{"ROCR_VISIBLE_DEVICES", RocrVisibleDevices, "Set which AMD devices are visible"}
ret["GPU_DEVICE_ORDINAL"] = EnvVar{"GPU_DEVICE_ORDINAL", GpuDeviceOrdinal, "Set which AMD devices are visible"} ret["GPU_DEVICE_ORDINAL"] = EnvVar{"GPU_DEVICE_ORDINAL", GpuDeviceOrdinal, "Set which AMD devices are visible"}
ret["HSA_OVERRIDE_GFX_VERSION"] = EnvVar{"HSA_OVERRIDE_GFX_VERSION", HsaOverrideGfxVersion, "Override the gfx used for all detected AMD GPUs"} ret["HSA_OVERRIDE_GFX_VERSION"] = EnvVar{"HSA_OVERRIDE_GFX_VERSION", HsaOverrideGfxVersion, "Override the gfx used for all detected AMD GPUs"}
ret["OLLAMA_INTEL_GPU"] = EnvVar{"OLLAMA_INTEL_GPU", IntelGpu, "Enable experimental Intel GPU detection"}
} }
return ret return ret
} }
@ -279,10 +276,6 @@ func LoadConfig() {
slog.Error("invalid setting", "OLLAMA_HOST", Host, "error", err, "using default port", Host.Port) slog.Error("invalid setting", "OLLAMA_HOST", Host, "error", err, "using default port", Host.Port)
} }
if set, err := strconv.ParseBool(clean("OLLAMA_INTEL_GPU")); err == nil {
IntelGpu = set
}
CudaVisibleDevices = clean("CUDA_VISIBLE_DEVICES") CudaVisibleDevices = clean("CUDA_VISIBLE_DEVICES")
HipVisibleDevices = clean("HIP_VISIBLE_DEVICES") HipVisibleDevices = clean("HIP_VISIBLE_DEVICES")
RocrVisibleDevices = clean("ROCR_VISIBLE_DEVICES") RocrVisibleDevices = clean("ROCR_VISIBLE_DEVICES")

View file

@ -280,9 +280,8 @@ func GetGPUInfo() GpuInfoList {
} }
// Intel // Intel
if envconfig.IntelGpu {
oHandles = initOneAPIHandles() oHandles = initOneAPIHandles()
for d := range oHandles.oneapi.num_drivers { for d := 0; oHandles.oneapi != nil && d < int(oHandles.oneapi.num_drivers); d++ {
if oHandles.oneapi == nil { if oHandles.oneapi == nil {
// shouldn't happen // shouldn't happen
slog.Warn("nil oneapi handle with driver count", "count", int(oHandles.oneapi.num_drivers)) slog.Warn("nil oneapi handle with driver count", "count", int(oHandles.oneapi.num_drivers))
@ -294,7 +293,7 @@ func GetGPUInfo() GpuInfoList {
GpuInfo: GpuInfo{ GpuInfo: GpuInfo{
Library: "oneapi", Library: "oneapi",
}, },
driverIndex: int(d), driverIndex: d,
gpuIndex: int(i), gpuIndex: int(i),
} }
// TODO - split bootstrapping from updating free memory // TODO - split bootstrapping from updating free memory
@ -310,7 +309,6 @@ func GetGPUInfo() GpuInfoList {
oneapiGPUs = append(oneapiGPUs, gpuInfo) oneapiGPUs = append(oneapiGPUs, gpuInfo)
} }
} }
}
rocmGPUs = AMDGetGPUInfo() rocmGPUs = AMDGetGPUInfo()
bootstrapped = true bootstrapped = true