Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
10f33b85
Unverified
Commit
10f33b85
authored
Jun 19, 2024
by
Daniel Hiltgen
Committed by
GitHub
Jun 19, 2024
Browse files
Merge pull request #5146 from dhiltgen/backout
Put back temporary intel GPU env var
parents
4a633cc2
d34d88e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
26 deletions
+35
-26
envconfig/config.go
envconfig/config.go
+7
-0
gpu/gpu.go
gpu/gpu.go
+28
-26
No files found.
envconfig/config.go
View file @
10f33b85
...
@@ -57,6 +57,8 @@ var (
...
@@ -57,6 +57,8 @@ 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
...
@@ -101,6 +103,7 @@ func AsMap() map[string]EnvVar {
...
@@ -101,6 +103,7 @@ 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
}
}
...
@@ -276,6 +279,10 @@ func LoadConfig() {
...
@@ -276,6 +279,10 @@ 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"
)
...
...
gpu/gpu.go
View file @
10f33b85
...
@@ -280,8 +280,9 @@ func GetGPUInfo() GpuInfoList {
...
@@ -280,8 +280,9 @@ func GetGPUInfo() GpuInfoList {
}
}
// Intel
// Intel
if
envconfig
.
IntelGpu
{
oHandles
=
initOneAPIHandles
()
oHandles
=
initOneAPIHandles
()
for
d
:=
0
;
oHandles
.
oneapi
!=
nil
&&
d
<
int
(
oHandles
.
oneapi
.
num_drivers
);
d
++
{
for
d
:=
range
oHandles
.
oneapi
.
num_drivers
{
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
))
...
@@ -293,7 +294,7 @@ func GetGPUInfo() GpuInfoList {
...
@@ -293,7 +294,7 @@ func GetGPUInfo() GpuInfoList {
GpuInfo
:
GpuInfo
{
GpuInfo
:
GpuInfo
{
Library
:
"oneapi"
,
Library
:
"oneapi"
,
},
},
driverIndex
:
d
,
driverIndex
:
int
(
d
)
,
gpuIndex
:
int
(
i
),
gpuIndex
:
int
(
i
),
}
}
// TODO - split bootstrapping from updating free memory
// TODO - split bootstrapping from updating free memory
...
@@ -309,6 +310,7 @@ func GetGPUInfo() GpuInfoList {
...
@@ -309,6 +310,7 @@ func GetGPUInfo() GpuInfoList {
oneapiGPUs
=
append
(
oneapiGPUs
,
gpuInfo
)
oneapiGPUs
=
append
(
oneapiGPUs
,
gpuInfo
)
}
}
}
}
}
rocmGPUs
=
AMDGetGPUInfo
()
rocmGPUs
=
AMDGetGPUInfo
()
bootstrapped
=
true
bootstrapped
=
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment