-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: add GPU support for NVIDIA & AMD GPUs in installation and Docker setup (ollama) #229
base: release/2.2.0
Are you sure you want to change the base?
Conversation
…etup - Introduced GPU support for both NVIDIA and AMD GPUs in the installation script and Docker setup. - Added a new script gpu_support.sh to detect GPU type and configure the environment accordingly. - Updated install.sh to check for GPU support and install necessary dependencies based on the detected GPU type. - Modified the Makefile to include GPU configuration options, allowing users to enable GPU support during Docker operations. - Added new Docker Compose file docker-compose.gpu.yml to handle GPU-specific configurations. - Created separate Dockerfiles for NVIDIA and AMD GPU support under the docker/ollama directory.
- Removed redundant checks for GPU support in the .env file and streamlined the GPU detection process. - Replaced "rocm" with "amd" for AMD GPU detection and configuration. - Simplified Docker Compose GPU configuration by removing specific GPU capabilities and adding general GPU settings. - Updated the Makefile to handle GPU configuration more efficiently, including the use of profiles for Docker Compose. - Added labels to the Dockerfile for GPU support information. - Modified the GPU detection script to reflect changes in AMD GPU identification.
-Updated the GPU settings in the Docker Compose file to use NVIDIA-specific configurations, removing AMD ROCm-specific settings. -Registered a new model, OllamaSettings, in the Django admin interface.
- Enhanced the Gunicorn server configuration in the Docker entrypoint script by adding timeout and keep-alive settings to improve server performance and reliability.
…anager Removed the 'selected' field from the defaults dictionary in the OllamaManager class to clean up unused code.
Reviewer's Guide by SourceryThis PR implements GPU support for NVIDIA and AMD GPUs in the installation process and Docker setup. The implementation includes automatic GPU detection, installation of required drivers/toolkits, and Docker configuration for GPU support. The changes primarily focus on NVIDIA GPU support, with AMD support added but untested. Sequence diagram for GPU detection and setupsequenceDiagram
participant User
participant InstallScript as install.sh
participant GPUSupportScript as gpu_support.sh
participant Docker
User->>InstallScript: Run installation
InstallScript->>GPUSupportScript: Source gpu_support.sh
InstallScript->>GPUSupportScript: Detect GPU type
GPUSupportScript-->>InstallScript: Return GPU type (nvidia/amd/none)
InstallScript->>InstallScript: Check GPU type
alt NVIDIA GPU detected
InstallScript->>Docker: Install NVIDIA Container Toolkit
InstallScript->>Docker: Configure Docker runtime for NVIDIA
else AMD GPU detected
InstallScript->>Docker: Install ROCm
InstallScript->>Docker: Configure user groups
else No GPU detected
InstallScript->>InstallScript: Continue with CPU-only setup
end
InstallScript-->>User: Installation complete
Class diagram for GPU support scripts and DockerfilesclassDiagram
class InstallScript {
+check_gpu_support()
+install_make()
+main()
}
class GPUSupportScript {
+detect_gpu_type()
+debug_log()
}
class Makefile {
+gpu_config()
}
class DockerComposeGPU {
+services
+profiles
}
class DockerfileNVIDIA {
+NVIDIA_VISIBLE_DEVICES
+NVIDIA_DRIVER_CAPABILITIES
}
class DockerfileAMD {
+HSA_OVERRIDE_GFX_VERSION
+ROCR_VISIBLE_DEVICES
}
InstallScript --> GPUSupportScript : uses
InstallScript --> Makefile : modifies
DockerComposeGPU --> DockerfileNVIDIA : extends
DockerComposeGPU --> DockerfileAMD : extends
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @psyray - I've reviewed your changes - here's some feedback:
Overall Comments:
- The AMD GPU support is currently untested and should be clearly marked as experimental in the documentation. Consider adding warning logs when users attempt to use AMD GPU support to make it clear it's not production-ready.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Fixes #227
Config for the 2 types of card has been added, but only NVIDIA GPU is effective and tested for the moment.
I don't have any AMD card to do testing.
Maybe later, but for now let's go with NVIDIA
Summary by Sourcery
Add GPU support for NVIDIA and AMD GPUs in the installation and Docker setup, including scripts for GPU detection and configuration, and Dockerfiles for specific GPU types.
New Features:
Enhancements:
Build:
Todo