Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

Add support for CUDA 5.2 cards

Daniel Hiltgen681a91499010
diff --git a/gpu/gpu.go b/gpu/gpu.go
index 67bd83529..06d022fe2 100644
--- a/gpu/gpu.go
+++ b/gpu/gpu.go
@@ -29,8 +29,9 @@ type handles struct {
var gpuMutex sync.Mutex
var gpuHandles *handles = nil
-// With our current CUDA compile flags, 5.2 and older will not work properly
-const CudaComputeMajorMin = 6
+// With our current CUDA compile flags, older than 5.2 will not work properly
+// 5.0: CUDA error: no kernel image is available for execution on the device
+var CudaComputeMin = [2]C.int{5, 2}
// Possible locations for the nvidia-ml library
var CudaLinuxGlobs = []string{
@@ -133,7 +134,7 @@ func GetGPUInfo() GpuInfo {
if cc.err != nil {
slog.Info(fmt.Sprintf("error looking up CUDA GPU compute capability: %s", C.GoString(cc.err)))
C.free(unsafe.Pointer(cc.err))
- } else if cc.major >= CudaComputeMajorMin {
+ } else if cc.major > CudaComputeMin[0] || (cc.major == CudaComputeMin[0] && cc.minor >= CudaComputeMin[1]) {
slog.Info(fmt.Sprintf("CUDA Compute Capability detected: %d.%d", cc.major, cc.minor))
resp.Library = "cuda"
} else {
diff --git a/llm/generate/gen_linux.sh b/llm/generate/gen_linux.sh
index 0fcf13568..f00d717cb 100755
--- a/llm/generate/gen_linux.sh
+++ b/llm/generate/gen_linux.sh
@@ -125,7 +125,7 @@ if [ -d "${CUDA_LIB_DIR}" ]; then
if [ -n "${CUDA_MAJOR}" ]; then
CUDA_VARIANT=_v${CUDA_MAJOR}
fi
- CMAKE_DEFS="-DLLAMA_CUBLAS=on ${COMMON_CMAKE_DEFS} ${CMAKE_DEFS}"
+ CMAKE_DEFS="-DLLAMA_CUBLAS=on -DLLAMA_CUDA_FORCE_MMQ=on ${COMMON_CMAKE_DEFS} ${CMAKE_DEFS}"
BUILD_DIR="${LLAMACPP_DIR}/build/linux/${ARCH}/cuda${CUDA_VARIANT}"
EXTRA_LIBS="-L${CUDA_LIB_DIR} -lcudart -lcublas -lcublasLt -lcuda"
build