-
Notifications
You must be signed in to change notification settings - Fork 151
[Ollama] Fix container runtime args for nvidia GPU on podman #984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ollama] Fix container runtime args for nvidia GPU on podman #984
Conversation
… podman container runtime.
…6/CommunityToolkit-Aspire into podman-nvidia-gpu-support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes Nvidia GPU support for Podman container runtime by detecting the container runtime and using the appropriate flags (--device nvidia.com/gpu=all for Podman vs --gpus all for Docker).
Key Changes:
- Extracted Nvidia GPU configuration into a separate
WithNvidiaGPUSupportmethod that checks the container runtime - Added
GetContainerRuntimehelper method to read container runtime from configuration (supports bothASPIRE_CONTAINER_RUNTIMEand legacyDOTNET_ASPIRE_CONTAINER_RUNTIME) - Refactored tests to use helper methods (
AssertSingleResourceandAssertContainerRuntimeArgs) to reduce duplication
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/CommunityToolkit.Aspire.Hosting.Ollama/OllamaResourceBuilderExtensions.cs | Adds runtime detection logic to apply correct GPU arguments for Podman vs Docker, introduces WithNvidiaGPUSupport and GetContainerRuntime helper methods |
| tests/CommunityToolkit.Aspire.Hosting.Ollama.Tests/AddOllamaTests.cs | Refactors GPU tests with helper methods, adds tests for Podman with both new and legacy configuration keys |
Closes #983
PR Checklist
Other information