浏览代码

set `num_gpu` to 1 only by default on darwin arm64 (#1771)

Jeffrey Morgan 1 年之前
父节点
当前提交
c7ea8f237e
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      gpu/gpu_darwin.go

+ 5 - 1
gpu/gpu_darwin.go

@@ -33,11 +33,15 @@ func getCPUMem() (memInfo, error) {
 }
 
 func NumGPU(numLayer, fileSizeBytes int64, opts api.Options) int {
+	if opts.NumGPU != -1 {
+		return opts.NumGPU
+	}
+
+	// metal only supported on arm64
 	if runtime.GOARCH == "arm64" {
 		return 1
 	}
 
-	// metal only supported on arm64
 	return 0
 }