From c7ea8f237ea1f38f664ffb2450f57f13677772f7 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Wed, 3 Jan 2024 14:10:29 -0500 Subject: [PATCH] set `num_gpu` to 1 only by default on darwin arm64 (#1771) --- gpu/gpu_darwin.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gpu/gpu_darwin.go b/gpu/gpu_darwin.go index ecca3b7b..ed63f718 100644 --- a/gpu/gpu_darwin.go +++ b/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 }