Open psyray opened 2 weeks ago
This 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.
sequenceDiagram
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
classDiagram
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
Change | Details | Files |
---|---|---|
Added GPU detection and configuration system |
|
scripts/gpu_support.sh install.sh |
Enhanced Docker and Makefile system for GPU support |
|
Makefile docker/docker-compose.gpu.yml docker/ollama/nvidia.Dockerfile docker/ollama/amd.Dockerfile |
Added NVIDIA Container Toolkit integration |
|
install.sh docker/ollama/nvidia.Dockerfile |
Added AMD ROCm support framework |
|
install.sh docker/ollama/amd.Dockerfile |
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