mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 10:52:22 +00:00
fix(oci): run Ollama and llama.cpp on Intel and AMD integrated GPUs
This commit is contained in:
@@ -305,9 +305,53 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "vulkan",
|
||||
"label": "Intel/AMD (Vulkan)",
|
||||
"architectures": [
|
||||
"amd64"
|
||||
],
|
||||
"image": {
|
||||
"reference": "ghcr.io/ggml-org/llama.cpp:server-vulkan",
|
||||
"registry": "ghcr.io",
|
||||
"repository": "ghcr.io/ggml-org/llama.cpp",
|
||||
"tag": "server-vulkan",
|
||||
"digest": null,
|
||||
"pull_policy": "resolve-selected-tag-to-architecture-digest-at-install"
|
||||
},
|
||||
"device_requests": [
|
||||
{
|
||||
"id": "gpu-render",
|
||||
"path_prompt": "GPU render device",
|
||||
"host_path_default": "/dev/dri/renderD128",
|
||||
"mode": "0660",
|
||||
"deny_write": false,
|
||||
"gid_strategy": "host-device-gid",
|
||||
"kind": "character-device",
|
||||
"container_path_strategy": "same-as-host",
|
||||
"drm_vendor_ids": [
|
||||
"0x8086",
|
||||
"0x1002"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "rocm",
|
||||
"label": "AMD (ROCm)",
|
||||
"amd_gfx_targets": [
|
||||
90008,
|
||||
90010,
|
||||
90402,
|
||||
100300,
|
||||
110000,
|
||||
110001,
|
||||
110002,
|
||||
110500,
|
||||
110501,
|
||||
120000,
|
||||
120001
|
||||
],
|
||||
"architectures": [
|
||||
"amd64"
|
||||
],
|
||||
|
||||
@@ -410,9 +410,60 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "vulkan",
|
||||
"label": "Intel/AMD (Vulkan)",
|
||||
"architectures": [
|
||||
"amd64"
|
||||
],
|
||||
"image": {
|
||||
"reference": "ollama/ollama:latest",
|
||||
"registry": "docker.io",
|
||||
"repository": "ollama/ollama",
|
||||
"tag": "latest",
|
||||
"digest": null,
|
||||
"pull_policy": "resolve-selected-tag-to-architecture-digest-at-install"
|
||||
},
|
||||
"device_requests": [
|
||||
{
|
||||
"id": "gpu-render",
|
||||
"path_prompt": "GPU render device",
|
||||
"host_path_default": "/dev/dri/renderD128",
|
||||
"mode": "0660",
|
||||
"deny_write": false,
|
||||
"gid_strategy": "host-device-gid",
|
||||
"kind": "character-device",
|
||||
"container_path_strategy": "same-as-host",
|
||||
"drm_vendor_ids": [
|
||||
"0x8086",
|
||||
"0x1002"
|
||||
]
|
||||
}
|
||||
],
|
||||
"environment": [
|
||||
{
|
||||
"name": "OLLAMA_IGPU_ENABLE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "rocm",
|
||||
"label": "AMD (ROCm)",
|
||||
"amd_gfx_targets": [
|
||||
90008,
|
||||
90010,
|
||||
90402,
|
||||
90500,
|
||||
100300,
|
||||
110000,
|
||||
110001,
|
||||
110002,
|
||||
110500,
|
||||
110501,
|
||||
120000,
|
||||
120001
|
||||
],
|
||||
"architectures": [
|
||||
"amd64"
|
||||
],
|
||||
@@ -448,6 +499,12 @@
|
||||
"kind": "character-device",
|
||||
"container_path_strategy": "same-as-host"
|
||||
}
|
||||
],
|
||||
"environment": [
|
||||
{
|
||||
"name": "OLLAMA_IGPU_ENABLE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -305,9 +305,53 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "vulkan",
|
||||
"label": "Intel/AMD (Vulkan)",
|
||||
"architectures": [
|
||||
"amd64"
|
||||
],
|
||||
"image": {
|
||||
"reference": "ghcr.io/ggml-org/llama.cpp:server-vulkan",
|
||||
"registry": "ghcr.io",
|
||||
"repository": "ghcr.io/ggml-org/llama.cpp",
|
||||
"tag": "server-vulkan",
|
||||
"digest": null,
|
||||
"pull_policy": "resolve-selected-tag-to-architecture-digest-at-install"
|
||||
},
|
||||
"device_requests": [
|
||||
{
|
||||
"id": "gpu-render",
|
||||
"path_prompt": "GPU render device",
|
||||
"host_path_default": "/dev/dri/renderD128",
|
||||
"mode": "0660",
|
||||
"deny_write": false,
|
||||
"gid_strategy": "host-device-gid",
|
||||
"kind": "character-device",
|
||||
"container_path_strategy": "same-as-host",
|
||||
"drm_vendor_ids": [
|
||||
"0x8086",
|
||||
"0x1002"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "rocm",
|
||||
"label": "AMD (ROCm)",
|
||||
"amd_gfx_targets": [
|
||||
90008,
|
||||
90010,
|
||||
90402,
|
||||
100300,
|
||||
110000,
|
||||
110001,
|
||||
110002,
|
||||
110500,
|
||||
110501,
|
||||
120000,
|
||||
120001
|
||||
],
|
||||
"architectures": [
|
||||
"amd64"
|
||||
],
|
||||
|
||||
@@ -51,9 +51,60 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "vulkan",
|
||||
"label": "Intel/AMD (Vulkan)",
|
||||
"architectures": [
|
||||
"amd64"
|
||||
],
|
||||
"image": {
|
||||
"reference": "ollama/ollama:latest",
|
||||
"registry": "docker.io",
|
||||
"repository": "ollama/ollama",
|
||||
"tag": "latest",
|
||||
"digest": null,
|
||||
"pull_policy": "resolve-selected-tag-to-architecture-digest-at-install"
|
||||
},
|
||||
"device_requests": [
|
||||
{
|
||||
"id": "gpu-render",
|
||||
"path_prompt": "GPU render device",
|
||||
"host_path_default": "/dev/dri/renderD128",
|
||||
"mode": "0660",
|
||||
"deny_write": false,
|
||||
"gid_strategy": "host-device-gid",
|
||||
"kind": "character-device",
|
||||
"container_path_strategy": "same-as-host",
|
||||
"drm_vendor_ids": [
|
||||
"0x8086",
|
||||
"0x1002"
|
||||
]
|
||||
}
|
||||
],
|
||||
"environment": [
|
||||
{
|
||||
"name": "OLLAMA_IGPU_ENABLE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "rocm",
|
||||
"label": "AMD (ROCm)",
|
||||
"amd_gfx_targets": [
|
||||
90008,
|
||||
90010,
|
||||
90402,
|
||||
90500,
|
||||
100300,
|
||||
110000,
|
||||
110001,
|
||||
110002,
|
||||
110500,
|
||||
110501,
|
||||
120000,
|
||||
120001
|
||||
],
|
||||
"architectures": [
|
||||
"amd64"
|
||||
],
|
||||
@@ -89,6 +140,12 @@
|
||||
"kind": "character-device",
|
||||
"container_path_strategy": "same-as-host"
|
||||
}
|
||||
],
|
||||
"environment": [
|
||||
{
|
||||
"name": "OLLAMA_IGPU_ENABLE",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -48,8 +48,25 @@ class HostProfileTests(unittest.TestCase):
|
||||
def test_an_amd_host_is_not_offered_nvidia(self, *_):
|
||||
amd = {"intel": [], "amd": [NODE], "nvidia": False}
|
||||
self.assertEqual(self.offered("frigate", amd, kfd=True)[0], ["none", "vaapi", "rocm"])
|
||||
self.assertEqual(self.offered("ollama", amd, kfd=True)[0], ["cpu", "rocm"])
|
||||
self.assertEqual(self.offered("llamacpp", amd, kfd=True)[0], ["cpu", "rocm"])
|
||||
self.assertEqual(self.offered("ollama", amd, kfd=True)[0], ["cpu", "vulkan", "rocm"])
|
||||
self.assertEqual(self.offered("llamacpp", amd, kfd=True)[0], ["cpu", "vulkan", "rocm"])
|
||||
|
||||
def test_a_radeon_780m_gets_rocm_as_experimental_with_its_generation(self, *_):
|
||||
# gfx1103 is not among the kernels of the Ollama and llama.cpp ROCm
|
||||
# images; it runs presented as gfx1100. Without its compute device,
|
||||
# Vulkan still uses it.
|
||||
amd = {"intel": [], "amd": [NODE], "nvidia": False, "amd_gfx_target": 110003}
|
||||
for app in ("ollama", "llamacpp"):
|
||||
with patch("proxmenux_oci.installer.confirm_experimental_rocm", return_value=True):
|
||||
plan = self.offered(app, amd, kfd=True, answer="rocm")[2]
|
||||
override = [item["value"] for item in plan["environment"] if item["name"] == "HSA_OVERRIDE_GFX_VERSION"]
|
||||
self.assertEqual(override, ["11.0.0"], app)
|
||||
if app == "ollama":
|
||||
self.assertIn({"name": "OLLAMA_IGPU_ENABLE", "value": "1", "sensitive": False}, plan["environment"])
|
||||
self.assertEqual(self.offered(app, amd, kfd=False)[0], ["cpu", "vulkan"], app)
|
||||
# Ollama leaves an integrated GPU out unless it is told to use it.
|
||||
plan = self.offered("ollama", amd, kfd=False, answer="vulkan")[2]
|
||||
self.assertIn({"name": "OLLAMA_IGPU_ENABLE", "value": "1", "sensitive": False}, plan["environment"])
|
||||
|
||||
def test_rocm_is_not_offered_without_its_compute_device(self, *_):
|
||||
amd = {"intel": [], "amd": [NODE], "nvidia": False}
|
||||
@@ -58,7 +75,7 @@ class HostProfileTests(unittest.TestCase):
|
||||
def test_an_intel_and_nvidia_host_is_not_offered_amd(self, *_):
|
||||
both = {"intel": [NODE], "amd": [], "nvidia": True}
|
||||
self.assertEqual(self.offered("frigate", both)[0], ["none", "vaapi", "nvidia"])
|
||||
self.assertEqual(self.offered("llamacpp", both)[0], ["cpu", "nvidia", "intel"])
|
||||
self.assertEqual(self.offered("llamacpp", both)[0], ["cpu", "nvidia", "vulkan", "intel"])
|
||||
|
||||
def test_a_host_without_gpu_is_told_and_not_asked(self, *_):
|
||||
nothing = {"intel": [], "amd": [], "nvidia": False}
|
||||
|
||||
@@ -17,9 +17,11 @@ from test_advanced_flow_order import RecordingUI, storages
|
||||
|
||||
RENDER, KFD = "/dev/dri/renderD128", "/dev/kfd"
|
||||
EXPECTED = {
|
||||
"ollama": {"cpu": (":latest", []), "nvidia": (":latest", ["nvidia-runtime"]), "rocm": (":rocm", [RENDER, KFD])},
|
||||
"ollama": {"cpu": (":latest", []), "nvidia": (":latest", ["nvidia-runtime"]), "vulkan": (":latest", [RENDER]),
|
||||
"rocm": (":rocm", [RENDER, KFD])},
|
||||
"llamacpp": {"cpu": (":server", []), "nvidia": (":server-cuda", ["nvidia-runtime"]),
|
||||
"rocm": (":server-rocm", [RENDER, KFD]), "intel": (":server-intel", [RENDER])},
|
||||
"vulkan": (":server-vulkan", [RENDER]), "rocm": (":server-rocm", [RENDER, KFD]),
|
||||
"intel": (":server-intel", [RENDER])},
|
||||
"faster-whisper": {"cpu": (":latest", []), "nvidia": (":gpu", ["nvidia-runtime"])},
|
||||
"piper": {"cpu": (":latest", []), "nvidia": (":gpu", ["nvidia-runtime"])},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user