Skip to content

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

Merge pull request #4067 from dhiltgen/cudart

Daniel Hiltgen06093fd3967d
diff --cc gpu/gpu.go
index a056a90b7,35c8d5ade..e739002f4
--- a/gpu/gpu.go
+++ b/gpu/gpu.go
@@@ -268,8 -312,25 +313,25 @@@ func LoadCUDARTMgmt(cudartLibPaths []st
return 0, nil, ""
}
+ func LoadNVCUDAMgmt(nvcudaLibPaths []string) (int, *C.nvcuda_handle_t, string) {
+ var resp C.nvcuda_init_resp_t
+ resp.ch.verbose = getVerboseState()
+ for _, libPath := range nvcudaLibPaths {
+ lib := C.CString(libPath)
+ defer C.free(unsafe.Pointer(lib))
+ C.nvcuda_init(lib, &resp)
+ if resp.err != nil {
+ slog.Debug("Unable to load nvcuda", "library", libPath, "error", C.GoString(resp.err))
+ C.free(unsafe.Pointer(resp.err))
+ } else {
+ return int(resp.num_devices), &resp.ch, libPath
+ }
+ }
+ return 0, nil, ""
+ }
+
func getVerboseState() C.uint16_t {
- if debug := os.Getenv("OLLAMA_DEBUG"); debug != "" {
+ if envconfig.Debug {
return C.uint16_t(1)
}
return C.uint16_t(0)